Debian Codegraph @

upstream/debian-unstable/man5/extendedopacity.5

raw
1 \
2 .\" This man page was generated by the Netpbm tool 'makeman' from HTML source.
3 .\" Do not hand-hack it! If you have bug fixes or improvements, please find
4 .\" the corresponding HTML page on the Netpbm website, generate a patch
5 .\" against that, and send it to the Netpbm maintainer.
6 .TH "Image Processing By Interp and Extrapolation" 5 "" "netpbm documentation"
7
8 Created: 17 April 2003
9 .SH NAME
10 extendedopacity - theory of netpbm interpolation and extrapolation
11 .SH DESCRIPTION
12 .PP
13 This page is a copy of http://www.sgi.com/misc/grafica/interp/ on
14 April 17, 2003, with some slight formatting changes, included in the
15 Netpbm documentation for convenience. Since at least June 11, 2005,
16 the source page has been missing.
17
18 .SH Image Processing By Interpolation and Extrapolation
19 \fIPaul Haeberli and Douglas Voorhies\fP
20
21 .SS Introduction
22 .PP
23 Interpolation and extrapolation between two images offers a general,
24 unifying approach to many common point and area image
25 processing operations. Brightness, contrast, saturation, tint, and
26 sharpness can all be controlled with one formula, separately or
27 simultaneously. In several cases, there are also performance benefits.
28 .PP
29 Linear interpolation is often used to blend two images.
30 Blend fractions (alpha) and (1 - alpha) are used in a weighted average
31 of each component of each pixel:
32
33 .nf
34 out = (1 - alpha)*in0 + alpha*in1
35
36 .fi
37 .PP
38 Typically alpha is a number in the range 0.0 to 1.0. This is
39 commonly used to linearly interpolate two images.
40 What is less often considered is that alpha may range beyond the
41 interval 0.0 to 1.0.
42 Values above one subtract a portion of in0 while scaling in1. Values
43 below 0.0 have the opposite effect.
44 .PP
45 Extrapolation is particularly useful if a degenerate version of the
46 image is used as the image to get "away from." Extrapolating away from
47 a black-and-white image increases saturation. Extrapolating away from a
48 blurred image increases sharpness. The interpolation/extrapolation
49 formula offers one-parameter control, making display of a series of
50 images, each differing in brightness, contrast, sharpness, color, or
51 saturation, particularly easy to compute, and inviting hardware acceleration.
52 .PP
53 In the following examples, a single alpha value is used per image.
54 However other processing is possible, for example where alpha is a function
55 of X and Y, or where a brush footprint controls alpha near the cursor.
56
57 .SS Changing Brightness
58 .PP
59 To control image brightness, we use pure black as the degenerate (zero
60 alpha) image. Interpolation darkens the image, and extrapolation
61 brightens it. In both cases, brighter pixels are affected more.
62
63 .B brightness
64 .IMG -C blend1.gif
65
66 .SS Changing Contrast
67 .PP
68 Contrast can be controlled using a constant gray image with the average image
69 luminance. Interpolation reduces contrast and extrapolation boosts it.
70 Negative alpha generates inverted images with varying contrast. In
71 all cases, the average image luminance is constant.
72
73 .B contrast
74 .IMG -C blend3.gif
75 .PP
76 If middle gray or the average pixel color is used instead, contrast is
77 again altered, but with middle gray or the average color left unaffected.
78 Shades and colors far away from the chosen value are most affected.
79
80 .SS Changing Saturation
81 .PP
82 To alter saturation, pixel components must move towards or away from the
83 pixel's luminance value. By using a black-and-white image as the
84 degenerate version, saturation can be decreased using interpolation, and
85 increased using extrapolation. This avoids computationally more
86 expensive conversions to and from HSV space. Repeated update in
87 an interactive application is especially fast, since the luminance
88 of each pixel need not be recomputed. Negative alpha preserves luminance
89 but inverts the hue of the input image.
90
91 .B saturation
92 .IMG -C blend4.gif
93
94 .SS Sharpening an Image
95 .PP
96 Any convolution, such as sharpening or blurring, can be adjusted by
97 this approach.
98 If a blurred image is used as the degenerate image,
99 interpolation attenuates high frequencies to varying degrees, and
100 extrapolation boosts them, sharpening the image by unsharp masking.
101 Varying alpha acts as a kernel scale factor, so a series of
102 convolutions differing only in scale can be done easily, independent of
103 the size of the kernel. Since blurring, unlike sharpening, is often a
104 separable operation, sharpening by extrapolation may be far more
105 efficient for large kernels.
106
107 .B sharpening
108 .IMG -C blend6.gif
109 .PP
110 Note that global contrast control, local contrast control, and
111 sharpening form a continuum.
112 Global contrast pushes pixel components
113 towards or away from the average image luminance. Local contrast is
114 similar, but uses local area luminance. Unsharp masking is the extreme
115 case, using only the color of nearby pixels.
116
117 .SS Combined Processing
118 .PP
119 An unusual property of this interpolation/extrapolation approach is that
120 all of these image parameters may be altered simultaneously. Here
121 sharpness, tint, and saturation are all altered.
122
123 .B combined
124 .IMG -C blend7.gif
125
126 .SS Conclusion
127 .PP
128 Image applications frequently need to produce multiple degrees of
129 manipulation interactively.
130 Image applications frequently need to interactively manipulate
131 an image by continuously changing a single parameter.
132 The best hardware mechanisms employ a
133 single "inner loop" to achieve a wide variety of effects. Interpolation
134 and extrapolation of images can be a unifying approach, providing a single
135 function that can do many common image processing operations.
136 .PP
137 Since a degenerate image is sometimes easier to calculate, extrapolation
138 may offer a more efficient method to achieve effects such as sharpening
139 or saturation. Blending is a linear operation, and so it must be
140 performed in linear, not gamma-warped space. Component range must also be
141 monitored, since clamping, especially of the degenerate image, causes
142 inaccuracy.
143 .PP
144 These image manipulation techniques can be used in paint programs to
145 easily implement brushes that saturate, sharpen, lighten, darken,
146 or modify contrast and color. The only major change needed is to work with
147 alpha values outside the range 0.0 to 1.0.
148 .PP
149 It is surprising and unfortunate how many graphics software packages
150 needlessly limit interpolant values to the range 0.0 to 1.0. Application
151 developers should allow users to extrapolate parameters when practical.
152 .SS References
153 .PP
154 For a slightly extended version of this article, see:
155 P. Haeberli and D. Voorhies. \fIImage Processing by Linear
156 Interpolation and Extrapolation\fP.
157 IRIS Universe Magazine No. 28, Silicon Graphics, Aug, 1994.
158 .PP
159 .B
160 .IMG -C gobot.gif
161 .SH DOCUMENT SOURCE
162 This manual page was generated by the Netpbm tool 'makeman' from HTML
163 source. The master documentation is at
164 .IP
165 .B http://netpbm.sourceforge.net/doc/extendedopacity.html
166 .PP