The scale and rotate functions are in the heart of the algorithm.
Therefore, they must both fast and high quality. Our image
abstraction allow us to use a shared buffer for all warping
functions so that we waste no time allocating memory. For extra
performance and simplicity, we chose multi-pass transforms.
Note that a scale matrix can be split in its horizontal and
vertical scale components:
Similarly, a rotation matrix can be split in the
following product of shear matrices:
Notice too that these simpler transformations preserve either
lines or column and are, therefore, easy to implement. For quality,
each line/column preserving transformation is implemented with
linear interpolation. The results can be seen below:
|
Examples of
Rotation and Scaling of images |
StrokeParameters
For each point (x,y)
marked black in the StrokePositionsImage,
stroke parameters are collected. The color is that of the
corresponding pixel in the Input
image. The parameters w, l,
xc, yc
and theta are determined from the ColorImageDifference
between the image region around (x,y)
in the Input image and the
color C.
Below we see some
examples of ColorDifferenceImages
and their corresponding parameters:
|
|
|
|
|
|
The
fish image has been analyzed and the parameters extracted
were used to blend the arrow texture over the black
blackground. Note how they match. |
Blend
The Blend function
takes a RGB Input image, a
monochrome Stroke and a
color C. The function then
alpha-blends the Stroke
with the given color into the Input image. As can be seen in the
Main Algorithm, starting with a blank image, this process of
composition continues until all strokes have been processed and the
result image is ready.
|
|
Examples of
Strokes blended on a white image. The stroke parameters are
the same in both images. |
|