Image Processing Reference
In-Depth Information
Fig. 11.8 Random inversions
11.1.5 Randomness
It can often be interesting to add some randomness in order to create a visual effect.
This can be done in many different ways and only the imagination of the designer
sets the limit. The output will be different from time to time even though the input
in the same. This adds a nice uniqueness to visual effects involving randomness.
Below we describe one concrete example, namely an algorithm denoted random
inversions .
The algorithm is based on the idea of generating a random binary pattern and
then using this to apply image inversion locally. First the output image is divided
into squares of equal size S
S . For each square we draw a random number between
zero and one. If this number is above 0.5 then the square is set to white; otherwise
to black. This will result in an intermediate output like the one in Fig. 11.8 (a). In the
next step the intermediate output in blurred by a mean filter in order to obtain softer
shapes, see Fig. 11.8 (b). The kernel size is equal to S/ 2. The blurred squares are
now thresholded, using a threshold value of 128, to ensure the edges of the shapes
are sharp, see Fig. 11.8 (c). For each white pixel we now invert the corresponding
RGB pixel in the input and place that in the output. For each black pixel we simply
×
Search WWH ::




Custom Search