Download presentation
Presentation is loading. Please wait.
1
Yu-Chi Lai Mohamed Eldawy
Project 1 Help Section Yu-Chi Lai Mohamed Eldawy 11/13/2018 © University of Wisconsin, CS559 Fall 2006
2
© University of Wisconsin, CS559 Fall 2006
Topics Color Dithering Warping Impressionist Questions 11/13/2018 © University of Wisconsin, CS559 Fall 2006
3
Transformation from One Image to Another
11/13/2018 © University of Wisconsin, CS559 Fall 2006
4
Dithering with Floyd-Steinberg
Procedures for black and white Turn color into grayscale: I=0.299R+0.587G+0.114B Fill in the pixel with either black or white depends on the luminance of the current pixel Diffuse the error (luminance difference between filled value and current value) to the adjacent unprocessed pixels Zigzag until we reach the end can improve the result e 7/16 3/16 5/16 1/16 11/13/2018 © University of Wisconsin, CS559 Fall 2006
5
© University of Wisconsin, CS559 Fall 2006
Dithering with Color Difference between black-white and color dithering: Choose the closest color from the palette for the current pixel Diffuse the error (color difference in r, g, b) to the adjacent unprocessed pixels 11/13/2018 © University of Wisconsin, CS559 Fall 2006
6
© University of Wisconsin, CS559 Fall 2006
Result (149, 91, 110)(176, 116, 137) (17, 11,15) (63, 47, 69) (93, 75, 112)(47, 62, 24) (76, 90,55)(190, 212, 115) (160, 176, 87)(116, 120, 87) (245, 246, 225)(148, 146, 130) (200, 195, 180)(36, 32, 27) (87, 54, 45)(121, 72, 72) 11/13/2018 © University of Wisconsin, CS559 Fall 2006
7
© University of Wisconsin, CS559 Fall 2006
Image Warping A mapping between pixel locations No color changes Examples 11/13/2018 © University of Wisconsin, CS559 Fall 2006
8
© University of Wisconsin, CS559 Fall 2006
Some Examples 11/13/2018 © University of Wisconsin, CS559 Fall 2006
9
© University of Wisconsin, CS559 Fall 2006
Challenges (1) Direction of transform for(int i = 0 ; i < wid ; i ++) for(int j = 0 ; j < hei ; j ++) { (i’,j’)= location of (i,j) in the destination result(i’,j’) = source(i,j) } OR (i’,j’)= location where (i,j) comes from result(i,j) = source(i’,j’) Forward Backward 11/13/2018 © University of Wisconsin, CS559 Fall 2006
10
© University of Wisconsin, CS559 Fall 2006
Challenges (2) for(int i = 0 ; i < wid ; i ++) for(int j = 0 ; j < hei ; j ++) { (i’,j’)= location where (i,j) comes from result(i,j) = source(i’,j’) } Choosing a sampling method Nearest neighbor Bilinear Gaussian Could be non-integer 11/13/2018 © University of Wisconsin, CS559 Fall 2006
11
© University of Wisconsin, CS559 Fall 2006
Challenges (3) This is not really a one to one mapping 11/13/2018 © University of Wisconsin, CS559 Fall 2006
12
© University of Wisconsin, CS559 Fall 2006
Coding Hints A function that computes the mapping makes changing functions much easier void transform(int x,int y, float& x2, float& y2) A sampling function makes it easier to change sampling method RGBTriple sample(int samplingMethod, float x,float y) Don’t forget to handle the case of coordinates outside image Can also be used in your resizing code 11/13/2018 © University of Wisconsin, CS559 Fall 2006
13
© University of Wisconsin, CS559 Fall 2006
Impressionist Transform an image like a photo or a poster to some human artistic styles. From observation of human drawings, we must determine Do it manually or automatically Where to draw What color should we use What size and shape of pens should we use What order should we place our draws What direction should we draw 11/13/2018 © University of Wisconsin, CS559 Fall 2006
14
Impressionist (Automatic)
Easiest way to think about it is block by block Too mechanic 11/13/2018 © University of Wisconsin, CS559 Fall 2006
15
© University of Wisconsin, CS559 Fall 2006
Detailed (1) To make it look nature, we can do Choose the drawing points randomly Random choose the size of the pen and size of the strokes Perturbation of the choosing color. Orientation of the strokes Choose a special shape for the pen used such as square, circle, eclipse, or others. Choose how to solve overlap problem Make sure that the entire pictures has been covered 11/13/2018 © University of Wisconsin, CS559 Fall 2006
16
© University of Wisconsin, CS559 Fall 2006
Detailed (2) Solve the overlap problem Blending like watercolor drawing Overwrite like oil painting 11/13/2018 © University of Wisconsin, CS559 Fall 2006
17
© University of Wisconsin, CS559 Fall 2006
Code Hint For reusing your code, you can have a function to place a draw on a position with your own designed shape, size and so on. For example, I used this function void PlaceDraw(BrushShape, Position, Size, FlagFor BlendingMethod) BrushShape: an array to indicate the brush property e.g. circle, square Position: two float numbers to indicate where to place the draw Size: a float number, the size of the draw FlagForBlendingMethod: integer to indicate overlap, blending, or other method 11/13/2018 © University of Wisconsin, CS559 Fall 2006
18
Advance: Layer Drawing
When observing how human draw. Put a background color on. Draw big regions Draw small regions in each big region. Draw the detail on each small region. Pyramid Method Decompose a picture into image pyramid (When implementing it, we use different size of filtering kernel Place draws according to the information in each layer with different size of brush. 11/13/2018 © University of Wisconsin, CS559 Fall 2006
19
Questions about Project 1 ?
11/13/2018 © University of Wisconsin, CS559 Fall 2006
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.