How to remove triangles from an image?

I need to segment the red, blue and yellow/orange-ish parts of the image and I've mostly manged to do that, the only problem is that the yellow/orange-ish segmentation contains discontinuities in some parts due to those little triangles. Any suggestions on how can I remove those triangles? ( or other ideas on how to segment it without the discontinuities). Below I've attached both the image I need to segment and the segmented image with the discontinuities I'm reffering to.

답변 (3개)

Akira Agata
Akira Agata 2019년 6월 20일

0 개 추천

How about the following?
% Read the original image
I = imread('image.jpg');
% Extract orange part (using Color Thresholder App.)
BW = createMask(I);
% Remove noise
BW = bwareafilt(BW,[10 Inf]);
% Apply morphological closing operation
BW = imclose(BW,strel('disk',50));
% Fill the area
BW = imfill(BW,'hole');
% Show the result
figure
imshowpair(I,BW)
area.png

댓글 수: 1

OK. Then, please change a little bit, like:
% Read the original image
I = imread('image.jpg');
% Extract orange part (using Color Thresholder App.)
BW = createMask(I);
% Remove noise
BW = bwareafilt(BW,[10 Inf]);
% Apply morphological closing operation
BW = imclose(BW,strel('disk',50));
% Trace the orange line
BW = bwmorph(BW,'skel',Inf);
% Show the result
figure
imshow(BW)
edge.png

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

Paul Simon
Paul Simon 2019년 6월 20일

0 개 추천

Thank you for the answer, but I need to extract the outline of the orange part, not its whole area.
Paul Simon
Paul Simon 2019년 6월 20일

0 개 추천

Great, thanks a lot.

카테고리

도움말 센터File Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

질문:

2019년 6월 19일

답변:

2019년 6월 20일

Community Treasure Hunt

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

Start Hunting!

Translated by