Borrar filtros
Borrar filtros

how can I detect black(specific) color in this image

1 visualización (últimos 30 días)
Alexai
Alexai el 1 de Mzo. de 2022
Respondida: yanqi liu el 2 de Mzo. de 2022
how can I detect black(specific) color in this image
I want to detect from color and draw a lot of bounding box of a suitable size so that the area is not clipped like image 111
  2 comentarios
DGM
DGM el 1 de Mzo. de 2022
Can you provide a copy of the test image without the annotations?
Alexai
Alexai el 1 de Mzo. de 2022
I uploaded it again in the attached file.

Iniciar sesión para comentar.

Respuestas (1)

yanqi liu
yanqi liu el 2 de Mzo. de 2022
img = imread('https://ww2.mathworks.cn/matlabcentral/answers/uploaded_files/910360/original%20image.jpg');
I = rgb2gray(img);
bw = ~imbinarize(I,'adaptive','ForegroundPolarity','dark','Sensitivity',0.35);
[L,~] = bwlabel(bw);
figure; imshow(img, []); hold on;
h = imshow(label2rgb(L));
set(h, 'AlphaData', 0.5);
bw2 = imclose(bw, strel('disk', 5));
bw2 = bwareaopen(bw2, 20);
[L2,~] = bwlabel(bw2);
stats = regionprops(L2);
hold on;
for i = 1 : length(stats)
hold on; rectangle('position', stats(i).BoundingBox, 'EdgeColor', 'g', 'LineWidth', 2)
end

Categorías

Más información sobre Image Segmentation and Analysis en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by