Find a submatrix in a matrix
Ältere Kommentare anzeigen
How can I find a sub matrix in a larger one. We learned how to extract objects from an image using filter2 and bwlabel. But I still can't understand how to find a sub matrix in a larger one. And to find out how many of them are in that matrix
Antworten (1)
Image Analyst
am 20 Nov. 2015
0 Stimmen
You can use normalized cross correlation, normxcorr2(). See attached demo.

2 Kommentare
Raed Alaraj
am 20 Nov. 2015
Bearbeitet: Image Analyst
am 20 Nov. 2015
Image Analyst
am 20 Nov. 2015
Whoever used that method did so because they wanted to find edges, rather than find an exact submatrix like you asked for. They are basically finding the gradient magnitude manually rather than using the preferred built-in functions imgradient() or imgradientxy(). Then they label the edges, which, assuming the edges are completely closed around the circle, will identify each ring/perimeter as a separate connected blob. It doesn't have anything at all to do with circles, except that they were in the demo image. The same code would find perimeters of any objects of any shape whatsoever. That code doesn't have anything at all to do with what you asked for.
Kategorien
Mehr zu Object Analysis finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!