![area.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/225585/area.png)
How to remove triangles from an image?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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.
0 comentarios
Respuestas (3)
Akira Agata
el 20 de Jun. de 2019
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](https://www.mathworks.com/matlabcentral/answers/uploaded_files/225585/area.png)
1 comentario
Akira Agata
el 20 de Jun. de 2019
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](https://www.mathworks.com/matlabcentral/answers/uploaded_files/225666/edge.png)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!