# Pattern Recognition(Matlab)

1. ## Pattern Recognition(Matlab)

Hi...

I m new in image processing...

want 2 recognize my specified pattern..

I read an image with imread command,converted it into grayscale. then i have to use normxcorr2 function..

how normxcorr2 function works?? what is template? and how it is used??

thanks

Naveed

•

2. ## Re: Pattern Recognition(Matlab)

Hi,

Template is the pattern you want to find in the image. For example if you are looking for circles in an image, a smaller image containing only a circle is the template. Once you calculate the cross-correlation between a template T and an image I, you obtain an image X.

The location of the pixel with the highest value in X will give you the location of the most similar pattern in I.

In the link below, it is very clearly explained how to do cross-correlation and how to calculate the coordinates of the found pattern using the information returned from the function normxcorr2.

http://www.mathworks.com/products/de...ion/imreg.html

Regards.

•

3. ## Re: Pattern Recognition(Matlab)

Thanks dear!

I have the following code and steps

2) rgb=rgb2gray(I)
3) template=imcrop(rgb)
4) cc= normxcorr2(template,rgb)

Results.
1)rgb matrix is 10x10 matrix, while template matrix is 6x5 matrix.
2)cc returns me 15x14 matrix.

How can i recognize the template or my specified pattern in rgb?? How should i read this 15x14 matrix??

thanks alot

Naveed

--[[ ]]--