Check if a binary image is within a particular binary area

조회 수: 5 (최근 30일)
Elysi Cochin
Elysi Cochin 2022년 4월 24일
댓글: DGM 2022년 4월 25일
I have a binary image BW_large, and another binary image BW_small
How do I check if BW_small is within BW_large?

채택된 답변

DGM
DGM 2022년 4월 24일
편집: DGM 2022년 4월 24일
I'm assuming your images are the same size, but contain objects of differing size.
The intersection of two binary images A and B is
intAB = A & B;
If the intersection is equal to one of the two images, then that image is wholly contained within the other.
BinA = isequal(B,intAB);
Otherwise, if you have different size images which contain similarly-sized and oriented copies of the same object, you might look at normxcorr() or something.
  댓글 수: 6
Elysi Cochin
Elysi Cochin 2022년 4월 25일
Thank you Sir, thats working. Sir one more doubt, how did you find tolerance?
DGM
DGM 2022년 4월 25일
This gives the ratio of the intersection area to the area of BW3
nnz(intAB3)/nnz(BW3)

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Image Analyst
Image Analyst 2022년 4월 24일
If you just want to know if ANY part of it is within the other blob, then you can make up your marker image and main image, and call imreconstruct(). You have years of image processing experience now so you should be able to figure it out.

카테고리

Help CenterFile Exchange에서 Images에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by