Stippling
http://www.cs.ubc.ca/labs/imager/tr/2002/secord2002b/secord.2002b.pdf
- Black Stippling & Colors Stippling
Stippling algorithm is designed for reproducing images as dot patterns.
I.Black Stippling
1.Gray Level
The image pixel information is stored in the array after regular texture shading.
First, convert the image into a gray level image. The gray level image shows the darkness and brightness information of the original image. More dots are needed in the darker part of the gray level image, when less dots should be painted in the brighter part..
Equation of compute the gray level of the original image to approximate lthe actual black-white picture: Grey = R = B = G = ( red * 30 + green * 59 + blue * 11 ) / 100;
Grey level is between [0 , 255] ;
Grey level image result:
2.Stipple Level
Each pixel of the image has a stipple level as long as it has a gray level.
Stipple level = ( gray level) / P + 1. ( round down )
Since P is defined as 20 in the project, Stipple level is between [ 1 , 13 ].
Stipple level represent the possibility the pixel is drawn as black dots.
The stipple level has a linear negative relationship to the possibility.
Pixels that have same stipple level also have the same possibility to be drawn as black dots.
Result of implementing stipple level only:
3.Sub-area Sample
The former result seem to be in a mess. So the pre-computation of stipple level is required. Thus, divide the original image into several sub-area then compute the stipple level.
The size of sub-area is determined ahead.(4*4 in the project)
Use the mean of gray level of those 16 pixels in one subarea to pre-compute the sub-area’s stipple level. Stipple level of the sub-area determine how many pixels will be colored black in the area.( linear negative relationship)
Result of sub-area sample:
4.Sort by Stipple Level
The result of sub-area is still lack of information to represent original image by dots, thus sort the stipple level of the pixels in the sub-area. Construct a priority queue to determine the order of draw black dots.
Result
5.Reserved Stipple Level
In each sub-area there are 16 pixels.
The stipple level is between 1 and 13.
A reserved level is set to determine how many pixels will be draw as black dots in one sub-area.( number of black dots = reserved level - stipple level + 1.)
Results:
Reserved Level = 12. ( 12 black pixels at most.)
Reserved Level = 9. ( 15 black pixels at most.)
Reserved Level = 15. ( 15 black pixels at most.)
II.Colors Stippling
Use red, green and blue dots to reproduce the image instead of black dots.
Color Stipple Level
Red stipple level = ( g + b ) / 40 ;
Green stipple level = ( b + r ) / 40 ;
Blue stipple level = ( r + g ) / 40 ;
Result:
III Improvements
1. Pre-compute for the whole image to get a threshold/reserve level of all pixels;
2. Compute the stipple level for each pixel
3. Use the threhold and stipple level, get a possibility for each pixel.
4. Draw dots;
Results:
Black:
Colors: