Find a submatrix in a matrix
Mostrar comentarios más antiguos
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
Respuestas (1)
Image Analyst
el 20 de Nov. de 2015
0 votos
You can use normalized cross correlation, normxcorr2(). See attached demo.

2 comentarios
Raed Alaraj
el 20 de Nov. de 2015
Editada: Image Analyst
el 20 de Nov. de 2015
Image Analyst
el 20 de Nov. de 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.
Categorías
Más información sobre Object Analysis en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!