Edge detection when the boundaries are clearly marked

조회 수: 1 (최근 30일)
Kasthuri Kannan
Kasthuri Kannan 2019년 11월 6일
댓글: Kasthuri Kannan 2019년 11월 6일
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
darova
darova 2019년 11월 6일
You want those boundaries to be separate?
Kasthuri Kannan
Kasthuri Kannan 2019년 11월 6일
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.

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

답변 (1개)

darova
darova 2019년 11월 6일
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
Kasthuri Kannan
Kasthuri Kannan 2019년 11월 6일
Not really. I am looking for something like this. This is just two regions, black and green -
boundaries.png

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

Community Treasure Hunt

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

Start Hunting!

Translated by