DIGITAL IMAGE PROCESSING
( useful for optical charactor recognition)
B-TECH 2nd year
• A digital image is a representation of a two-dimensional
image as a finite set of digital values, called picture elements
• The image is stored in computer memory as 2D array of
• These pixels takes memory to store according to there variable
type like ---double,logical,uint8,uint16, uint32,char etc.
Digital images can be created by a variety of input devices and techniques:
Digital images can be classified as-
• rgb2gray – RGB image or colormap to
• im2bw – image to binary image by
• im2double – image array to double precision.
• im2uint8 – image array to 8-bit unsigned
• im2uint16 – image array to 16-bit unsigned
• There are different colour spaces to represent colour image.
1. RGB colour space.
2. NTSC colour space.
3. HSV colour space.
4. YCbCr colour space......etc.
• We will only consider RGB colour space here to represent colour
• In RGB colour space there are 3 images layers-
- The above 3 images Red,Green,Blue are called greyscale images.
- These 3 greyscale image overlaps to form RGB image.
- In GSI there are different intensity’s pixels of red,blue green
colours are available to overlap to form colour image’s pixels.
• This type of image contains pixels of logical memory
(0 or 1).
- This is also called black and white image.
IMAGE PROCESSING USING MATLAB
what is image processing??-
• Digital image processing focuses on two major tasks
–Improvement of pictorial information for human interpretation
–Processing of image data for storage, transmission and representation
for autonomous machine perception .
Read the image in matlab.
convert the image in grey scale.
>> g1=a(:,:,1);..........this is RED component of RGB.
convert the image in binary image.
>>bw=g1>150;.....if value of pixel>150 then 1
if value of pixel<150 then 0
Read the colour imageRGB(colour
Convert to GREY SCALE IMAGE
Convert to BINARY IMAGE
-Binary images may contain numerous imperfections. In particular,
the binary regions produced by simple thresholding are distorted by
noise and texture. Morphological image processing pursues the goals
of removing these imperfections by accounting for the form and
structure of the image. These techniques can be extended to
• # edge ditection
• # dilation
• # filling
• # filtering(convolution & corelation)
• # region properties(centroid, area, bounding box).
EDGE ditection by binary image
• Edge detection is identifying points in a digital image at which the image
brightness changes sharply or, more formally, has discontinuities.
>> Itedge = edge(uint8(bw));
FILLING the bound areas
• This process fills the bounding areas in edge ditected binary image.
>> Itfill= imfill(Iedge2,'holes');
Process in single step
Discrete the diff. Elements in image
>> [label num] = bwlabel(fill);
props = regionprops(label);
- This regionprops provides a STRUCTURE(props) which contains =
# centroid’s cordinates of diff. Elements
# area of box bounding pefectly the elements
# bounding box.
Counting the no. of elements
- In above commands ‘num’ is the total number of elements
in filled image.
- Which is shown in next slide.
Counting the no. of elements
Make the bounding box around elements
Itbox = [Itprops.BoundingBox]; Itbox = reshape(Itbox,[4 numt]); imshow(It)
for cntt = 1:numt
end........this command make the bounding box to each elements & descrete them.
Processing on RGB image
• Function imadjust =Is the basic IPT tool for intensity
transformations of gray-scale images. It has the syntax:
g = imadjust (f, [low_in high_in], [low_out high_out], gamma)
• As illustrated in figure 3.2 (above),
this function maps the
intensity values in
image f to new values in
g, such that values
between low_in and
high_in map to values
between low_out and high_out.
• Values below low_in and above high_in are clipped; that is values
below low_in map to low_out, and those above high_in map to