0% found this document useful (0 votes)
16 views

chapter-1

Uploaded by

abrahymysry269
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

chapter-1

Uploaded by

abrahymysry269
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 35

Introduction to

Chapter-1 Image Processing


What is an Image?
An image can be thought of as a function with resulting values of the light intensity at
each point over a planar region.
Imaging System is as
▪ 2‐dimensional matrix of Intensity
(gray or color) values
▪ Digital image: discrete samples f
[x,y] representing continuous
image f (x,y) . Each element of
the 2-d array f [x,y] is called a
pixel
Digital Image?

Digitization causes a digital


image to become an
approximation of a real scene
Representing Images

▪ Image structure is 2D array of pixel


values
▪ Pixel values are gray levels in range
0‐255 or RGB colors
▪ Array values can be any data type
(bit, byte, int, float, double, etc.)
Image File Formats

Hundreds of image file formats. Examples


Tagged Image File Format (TIFF)
Graphics Interchange Format (GIF)
Portable Network Graphics (PNG)
JPEG, BMP, Portable Bitmap Format (PBM), etc
Image pixel values can be
Grayscale: 0 – 255 range
Binary: 0 or 1
Color: RGB colors in 0‐255 range (or other color model)
Application specific (e.g. floating point values in astronomy)
Colour Image
Contrast Stretching

❑Low contrast images occur often due to poor


or non uniform lighting conditions, or due to
nonlinearity, or small dynamic range of the
imaging sensor.
❑Purpose of contrast stretching is to process
such images so that the dynamic range of the
image will be very high, so that different
details in the objects present in the image will
be clearly visible.
❑ Contrast stretching process expands
dynamic range of intensity levels in an image
so that it spans the full intensity range of the
recording medium or display devices
Image Histograms

The histogram of an image shows us the distribution of grey levels in the


image. Massively useful in image processing, especially in segmentation.
Frequencies

Grey Levels
Image Histograms

Histograms plots how many times (frequency) each


intensity value in image occurs
Histogram Examples (cont…)

A selection of images and


their histograms
Notice the relationships
between the images and
their histograms
Note that the high contrast
image has the most
evenly spaced histogram
Image Histograms
• Different images can have same histogram
• 3 images below have same histogram

• Half of pixels are gray, half are white


- Same histogram = same statistics
- Distribution of intensities could be different
• Can we reconstruct image from histogram?
Histogram Equalization

Spreading out the frequencies in an image The formula for histogram


(or equalising the image) is a simple way to equalisation is given where
improve dark or washed-out images rk: input intensity
sk: processed intensity
Can be expressed as a transformation of his k: the intensity range
togram (e.g 0.0 – 1.0)
Where: nj: the frequency of intensity j
• rk: input intensity n: the sum of all frequencies
= T ( rk )
• sk: processed intensity sk
k

• k: the intensity range = 


j =1
pr ( r j )

(e.g 0.0 – 1.0) = 


k nj
j =1 n
Histogram equalization based on a histogram obtained from a portion of the image

Limit contrast expansion in flat regions of the image,


e.g., by clipping histogram values.
(“Contrast-limited adaptive histogram equalization”)
Histogram Modification

❑Histogram modification performs a function similar to gray level mapping,


but works by considering histogram’s shape and spread
❑Gray level histogram of an image is the distribution of the gray levels in an
image
❑Examination of the histogram is one of the most useful tools for image
enhancement, as it makes easy to see the modifications that may improve an
image
❑The histogram can be modified by a mapping function, which will stretch,
shrink (compress), or slide the histogram
❑Histogram stretching and histogram shrinking are forms of gray scale
modification, sometimes referred to as histogram scaling
Histogram stretch
The mapping function equation is as follows:

where: I(r,c)MAX is the largest gray level value in the image I(r,c), I(r,c)MIN is the
smallest gray level value in I(r,c) and
❑MAX and MIN correspond to the maximum and minimum gray level values
possible (for an 8-bit image these are 0 and 255)
❑This equation will take an image and stretch the histogram across the entire gray
level range, which has the effect of increasing the contrast of a low contrast image
❑If most of the pixel values in an image fall within a small range, it is useful to
allow a small percentage of the pixel values to be clipped at the low and high end
of the range (for an 8-bit image this means truncating at 0 and 255)
Histogram Stretching

d) Histogram of image after stretch


c) Image (a) after histogram stretch
a) Low-contrast image b) Histogram of image (a)
Histogram Stretching
• Contrast can be increased using:
1. Histogram stretching
2. Histogram equalization

• Contrast is the difference between maximum and minimum pixel


intensity. Contrast = 225.
Contrast
The contrast of the image can be defined as the difference between
maximum pixel intensity and minimum pixel intensity.

• Max. int. = 0, Min. int. =0


• Contrast = 0–0=0

• Max. int. = 100, Min. int. =100


• Contrast = 100–100=0
Increasing the contrast

f(x,y) g(x,y)

Low contrast image High contrast image


Contrast stretching

• This formula doesn’t work always. If there is 1 pixel with


intensity 255:

Contrast stretching has


no effect!!!
Contrast stretching

Before
Contrast = 225

After
Contrast = 240
Histogram shrink

The mapping function equation is as follows:

where I(r,c)MAX is the largest gray level value in the image I(r,c), I(r,c)MIN is the smallest gray
level value in I(r,c) and
❑ShrinkMAX and ShrinkMIN correspond to the maximum and minimum desired in the
compressed histogram
❑Decreases image contrast by compressing the gray levels
❑However this method may not be useful as an image enhancement tool, but it is used in an
image sharpening algorithm (unsharp masking) as a part of an enhancement technique
Histogram Shrinking

b) Histogram of image
a) Original image

c) Image after shrinking the histogram


d) Histogram of image (c)
to the range [75,175]
Histogram slide
• Used to make an image either darker or lighter, but retain the relationship
between gray level values
• Accomplished by simply adding or subtracting a fixed number from all of the
gray level values, as follows:

where the OFFSET value is the amount to slide the histogram


❑In this equation we assume that any values slid past the minimum and
maximum values will be clipped to the respective minimum or maximum
❑A positive OFFSET value will increase the overall brightness, while a
negative OFFSET will create a darker image
Histogram Slide

a) Resultant image from sliding the b) Histogram of image (a)


histogram down by 50

c) Resultant image from sliding the


d) Histogram of image (c)
histogram up by 50
Histogram sliding
• Brightness is changed by shifting the histogram to left or right.

+50
Histogram sliding

- 30
Brightness

Brightness is a relative term. It can


be defined as the amount of energy
output by a source of light relative
to the source we are comparing to.

Image on the right is brighter than image on the left.


Image transformations
• Transformation is a function. It maps one set to
another set after performing some operations.

Digital Image Processing system performs the transformation.


Image transformation

• Consider the equation


g(x,y)=T(f(x,y))
f(x,y) – input image, transformation is applied to this image.
g(x,y) – output image (processed image).
T is a transformation function.
Image transformation

The transformation can be also represented as


s=T(r)
r – pixel value of the input image f(x,y)
s – pixel value of the output image g(x,y)
Image transformation
Original
image
Negative transformation

Original Negative
s = (L – 1) – r

You might also like