How can i detect blacked spots?

8 ビュー (過去 30 日間)
Allan III T. Condiman
Allan III T. Condiman 2020 年 2 月 28 日
回答済み: Allan III T. Condiman 2020 年 2 月 28 日
How can I detect Blacked Spots in banana, Because my boundingbox is not detect where is blacked area

回答 (1 件)

Allan III T. Condiman
Allan III T. Condiman 2020 年 2 月 28 日
I want to detect this spots in this picture below and not detect the spots the top and bottom of the banana?
a variable is picture
This is my code below:
grayImage = a;
[rows, columns, numberOfColorChannels] = size(grayImage);
if numberOfColorChannels > 1
grayImage = rgb2gray(grayImage);
end
binaryImage = grayImage == 0;
binaryImage = imclearborder(binaryImage);
[labeledImage, numBlobs] = bwlabel(binaryImage);
coloredLabels = label2rgb (labeledImage, 'hsv', 'k', 'shuffle');
props = regionprops(labeledImage, 'BoundingBox', 'Centroid');
imshow(picture);
hold on;
for k = 1 : numBlobs
bb = props(k).BoundingBox;
bc = props(k).Centroid;
rectangle('Position',bb,'EdgeColor','c','LineWidth',2);
end
drawnow limitrate;

カテゴリ

Help Center および File ExchangeImage Segmentation and Analysis についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by