how to detect black colors

3 Ansichten (letzte 30 Tage)
Alexai am 24 Feb. 2022
Beantwortet: yanqi liu am 25 Feb. 2022
How can I detect a lot of black colors and mark bounding boxes from overall gray image?
  1 Kommentar
Rik am 24 Feb. 2022
What di you try? Have a read here and here. It will greatly improve your chances of getting an answer.
In this case, it looks like a simple threshold will do (maybe follwed by regionprops).

Melden Sie sich an, um zu kommentieren.

Antworten (1)

yanqi liu
yanqi liu am 25 Feb. 2022
yes,sir,may be the view:
or use the follow code
img = imread('');
mask = imdilate(~im2bw(img, 100/255), strel('square', 39));
props = regionprops(mask, 'BoundingBox');
figure; imshow(img, []);
hold on;
for i = 1 : length(props)
rectangle('position', props(i).BoundingBox, 'EdgeColor', 'g', 'LineWidth', 2)


Mehr zu Image Processing Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by