bwlabel does not count objects in the image

11 Ansichten (letzte 30 Tage)
Nadia Luna
Nadia Luna am 19 Apr. 2022
Kommentiert: Image Analyst am 19 Apr. 2022
I wrote a code to count lymphocites but numObjects always says zero
IL = imread('Lymphocytes.jpg');
imshow(IL, [])
imhist(IL)
Thresh = multithresh(IL,2);
seg_I2 = imquantize(IL,Thresh);
imshow(seg_I2, [])
for i=1:size(seg_I2,1)
for j=1:size(seg_I2,2)
if seg_I2(i,j)==1
seg_I2(i,j)=3;
end
end
end
imshow(seg_I2,[])
J = imcomplement(seg_I2);
imshow(J,[])
binaryImage = J > 128;
[labeled,numObjects]=bwlabel(binaryImage,8);
  1 Kommentar
Image Analyst
Image Analyst am 19 Apr. 2022
You're not showing us seg_I2 or J or binaryImage. Not only that, but you forgot to attach 'Lymphocytes.jpg' so we can't do anything but assume it's doing what you told it to do. Chances are binaryImage is all false. Check
maxValue = max(binaryImage)

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by