how to detect black colors

조회 수: 3 (최근 30일)
Alexai
Alexai 2022년 2월 24일
답변: yanqi liu 2022년 2월 25일
How can I detect a lot of black colors and mark bounding boxes from overall gray image?
  댓글 수: 1
Rik
Rik 2022년 2월 24일
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).

댓글을 달려면 로그인하십시오.

답변 (1개)

yanqi liu
yanqi liu 2022년 2월 25일
yes,sir,may be the view:https://ww2.mathworks.cn/matlabcentral/answers/1656655-how-can-i-detect-black-color-and-mark-bounding-box-from-overall-gray-image
or use the follow code
img = imread('https://ww2.mathworks.cn/matlabcentral/answers/uploaded_files/905790/Screenshot_20220224-200026_Samsung%20Notes.jpg');
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)
end

카테고리

Help CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by