Edge detection when the boundaries are clearly marked

1 visualización (últimos 30 días)
Kasthuri Kannan
Kasthuri Kannan el 6 de Nov. de 2019
Comentada: Kasthuri Kannan el 6 de Nov. de 2019
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.
CD63_W1-1-2-K.1.04_101698569.jpg
  2 comentarios
darova
darova el 6 de Nov. de 2019
You want those boundaries to be separate?
Kasthuri Kannan
Kasthuri Kannan el 6 de Nov. de 2019
Yes, like the black boundary is one region, green another etc. In general, there could be as many as 9 such boundaries and I want to mark them separately. Thanks.

Iniciar sesión para comentar.

Respuestas (1)

darova
darova el 6 de Nov. de 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)
  1 comentario
Kasthuri Kannan
Kasthuri Kannan el 6 de Nov. de 2019
Not really. I am looking for something like this. This is just two regions, black and green -
boundaries.png

Iniciar sesión para comentar.

Community Treasure Hunt

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

Start Hunting!

Translated by