Image Processing Reference
In-Depth Information
The graphic representation for transformation in Equations (1a) - (1c) is represented in Fig-
ure 1 (blue plot). In the same figure, the identity function it is also drawn (green plot) to spot
how pixel component values increase or decrease according to the transformation. If the value
of the pixel component is less than zero, it is set to zero and if it is greater than 255, it is set to
255.
FIGURE 1 Contrast filter transformation (function f).
So far, the same transformation is being applied to all components of each pixel. Thus, this is
how Contrast filter performs; however, the property is also specific to many other filters (e.g.,
Invert, Color).
2.1.1 Description of the optimized implementation of contrast image filter
using “color matrix” technique
Figure 2 presents an example of how “color matrix” optimization technique performs on one
pixel having the, e.g., Red component equal to 51 and scaled down to 0.2 (= 51/255). The input
vector represents the original pixel with its components Red, Green, Blue, and Alpha in this
order [ 4 , 5 ] . The values of the components vary in a range from 0 (= 0/255) to 1 (= 255/255). The
last element of the input vector is used for additional computations, if needed. After the cal-
culation of the output array, the values are scaled again to the fit into the interval [0;255].
FIGURE 2 ColorMatrix example of multiplication for one pixel.
The matrix content is specific to each filter separately and exemplified in Figure 3 for Con-
trast image filter. dif is obtained as in Equation (2) by refactoring Equations (1a) - (1c) , and scale
is the desired degree of Contrast (usually varies from 1 to 6). The fact that diff is computed
only once for all pixels in the image before the filter is actually applied to the image saves a
great amount of execution time spent per pixel, compared to the standard version of contrast
that uses the transformation in Equations (1a) - (1c) . To be more specific, this optimization tech-
nique implies successive divisions (for scaling all pixels values to the range [0;1]) and multi-
plications (for scaling all pixels values back to range [0;255]) which can be performed in par-
allel on several floating-point units provided by the underlying hardware architecture, which
considerably decreases the execution time (Contrast image filter was speedup 8 times on HD
images):

Search WWH ::

Custom Search