Near are to a value

조회 수: 2 (최근 30일)
Alejandro Fernández
Alejandro Fernández 2020년 4월 27일
댓글: Alejandro Fernández 2020년 4월 27일
Hi, I was wondering if anyone knows how I can program the option for a binary image to which all its regions have been tagged to determine the index of that region whose area is closest to a value I enter, for expample 1.
value = 1;

답변 (1개)

Image Analyst
Image Analyst 2020년 4월 27일
To extract the index of a desired number from a labeled (what you call "tagged") image, you can do this:
[labeledImage, numRegions] = bwlabel(allBlobs); % allBlobs is your binary image.
% Now extract blob #7 ONLY into a new binary image:
oneSingleBlob = ismember(labeledImage, 7);
  댓글 수: 1
Alejandro Fernández
Alejandro Fernández 2020년 4월 27일
But what I want is to extract the index from the region whose area is closest to 1 square pixel

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

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by