Edge detection when the boundaries are clearly marked
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have an image like this and I need to extract the regions marked by the boundaries highlighted by the color. How do I do it? This may be a simple question, but I realize no question is simple in image processing. Thanks.
2 commentaires
Réponses (1)
darova
le 6 Nov 2019
Try this:
A = imread('test.jpeg');
subplot(1,2,1)
imshow(A)
RGB = [140 224 226]; % color you want (cyan)
% RGB = [226 129 226]; % color you want (magenta)
% RGB = [150 240 120]; % color you want (green)
% RGB = [120 120 120]; % color you want (grey)
% RGB = [120 120 190]; % color you want (violet)
% RGB = [230 170 140]; % color you want (orange)
e = 20; % color shift
c1 = abs(RGB(1)-double(A(:,:,1))) < e;
c2 = abs(RGB(2)-double(A(:,:,2))) < e;
c3 = abs(RGB(3)-double(A(:,:,2))) < e;
B = (c1+c2+c3)==3;
B1 = bwareaopen(B,10); % remove small areas
I = repmat(B1,[1 1 3]);
I = uint8(I).*A;
subplot(1,2,2)
imshow(I)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!