How do I perform Image segmentation in an RGB image using pattern?

I want to create 2 segment in the attached RGB interference image. 1 segment would be the horseshoe pattern as can be observed in the image and the other segment would be rest of the image. So far I have tried: Edge detection using Canny, Kmeans cluster, imsegkmeans.
The clustering is almost working, but I get cluster within a cluster due to the RGB values. I want to avoid that and have just two segments from the image.

 Respuesta aceptada

Matt J
Matt J el 16 de Mzo. de 2026 a las 22:13
Editada: Matt J el 16 de Mzo. de 2026 a las 22:16
load Image
[r,g,b]=imsplit(I);
lev=multithresh(r,2);
L=imquantize(r,lev);
H=bwareafilt( imfill(L==2,'holes') ,1) ;
BG= L>1 & ~H;
L=H+2*BG;
immontage({I,L})

Más respuestas (1)

Walter Roberson
Walter Roberson el 16 de Mzo. de 2026 a las 20:32
You are pretty much doomed to failure if you want to segment the horseshoe pattern from the rest of the image. The rest of the image includes the black background, which will have such great differences in characteristics from the circle that any method you use for segmenting into exactly two regions is very likely to pick out the black background as one region and the entire circle as the second region.

1 comentario

Ammad Yousuf
Ammad Yousuf el 17 de Mzo. de 2026 a las 12:40
Thank you for your response. i cropped the original image that had fringes. Do you suggest I use the original image for this?

Iniciar sesión para comentar.

Productos

Versión

R2023a

Preguntada:

el 16 de Mzo. de 2026 a las 15:54

Comentada:

el 17 de Mzo. de 2026 a las 12:40

Community Treasure Hunt

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

Start Hunting!

Translated by