Graphics Reference
In-Depth Information
with the relationship s = (1 − b )/2. Make b a slider uniform variable in
a GLIB file and use glman to experiment with this concept. Record and
comment on your results.
8. You can combine the manipulation techniques described in this chapter
to achieve other specific effects. For example, if you have a photograph
of a green apple but you want an image of a red apple, you can use the
technique from the chromakey to select the greens of the apple and then
use the hue shifting operation to change the green to red, while retaining
some of the character of the green apple. Pick one of your images that has
a strong area of some color, and change that color to another color.
9. Combine some of the effects from this chapter and see what you get. For
example, you can sharpen images with one technique and then make
them grayscale with another. (Does it mater in which order you do that?)
You can take the image output of one technique and use it as the input to
the next. If you push some of the techniques beyond their logical bounds
(for example, take a very large mixing factor for sharpness) you may get
some images that could effectively be taken into another technique (for
example, grayscale). See what you can do!
The next two exercises consider other examples of image warping, simi-
lar to the example shown in Figure 11.16. Like that example, these come
from [6, Chapter 16].
10. The ripple transformation displaces pixels in waves in both the x - and
y -directions. This transformation has four parameters: the period lengths
τ x , 0 (in pixels) and the wave magnitudes a x , a y (in pixels) in both
directions:
(
)
(
)
= +
xxa
sin2 πτ and yya
y
= +
sin2 πτ.
Create a shader that implements the ripple transformation, and apply
it to both a grid image and a natural image. In [4] an example uses the
parameters (in pixels) τ x = 120, τ y = 250, a x = 10, and a y = 15, so you might
use these.
11. The spherical transformation simulates viewing the image through a
hemispherical lens. If we assume that the lens is centered on the image,
the parameters of this transformation are the radius of the lens r max and its
refraction index η. The functions that implement this transformation are
x
x
x
y
y
xx z
tan(
β
)
for
for
for
r r
rr
>
=
x
max
0
max
yy z
tan(
β
)
r
r
=
y
max
0
for rr
>
max
Search WWH ::




Custom Search