![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/268020/image.png)
Getting Spots in banana
1 view (last 30 days)
Show older comments
Allan III T. Condiman
on 22 Jan 2020
Commented: Allan III T. Condiman
on 28 Jan 2020
How to detect blacked spots or disease in banana and draw an color red in spots
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/265432/image.jpeg)
0 Comments
Accepted Answer
KALYAN ACHARJYA
on 24 Jan 2020
Edited: KALYAN ACHARJYA
on 24 Jan 2020
rgbImage=imread('ban.jpeg');
subplot(121),imshow(rgbImage);
grayImage=rgb2gray(rgbImage);
[segment,blackSpots]=bwlabel(~im2bw(grayImage,0.7));
% Choose the threshold as per requirements
total_bk_spots=blackSpots-1
%................^ minus 1 for ignoring largest blobbs
subplot(122),imshow(segment);
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/268020/image.png)
If not, then do the color thresholding.
More Answers (0)
See Also
Categories
Find more on Image Processing Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!