How can I accurately segment a 3-phase image?

2 visualizaciones (últimos 30 días)
burges
burges el 5 de En. de 2017
Respondida: Image Analyst el 5 de En. de 2017
I have a three-phase image in which I have segmented automatically using the ‘imquantize’ function.
The code is as follows:
%# Read in image
I = imread(original_img.jpg');
figure, imshow(I, []);
%# Filter Image
I = medfilt2(I);
%# Segment image
thresh = multithresh(I, 2);
Iseg = imquantize(I, thresh);
figure, imshow(Iseg, []);
If you however look through the original image you will notice that most of the black phase touches the solid (grey phase). Nonetheless, the segmentation seem not to accurately capture this as the segmented image in most parts has rings of the intermediate phase around the solid phase. As you know, this inaccuracy might obviously affect any subsequent analysis on the image.
The original and segmented image are shown below.
Please any help/suggestions as to how I could make my segmentation more accurate?
Many thanks.

Respuestas (1)

Image Analyst
Image Analyst el 5 de En. de 2017
Most of the larger medium gray regions seem legitimate so you probably don't want to get rid of those.. If there are some smaller gray regions around the lightest gray discs, you can detect those with bwareaopen() and then set their gray level to the mean gray level of the darker phase, and then resegment.
% Get a binary image of only the larger medium-gray blobs.
largeOnly = bwareaopen(medGrayBinary, 100); % Get rid of blobs 100 pixels or smaller.
% Get a binary image of only the smaller medium-gray blobs.
smallOnly = medGrayBinary & ~largeOnly;
% Set those pixels equal to the gray level of the dark phase.
grayImage(smallOnly) = mean(grayImage(darkGrayBinary));
% Now segment again into dark, medium, and light gray binary images.

Community Treasure Hunt

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

Start Hunting!

Translated by