bwlabel does not count objects in the image
10 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaire
Image Analyst
le 19 Avr 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)
Réponses (0)
Voir également
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!