Graphics Reference
In-Depth Information
Figure 11.23. Saturation manipulation of the supermarket fruit image with uT = 0.0 (left), 1.0 (middle), and
2.0 (right).
out vec4 fFragColor;
void main( )
{
vec3 irgb = texture( uImageUnit, vST ).rgb;
float luminance = dot( irgb, W );
vec3 target = vec3( luminance, luminance, luminance );
fFragColor = vec4( mix( target, irgb, uT ), 1. );
}
Sharpness
We think of sharpness as the degree of clarity in both coarse and fine image
detail in an image. Alternately, you could think of sharpness as the opposite
of blurred. Manipulating the sharpness of the image takes advantage of this
fact by creating an extrapolation from a blurred version of the image through
the image itself. The blurred image is created by the blurring process dis-
cussed earlier in the chapter. An example of sharpening an image is shown
in Figure 11.24; the left and middle images are larger versions of those of
Figure 11.5.
A fragment shader to manipulate sharpness would contain code some-
thing like the following. The code uses the same filter and computation
described in the image blur example earlier in the chapter, except that it ends
by mixing the blurred image (“target”) and the original image (“irgb”). The
shader iles are included in the materials with this topic.
...
fFragColor = vec4( mix( target, irgb, uT ), 1. );
Search WWH ::




Custom Search