MATLAB Answers

0

Edge detection when the boundaries are clearly marked

Kasthuri Kannan さんによって質問されました 2019 年 11 月 6 日
最新アクティビティ Kasthuri Kannan さんによって コメントされました 2019 年 11 月 6 日 14:52
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
2019 年 11 月 6 日 14:01
You want those boundaries to be separate?
Kasthuri Kannan 2019 年 11 月 6 日 14:08
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.

サインイン to comment.

1 件の回答

darova
回答者: darova
2019 年 11 月 6 日 14:23

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 2019 年 11 月 6 日 14:52
Not really. I am looking for something like this. This is just two regions, black and green -
boundaries.png

サインイン to comment.



Translated by