0% found this document useful (0 votes)
30 views10 pages

Lec - 08 SIP CIS-322 Im Enhan

l;,./

Uploaded by

Farah Jahangir
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views10 pages

Lec - 08 SIP CIS-322 Im Enhan

l;,./

Uploaded by

Farah Jahangir
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

12/10/2024

Image Enhancement
Image enhancement is to process an image so that the
result is more suitable than the original image for a
Lecture No. 8 Specific application.

Image Enhancement Image enhancement is therefore, very much dependent


on the particular problem/image at hand.
For example a method that is quit useful for enhancing
X-ray images may not necessary be the best approach
for enhancing pictures of Mars `

CIS-322

Image Enhancement Techniques


Image enhancement can be done in either:

Spatial domain: operation on the original image Point Mask Transform Coloring
operation operation operation operation
Image Negative Smoothing Low pass
False
Contrast operations filtering
coloring
g ( x, y)  T [ f ( x, y)] Stretching
Compression of
Median
Filtering
High pass
Full color
Filtering
dynamic range Sharpening processing
Band pass
Gray level slicing operations
filtering
Frequency domain: operation on the DFT of the Image Subtraction Derivative
Homomorphic
original image Image Averaging operations
filtering
Histogram Histogram
operations operations Histogram
operations

Spatial Domain Process s = T(r)


g( x,y ) = T[f( x,y )]

1
12/10/2024

Image Negatives
They are obtained by using the transformation function
s=T(r).

L : maximum gray value


T (r )  L  1  r

Some Basic Gray Level Transformation


T (r )  L  1  r

Used mainly in medical images and to produce slides of the screen.

Example:
Log transformations
Compression of Dynamic Range

When the dynamic range of the input gray values is large


compared to that of the display, we need to “compress” the
gray values range, ---example: Fourier transform magnitude
(range 0 to 1.5x106).

Typically we use a log scale.

s=T(r)= c log(1+r)

Example:

Original Fourier spectrum Result of log


transformation, c=0.1

2
12/10/2024

Power-Law transformations Power-Law Trans(con’t)

s  cr 

Power-Law Trans(con’t) Power-Law Trans(con’t)

Piecewise-Linear Trans-Functions Piecewise-Linear Trans-Functions (cont.)

 Contrast Stretching Transformation is Typical Transformation used for contrast stretching


simplest piecewise linear functions
 Low contrast images result from:
1. Poor illumination
2. Lack of dynamic range in the imaging
The locations of points (r1,s1) and (r2,s2) control the shape
sensor
of the transformation function.
3. Wrong setting of lens aperture during image
acquisition

3
12/10/2024

Piecewise-Linear Trans-Functions (cont.) Piecewise-Linear Trans-Functions (cont.)

 Intermediate values of (r1, s1) and (r2, s2)


produce various degrees of spread in the
gray levels of the output image, thus
affecting its contrast.
 In general, r1 ≤ r2 and s1 ≤ s2 is assumed so
If r1 = s1 and r2 = s2 the transformation is a linear function that
that the function is single valued and
produces no changes in gray levels. monotonically increasing.
If r1 = r2, s1 = 0 and s2 = L – 1 the transformation becomes a
thresholding function that crates a binary image.

Piecewise-Linear Trans-Functions Piecewise-Linear T-F(con’t)

 Gray-level slicing
 Applications:
1. Enhancing features such as masses of
waters in satellite imagery.
2. Enhancing flaws in X-ray images.

(rmin,0)
(rmax,L-1)
r1 = r2 = m
thresholding

Piecewise-Linear T-F(con’t) Piecewise-Linear T-F(con’t)

 Gray-level slicing  Bit-plane slicing

4
12/10/2024

Piecewise-Linear T-F(con’t) Piecewise-Linear T-F(con’t)

Histogram Processing Histogram Processing (con’t)


The histogram of a digital image with gray levels in the range [0, L-1] is a discrete function

h ( rk )  nk , Dark

Where rk is the kth gray level, nk is the number


of pixels in the image having gray level rk Bright

nk
p ( rk ) 
n Low-contrast
Gives an estimate of the probability of
occurrence of gray level rk
High-contrast

Histogram Equalization(con’t) 3.3.1 Histogram Equalization(con’t)

5
12/10/2024

3.3.2 Histogram Matching 3.3.2 Histogram Matching(con’t)


• Histogram matching (also known as histogram
specification) is a technique used in image processing to
adjust the contrast and brightness of an image by
transforming its histogram to match the histogram of
another reference image.
• The goal is to make the pixel intensity distribution of the
input image similar to that of a target image, often for the
purpose of image normalization, improving visual
consistency, or matching a specific desired appearance.

3.3.2 Histogram Matching(con’t) 3.3.2 Histogram Matching(con’t)

Point Operation Example: Convert a uint8 image into double one


What is point operation in image enhancement?
Output pixel value g(x,y) at pixel (x,y) depends only on the input
pixel value at f(x,y) at (x,y) (and not on the neighboring pixel
values).
We normally write s=T(r), where s is the output pixel value and
r is the input pixel value.

x is a uint8 array, with gray values in [0,255].

T is any increasing y is a double array, with gray values in [0,1] (obtained by


function that maps linear scaling).
[0,1] into [0,1].

6
12/10/2024

A special case: thresholding or binarization


Contrast Stretching
Increase the dynamic range of gray values in the input image. r1 = r2 =m ; s1 =0 and s2 =1

Suppose you are interested in stretching the input intensity


values in the interval [r1 , r2 ]:

Useful when we are interested in the shape of the objects.

Note that (r1 - r2 )<(s1 - s2 ). The gray values in the rang [r1 , r2 ]
is stretched into the rang[s1 , s2 ].

Example: Gamma Correlation  0 r < r1


 g
 r  r1 
s1 =0 and s2 =1 T ( r )    , r1  r  r2
 r2  r1 
 1 r > r2

Original blood cell binary blood cell

Output image is “darker” Output image is “brighter”

Example:
Gray Level Slicing
J = IMADJUST(I,[LOW_IN HIGH_IN],[LOW_OUT HIGH_OUT],GAMMA)
• Highlight a specific ranges of gray level

One way is to display a high


value for all gray levels in
the range of interest and a
low value for all other gray
levels (binary image).
original Gamma<1 Gamma>1
Without background

7
12/10/2024

The second approach is to


brighten the desired range of
gray levels but preserve the
background and gray-level
tonalities in the image:

With background

Bit-Plane Slicing
• More on bit planes:
• To highlight the contribution made to the total
image appearance by specific bits. –Only the higher order bits (top four) contain visually
significant data. The other bit planes contribute the more
–i.e. Assuming that each pixel is represented subtle details.
by 8 bits, the image is composed of 8 1-bit
planes.
–Plane 7 corresponds exactly with an image
thresholded at gray level 128.
–Plane 0 contains the least significant bit and
plane 7 contains the most significant bit.

Example: display different bits as an


individual image
original

Bit 7

Bit 6

8
12/10/2024

Image Subtraction Image Erosion


In this case, the difference between two “similar” images is
computed to highlight or enhance the differences between them: •A fundamental operation in image processing,
g(m,n) =f1 (m,n) – f2 (m,n) particularly in the field of morphological image
processing.
It has applications in image segmentation and enhancement.
•It involves shrinking or eroding the boundaries of the
white (foreground) regions in a binary image, typically
making objects in the image smaller.

•Erosion is often paired with dilation, which is the


opposite process—where objects grow instead of shrink.

Image Erosion Image Erosion


How Erosion Works
Key Concepts
•Erosion involves placing the structuring element at each
•Binary Image: The image consists of two pixel values, pixel in the image and checking if the element fits
usually 0 (background) and 1 (foreground). entirely within the foreground (1s).

•Structuring Element: This is a small shape or template •If all pixels in the structuring element correspond to
that moves through the image. foreground pixels (1s), the pixel in the center of the
structuring element is retained as a foreground pixel;
otherwise, it's set to the background (0).
•Common structuring elements include squares, circles,
and crosses.

Image Erosion Image Erosion


Result Applications of Erosion

•The operation "erodes" the foreground, causing objects •Noise Removal: Helps to remove small noise points or
in the image to shrink or reduce in size. details.

•If an object is touching the edge of the image, the •Object Detection: Erosion can be used as part of object
erosion will cause it to shrink inward. extraction, making large objects smaller or removing
small, irrelevant objects.
•Small details (such as noise or small objects) can be
removed. •Shape Simplification: Erosion can simplify the shapes of
objects for further analysis.

9
12/10/2024

Image Erosion Example: segmentation


original
Example

•Consider a binary image where 1 represents the


foreground (white pixels) and 0 represents the
background (black pixels). After
processing

•If a square 3x3 structuring element is used, each pixel in


the image is checked with this square. If at least one
pixel in the square overlaps a background pixel, the
center pixel is set to the background (0).
Subtraction
result

Image Averaging for Noise Reduction The noise N(m,n) at each pixel (m,n) is modeled as a random
variable.
Noise is any random phenomenon that contaminates an image. Usually, N(m,n) has Zero-mean and the noise values at
different pixels are uncorrelated.
Noise is inherent in most practical system:
Image acquisition Suppose we have M observations {gi(m,n)}, i=1,2,…,M, we can
Image transmission (partially) mitigate the effect of noise by “averaging”
M
1
Image recording g (m, n) 
M
 g (m, n)
i
i 1

Noise is typically modeled as an additive process In this case, we can show that
g (m, n)  f (m, n)  N (m, n) 1
E[ g ( m, n)]  f ( m, n) Var [ g ( m, n )]  Var [ N ( m, n )]
M
Noisy image Noise free Noise
image Therefore, as the number on observations increases (Minfinite),
the effect of noise trends to zero.

Example:
Original

M=1

M=10

10

You might also like