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.

 Akzeptierte Antwort

Matt J
Matt J am 16 Mär. 2026
Bearbeitet: Matt J am 16 Mär. 2026
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})

1 Kommentar

Thank you for your answer. I successfully managed to segment the images for post-processing using tis method.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Walter Roberson
Walter Roberson am 16 Mär. 2026

0 Stimmen

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 Kommentar

Thank you for your response. i cropped the original image that had fringes. Do you suggest I use the original image for this?

Melden Sie sich an, um zu kommentieren.

Produkte

Version

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by