|
The ColorDifferenceImage
tells which regions in a image are closest to a given color. When a
pixel in the Input image
has a color close to C, the
resulting pixel is light. Otherwise, it is dark.
ColorDifferenceImage(Input, C)
begin
Output = NewImage(Width(Input), Height(Input), White)
for (x,y) in Input
do
Set(Output, x, y, Distance(Color(Input, x, y), C))
return Output
end |
Once a color and a region are chosen, this image is calculated
and is used to help determine the distribution of the given color that
better approximates the region.

StrokePositionsImage
The StrokePositionsImage algorithm takes the
StrokeAreaImage and
generates a distribution of points where the strokes will be placed.
The desired characteristics in the distribution are the following:
- The concentration of strokes should be inversely proportional
to the size of the strokes;
- It should not be possible to recognize any patterns in the
distribution;
- It should be possible to control the concentration of points
on the borders of the image;
- It should be possible to control the size of the largest
region without a stroke.
The original implementation chose a Space-Filling curve dithering
technique as a solution. We, however, developed a variation of the
Floyd Steinberg Dithering algorithm, that spreads the error randomly
in all directions. Furthermore, the error accumulated on each pixel
follows the rule:

Therefore, the parameter p performs a gamma-correction on
the image, controlling the concentration of strokes near the borders
of the image. The parameter s is the largest length of pixels
that can receive no stroke. The implementation is very simple and
the results satisfactory:
|