Image processing

Post on 02-Dec-2014

762 views 3 download

Tags:

description

image processing useful for OCR

Transcript of Image processing

DIGITAL IMAGE PROCESSING( useful for optical charactor recognition) USING

MATLAB

Presented by- ANTRIKSH SAXENA

B-TECH 2nd year ELECTRICAL ENGG.

IMAGE• A digital image is a representation of a two-dimensional image

as a finite set of digital values, called picture elements or pixels.

• The image is stored in computer memory as 2D array of pixels.

• 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 cameras-scanners

Digital images can be classified as-ColorGrayscaleBinary

• rgb2gray – RGB image or colormap to grayscale.

• im2bw – image to binary image by thresholding.

• im2double – image array to double precision.• im2uint8 – image array to 8-bit unsigned

integers.• im2uint16 – image array to 16-bit unsigned

integers.

COLOUR IMAGE• 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 images.

• In RGB colour space there are 3 images layers- RED,GREEN,BLUE. GREYSCALE IMAGE(GSI)

- 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.

BINARY IMAGE• 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.>> a=imread('image.jpg');>> imshow(a)

convert the image in grey scale.>> g1=a(:,:,1);..........this is RED component of RGB.>> imshow(g1)

convert the image in binary image.>>bw=g1>150;.....if value of pixel>150 then 1

if value of pixel<150 then 0 >>imshow(bw)

Read the colour imageRGB(colour image)

Convert to GREY SCALE IMAGE

Convert to BINARY IMAGE

MORPHOLOGY-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 greyscale images.

• # edge ditection• # dilation• # filling• # filtering(convolution & corelation)• # region properties(centroid, area, bounding box).

etc.

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));>> imshow(Itedge)

IMAGE dilation

FILLING the bound areas• This process fills the bounding areas in edge ditected binary image.

>> Itfill= imfill(Iedge2,'holes');>> imshow(Itfill)

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) hold on;

for cntt = 1:numt rectangle('position',Itbox(:,cntt),'edgecolor','r');

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 high_out.

>> f = imread ('baby-BW.jpg');>> g = imadjust (f, [0 1], [1 0]);>> imshow(f), figure, imshow (g);>> imshow(f), figure, imshow (g);

>> g = imadjust (f, [0.5 0.75], [0 1], .5);>> imshow(f), figure, imshow (g);