Find a submatrix in a matrix
이전 댓글 표시
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
답변 (1개)
Image Analyst
2015년 11월 20일
0 개 추천
You can use normalized cross correlation, normxcorr2(). See attached demo.

댓글 수: 2
Raed Alaraj
2015년 11월 20일
편집: Image Analyst
2015년 11월 20일
Image Analyst
2015년 11월 20일
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.
카테고리
도움말 센터 및 File Exchange에서 Object Analysis에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!