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

Dip Module - 5 Color Image Processing

This document discusses Module 5 which covers morphological image processing and color image processing. It begins with preliminaries on morphological operations like erosion, dilation, opening and closing. It then covers color fundamentals, color models, and pseudo color image processing. The key stages of morphological processing are described including structuring elements, erosion, dilation, opening, closing and the hit-or-miss transformation. Color attributes like luminance, radiance and brightness are defined. Primary colors of red, green and blue are described along with secondary colors formed by combining primary colors.

Uploaded by

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

Dip Module - 5 Color Image Processing

This document discusses Module 5 which covers morphological image processing and color image processing. It begins with preliminaries on morphological operations like erosion, dilation, opening and closing. It then covers color fundamentals, color models, and pseudo color image processing. The key stages of morphological processing are described including structuring elements, erosion, dilation, opening, closing and the hit-or-miss transformation. Color attributes like luminance, radiance and brightness are defined. Primary colors of red, green and blue are described along with secondary colors formed by combining primary colors.

Uploaded by

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

Module 5:

Morphological Image Processing &


Color Image Processing
By

Dr. Chandrappa D N
Professor & Head
Dept of ECE, SJBIT

1
 Module 5: Morphological Image Processing &
Color Image Processing

• Preliminaries
Erosion
Dilation
Opening and Closing
• Color Fundamentals
• Color models
• Pseudo color image processing

2
Preliminaries

◦ “Morphology “ – a branch in biology that deals with the form and structure of
animals and plants.
◦ “Mathematical Morphology” – as a tool for extracting image components, that are
useful in the representation and description of region shape.
◦ The language of mathematical morphology is – Set theory.
◦ Unified and powerful approach to numerous image processing problems.
◦ In binary images , the set elements are members of the 2-D integer space – Z 2.
◦ where each element (x,y) is a coordinate of a black (or white) pixel in the image.
Preliminaries
◦ Morphological operations are simple to use and works on the basis of set theory.
◦ The objective of using morphological operations is to remove the imperfections in
the structure of image.
◦ Most of the operations used here are combination of two processes, dilation and
erosion.
◦ The operation uses a small matrix structure called as structuring element. The shape
and size of the structuring element has significant impact on the final result.
◦ Matlab software is used as the tool for experimenting the morphological operations.
Cont..
Terminologies in Morphological Image Processing
All morphological processing operations are based on mentioned terms.
Structuring Element: It is a matrix or a small-sized template that is used to traverse
an image. The structuring element is positioned at all possible locations in the image,
and it is compared with the connected pixels. It can be of any shape.
Fit: When all the pixels in the structuring element cover the pixels of the object, we
call it Fit.
Hit: When at least one of the pixels in the structuring element cover the pixels of the
object, we call it Hit.
Miss: When no pixel in the structuring element cover the pixels of the object, we call
it miss.
Key Stages in Digital Image Processing:
Morphological Processing
Morphology
Morphological Image Processing (or morphology) describes a range of image
processing techniques that deal with the shape (or morphology) of features in an
image
Morphological operations are typically applied to remove imperfections
introduced during segmentation.
Key Stages in Digital Image Processing:
Morphological Processing

Fundamentally morphological image processing is very like spatial filtering


The structuring element is moved across every pixel in the original image to give
a pixel in a new processed image
The value of this new pixel depends on the operation performed
There are two basic morphological operations: erosion and dilation
Key Stages in Digital Image Processing:
Morphological Processing
Original Image Processed Image

Structuring Element
Key Stages in Digital Image Processing:
Morphological Processing
Original Image Processed Image

Structuring Element
Key Stages in Digital Image Processing:
Morphological Processing

Image after segmentation Image after segmentation and


morphological processing
Basic Concepts in Set Theory

Subset

Union

Intersection

sjoint / mutually exclusive

Complement

Difference

Reflection

Translation
Logic Operations Involving Binary Pixels
and Images
The principal logic operations used in image processing
are: AND, OR, NOT (COMPLEMENT).
These operations are functionally complete.
Logic operations are preformed on a pixel by pixel basis between corresponding
pixels (bitwise).
Other important logic operations :
XOR (exclusive OR), NAND (NOT-AND)
Logic operations are just a private case for a binary set operations, such : AND –
Intersection , OR – Union,
NOT-Complement.
Dilation
◦ Dilation is used for expanding an element A by using structuring
element B
Dilation of A by B and is defined by the following equation:

This equation is based 0n obtaining the reflection 0f B


about its origin and shifting this reflection by z.
The dilation of A by B is the set of all displacements z,
such that and A overlap by at least one element. Based
On this interpretation the equation of (9.2-1) can be
rewritten as:
Dilation – Example 1
Dilation – Example 2
Dilation – A More interesting
Example
Erosion
◦ Erosion is used for shrinking of element A by using
element B
Erosion for Sets A and B in Z2, is defined by the
following equation:

This equation indicates that the erosion of A by B is the set of all points z such
that B, translated by z, is combined in A.
Erosion – Example 1
Erosion – Example 2
Duality between dilation and erosion
Dilation and erosion are duals of each other with respect to set
complementation and reflection. That is,

One of the simplest uses of erosion is for eliminating irrelevant details (in
terms of size) from a binary image.
Erosion and Dilation summary
Opening And Closing
Opening –
◦ First – erode A by B, and then dilate the result by B
◦ In other words, opening is the unification of all B objects Entirely Contained in A

Find contour Fill in contour


Opening And Closing
Closing –
◦ First – dilate A by B, and then erode the result by B
◦ In other words, closing is the group of points, which the intersection of object B
around them with object A – is not empty

Find contour Fill in contour


Use of opening and closing for morphological filtering
The Hit-or-Miss Transformation
A basic morphological tool for shape detection.
Let the origin of each shape be located at its center of gravity.
If we want to find the location of a shape , say – X ,
at (larger) image, say – A :
◦ Let X be enclosed by a small window, say – W.
◦ The local background of X with respect to W is defined as the set difference (W - X).
◦ Apply erosion operator of A by X, will get us the set of locations of the origin of X,
such that X is completely contained in A.
◦ It may be also view geometrically as the set of all locations of the origin of X at
which X found a match (hit) in A.
The Hit-or-Miss
Transformation
Cont.
◦ Apply erosion operator on the complement of A by the local background set (W – X).
◦ Notice, that the set of locations for which X exactly fits inside A is the intersection of these two last
operators above.
This intersection is precisely the location sought.
Formally:
If B denotes the set composed of X and it’s background –
B = (B1,B2) ; B1 = X , B2 = (W-X).
The match (or set of matches) of B in A, denoted is:
Hit-or-Miss exp:
The Hit-or-Miss Transformation
◦ The reason for using these kind of structuring element – B = (B1,B2) is based on
an assumed definition that,
two or more objects are distinct only if they are disjoint (disconnected) sets.
◦ In some applications , we may interested in detecting certain patterns
(combinations) of 1’s and 0’s. and not for detecting individual
objects.
◦ In this case a background is not required.
and the hit-or-miss transform reduces to simple erosion.
◦ This simplified pattern detection scheme is used in some of the algorithms for –
identifying characters within a text.
Why color image processing?

Color simplifies object identification and extraction from


scene.

Thousands of color shades can be discerned by human eye


whereas only few gray levels shades can be discerned.

32
Categories of Color Image Processing

Full Color Processing :- Images acquired with full color


sensor like color TV , camera or color scanner.

Pseudo color Processing:- Assign color to particular


monochrome intensity or range of intensities.

33
Color Fundamentals
Sir Isaac Newton discovered that white light when passes
through prism, breaks into seven colors VIBGYOR while each
color smoothly blends into other.
Color is perceived as the wavelength reflected back from object .
When the object reflects all seven colors in equal proportion it
appears white.
When an object reflects wavelength corresponding to green color
and absorbs all other wavelengths it will appear green.
When an object does not reflect at all i.e. absorbs all wavelengths
it appears black.

34
Color Spectrum

35
Electromagnetic Spectrum

36
Attributes of Light

Monochromatic Light:- Only one attribute which is


intensity.

Color Light:- Three attributes:


Radiance, Luminance and Brightness

37
Primary and Secondary Colors
In human eye cones and sensors are responsible for color vision.
There are 6 to 7 million cones in human eye which can be divided
into 3 categories red, green and blue.
65% are sensitive to red
35% are sensitive to green
2% are sensitive to blue.
Due to these absorption characteristics colors are seen as
combinations of 3 primary colors i.e. RED, BLUE, GREEN.

38
No single color can be called as RED, BLUE or GREEN since colors
blend with each other. Therefore, for Standardization CIE
designated 3 primary colors the following frequencies.
Blue = 435.8nm
Green= 546.1nm
Red = 700nm
Primary colors add to form secondary colors.
Magenta = Red + Blue
Cyan = Green + Blue
Yellow = Red + Green

39
40
Characteristics of Color

Hue :- Dominant wavelength in mixture of light waves.


Dominant color perceived by observer.
Saturation:- Relative purity or amount of white light mixed
with hue.
Brightness:- chromatic notion of intensity.

Pure spectrum colors are fully saturated. Colors such as pink


(Red + white), lavender (violet + white) are less saturated.
CHROMATICITY:- Hue and saturation taken together.

41
TRISMULUS VALUES

Amount of red, blue or green needed to form a color are


called trismulus values represented by X, Y, Z respectively.
The color is defined as:-
x= X/ X+Y+Z
y= Y/X+Y+Z
z= Z/X+Y+Z
x +y +z=1
X:- amount of red required for color
Y:- amount of green required for color
Z:- amount of blue required for color.

42
CIE Chromaticity Diagram
The various colors VIBGYOR are around tongue shape
chromaticity diagram.
These are pure colors.
Other points in diagram represents mixture of colors.
All points on boundaries are fully saturated.
As point leaves boundary and approaches point of equal energy,
it becomes less saturated.
Saturation at point of equal energy (WHITE) is zero.
Straight line joining any two colors on the chromaticity diagram
represents colors which can be formed by mixing two colors.

43
GREEN
COLORS MIXED USING
RED AND GREEN

RED

WHITE
ALL SHADES OF
RED

RED

44
CIE Chromaticity Diagram

45
COLOR MODELS

Color is specification of co-ordinate system and a subspace


within that system where each color is represented by
single point.

46
RGB Color Model
Model based on Cartesian co-ordinate system.
Color space is a cube.
RGB are 3 corners of cube.
Black is at origin.
White is at corner farthest from origin.
Line joining 2 points form gray scale.
Different colors are points on or inside the cube.
Cube is unit cube.
Value of R,G,B are in the range [0,1].

47
RGB Color Model

48
Pixel Depth:- Number of bits used to represent each pixel in RGB
space is called pixel depth.
If depth = 24 bits , each image plane is of 8 bits. Such type of
image is called full color image.
Total number of colors in 24-bit RGB image is
(28)3 = 16,777,216

All systems safe colors:- Subset of colors that can be produced by


any system. 256 is the safe colors for any system.

49
50
51
CMY AND CMYK color models
CMY :- Cyan , Magenta , Yellow color model
Many color printers and copiers require this model.
[C,M,Y] = [1 1 1] – [R,G,B]
Therefore, pure cyan does not reflect red
Pure magenta does not reflect green
Pure yellow does not reflect blue.
Similarly,
[R,G,B] = [1 1 1] – [C,M,Y]
Combining CMY produces muddy looking black. To produce pure
black, fourth pure black color is added. So model known as CMYK
where K is black . The printing techniques using these four colors
is known as four color printing.
52
HSI COLOR MODEL
(Hue ,Saturation and Intensity)

RGB and CMY describes color by giving its composite colors.


But this is not practical method for human interpretation.
When humans view a color object, they describe by its hue,
saturation and brightness.

53
Obtaining HSI from RGB

Intensity:- Take the RGB cube and stand it on the black (0,0,0)
vertex with (1,1,1) white directly above it.
Intensity is along line joining these vertices.
To find intensity component of any color, pass a plane
perpendicular to intensity axis containing the color point.

Saturation:-Saturation of color increase as we move away from


intensity axis.
Saturation point at intensity axis is 0 by the fact that all points are
gray.

54
Hue:- Form plane take 3 points : Black, white and a color.
All points in the plane segment and points on boundaries of cube
have the same hue.
By rotating the plane on vertical axis, different hues are obtained.

55
CONVERSION AMONG DIFFERENT
COLOR MODELS
RGB to HSI
Assumed that RGB values have been normalized to [0,1] and
angle θ is measured with respect to red axis of HSI space.
Conversion equations
HSI to RGB
RG sector (0° <= H <= 120°)
GB sector (120° <= H <= 240°)
BR sector (240° <= H <= 360°)

56
Relation between RGB and HSI
Model

57
58
PSEUDOCOLOR IMAGE PROCESSING

Assigning colors to gray level values based on certain criteria.


Major use is interpretation of gray level images.
Two techniques are used:-
Intensity slicing
Gray level to color transformations

59
INTENSITY SLICING
Let [0 – L-1] gray scale. This scale is divided into L levels where l0
represents black f (x,y) =0 and level lL-1 represents white f (x,y) =
L-1. Total P planes are defined perpendicular to intensity axis
defined at levels l1,l2,…,lp and 0 <P< L-1.
P planes partition gray scale into P+1 intervals V1, V2,…,V p+1
Gray to color assignments are made as
f (x,y) = ck if f (x,y) ε Vk
Vk :- interval formed by partitioning planes at l = k-1 and l=k
ck :- color associated with kth intensity interval Vk.

60
Any plane slice the image function into two levels.
Different color is assigned to each plane. Any pixel whose gray
level is above the plane will be coded with one color and below
the plane will be coded with other.
Pixels on the plane can be assigned any color.
Result is two color image.
When more colors are used, mapping function takes staircase
form.

61
Intensity Slicing

62
63
Gray level to Color Transformation
Perform three independent transformations on gray levels.
The three results are fed separately into red, green and blue
channels of TV.
Intensity slicing is a special case where piecewise linear function
of gray levels is used.
Here transformation function can be smooth , non-linear
function.
Many monochrome images can also be combined to form single
color composite image. Application is in multispectral imaging
where different sensors produce individual monochrome images
each in different spectral band.

64
Color Transformation

65
Pseudo color Processing

66
Full Color Image Processing

Processing techniques applicable to full color images.


Two techniques.
1) Process each component image individually and form
processed composite color image.
2) Work with color pixels directly.

67
COLOR TRANSFORMATIONS

g (x,y) = T [f (x,y)]
T is the transformation on colored image f (x,y). g (x,y) is
transformed image.
Difference between color and gray level transformation is color
transformation pixels are group of triplets. Color transformation
have the form
si = Ti (r1, r2,…,rn) i=1,2,…,n
n=3 or 4
n=3 for RGB and HSI
N=4 for CMYK

68
Any transformation can be performed in any color model. For
choosing a particular color model, cost of conversion should be
considered.
example.:- If intensity has to be modified, HSI color space can be
used
s3 = k r3 only r3 is modified.
But for RGB all the 3 components must be transformed.
si = k ri i=1,2,3
and for CMY si = k ri + (1-k)i=1,2,3
Here intensity transformation in HSI space is simple but
calculations for converting RGB and CMY to HSI are more
complicated. But independent of color space output is always
same.

69
Color Complements (Here directly opposite to each other
in color circle. Equal to gray level negative.)

70
COLOR SLICING
Highlighting specific range of colors in an image for the
purpose of separating objects from surroundings.
Two approaches:-
1. Display colors of interest so they stand out from background.
2. Use region defined by colors as a mask.
One way to slice a color image is to map the colors outside
some range of interest to a neutral color. Suppose colors of
interest are enclosed by average color with components
a1,a2,…,an then set of transformations is:
This transformation highlight the color around the prototype
by forcing all other colors to midpoint of reference color
space. e.g. for RGB suitable neutral point is (0.5,0.5,0.5).

71
HISTOGRAM PROCESSING

Color images are composed of different components.


Therefore, erroneous colors are obtained by independently
equalizing individual components of color image.
More logically approach is to spread color intensities uniformly
leaving color unchanged.
Therefore, HSI color space should be used where intensity is
spread keeping hue unchanged.

72
SMOOTHING AND SHARPENING

SMOOTHING (Averaging):-
S x,y denote set of co-ordinates defining neighborhood
centered at (x,y) in RGB color image. Average of RGB
component vectors in neighborhood is
c (x,y) = 1/k Σ c (x,y)
x,yε Sxy

Matrix form:
COLOR IMAGE SHARPENING:

73
NOISE IN COLOR IMAGES

The color channels may be affected by noise due to the


malfunctioning of the electronics of that particular channel.
Also, the noise can be due to the differences in relative
strength of illumination available to each color channel.
CCD sensors are noisier at low levels of illumination.
If we have used a red reject filter in CCD camera the red
component of the RGB image would be much noisier.

74

You might also like