How to choose circular shape in image after segmentation ?
4 views (last 30 days)
I have a mammogram image,
I am applying segmentation process.
To remove pectoral muscle and tags, the code takes biggest area and they are gone(pectoral muscle and tags)
But sometimes pectoral muscle part is the biggest part and tumor area is smaller so tumor area is gone too.
Maybe if code detect circular shape and others remove it can be more succesfull
Codes are below . How can we do this ?
Image added. (tumor is circle shape)
(in this code below pectoral muscle is stay others gone .)
(The aim is detect tumor area , not pectoral muscle. )
title('Original Image', 'FontSize', fontSize);
% Maximize the figure window.
set(gcf, 'Position', get(0, 'ScreenSize'));
%Using histogram to adjust the image
I_eq = adapthisteq(IM);
title('Equalized Image', 'FontSize', fontSize);
%Method #1: using a thresholding method.
%Above 200(>), will appear white; Below <200, will appear black
%Remove objects in the image that is less than 250 pixels
thresholdValue = 200;
binaryImage = I_eq > thresholdValue;
%clear the border
IM_cb = imclearborder(binaryImage);
BW2 = bwareaopen(IM_cb, 250);
BW_filled = imfill(BW2, 'holes');
title('Segmented Image', 'FontSize', fontSize);
labeledImage = bwlabel(BW_filled);
measurements = regionprops(labeledImage, 'Area');
% Get all the areas
allAreas = [measurements.Area];
[biggestArea, indexOfBiggest] = sort(allAreas, 'descend')
% Extract biggest
biggestBlob = ismember(labeledImage, indexOfBiggest(1));
% Convert to binary
biggestBlob = biggestBlob > 0;
subplot(2, 2, 4);
Harikrishnan Balachandran Nair on 18 Aug 2021
From my understanding, you want to detect circular objects in your image. You can use 'imfindcircles' function in Matlab where circular hough transform is used to find circles in the image.
You may refer to the following documentation to get more information on the function: https://www.mathworks.com/help/images/ref/imfindcircles.html