Image Filtering, Enhancement, and Restoration
47
While in discrete images, theoretically speaking, one can never get a pure uniform
probability density function for the transformed image, there are a number of functions
(satisfying the conditions described earlier) that provide histograms for the transformed
image that are much more uniformly spread compared to the original image. Here,
instead of describing the details of these transformations, we focus on using MATLAB
for histogram equalization.
Example 3.3
In this example, we explore using MATLAB for histogram equalization. In MATLAB,
the command “histeq” performs histogram equalization. Command “imhist”
displays histogram of the image. We use command “imhist” to show the
histograms of the image before and after equalization. The MATLAB code for this
process is as follows:
I=imread(‘7.jpg’);

I=rgb2gray(I);

J=histeq(I)

Imshow(I),

figure

Imshow(J)

figure,

Imhist(I,64)

figure,

Imhist(J,64)

Figure 3.8 shows the image and its histogram before and after histogram equalization.
As can be seen, the quality of the image has improved in the processed image.
3.3 MASK PROCESSING: LINEAR FILTERING IN SPACE DOMAIN
It is often the case that instead of linear processing of images using filters described
in frequency domain, space-domain linear filters are used in typical image processing applications. This is mainly to the fact that frequency-domain description of
two-dimensional (2-D) filters is often more complex than the one-dimensional (1-D)
filters. In principle, space-domain linear filters approximate the impulse response of
various kinds of typical frequency-domain filters with a 2-D mask. In spatial filtering, as described before, a weight mask is used to express the effect of the filter on
each pixel of the image in an insightful fashion. A typical mask has been shown in
Figure 3.9. In this section, we introduce some of the most popular mask filters that
are applied in space domain.
The pixel value for the pixel (x, y) in the processed image, g(x, y), is computed as
a sum of products of the filter coefficients and the original image f, i.e.,
a
b
g x y =
w s t f x + s y t
, +
( , )
( , ) (
)
(3.4)
∑∑
s=−a t =−b
Précédent

- 74/412

Suivant