Skip to content

Matlab script that detects a pattern in an image using the corr2 function

License

Notifications You must be signed in to change notification settings

kianwasabi/Detect_Pattern_in_Image

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 

Repository files navigation

Detect Pattern In Image

CheckForPatternInImage.m is a simple Matlab script that detects a pattern (A) in an image (B) using the corr2 function.

Idea:

The "corr2" function in matlab (R = corr2(A,B)) proves to be very useful for pattern recognition in image processing.
This function can be used to analyze two 2-dimensional images of the same size based on their similarity.
First, both images need to be converted to 𝑛 𝑥 𝑚 -sized arrays. It should be noted that the arrays must be of the same dimension in order to be processed further.
With the parameters (A) and (B) passed to the "corr2(..,..)" function, the correlation coefficient R is returned as result. The correlation coefficient R represents the similarity between (A) and (B) by setting the relation of the respective pixel intensity in relation to the average pixel intensity of the whole image.
Hence, the corr2 function represents the following equation to determine the correlation coefficient R:
According to the equation R lies between 0 and 1; Where R = 0 means that there is no correlation and R = 1 indicates the maximum strengthof the relationship.

(see: [1] & [2])

Concept:

The following flowchart briefly shows the structure of the Matlab script.

Result:

Case 1 - correct pattern recognition:

Case 2 - correct pattern recognition with modified pattern:

Case 3 - misleading pattern recognition:

Case 4 - incorrect pattern recognition:



Project Status:

Not perfect, but done.

Built with:

Matlab - Required: Image Processing

About

Matlab script that detects a pattern in an image using the corr2 function

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages