필터 지우기
필터 지우기

Help remove unconnected small pixel from image

조회 수: 1 (최근 30일)
MOHAMMAD AZRUL AIMAN
MOHAMMAD AZRUL AIMAN 2021년 1월 4일
답변: Image Analyst 2022년 6월 8일
Hello, maybe this question have been ask from other people, but i not fully understand how this code work. when i combine with my code it appear "index exceeds the number of array element" . can u help fix my code and help me understand the function

채택된 답변

Uday Pradhan
Uday Pradhan 2021년 1월 7일
Hi,
I found the mistake at line 132 of the code you have attached. If you notice, grayImage is already a binary image so thresholding it this way, will lead to binaryImage being a logical array with only zeros, hence the error.
% Threshold the image to binarize it.
binaryImage = grayImage > 100;
I believe you can just take:
% Threshold the image to binarize it.
binaryImage = grayImage ;
and then run the code to get the largest extracted blob. I hope this helps!

추가 답변 (1개)

Image Analyst
Image Analyst 2022년 6월 8일
You can now use bwareafilt instead of that ExtractNLargestBlobs() function I wrote (before bwareafilt was available) that you are using.
largestBlob = bwareafilt(binaryImage, 1); % Take largest blob only.

Community Treasure Hunt

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

Start Hunting!

Translated by