How to choose circular shape in image after segmentation ?

2 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. )
clear all;
clc;
IM=imread('B1 (33).png');
subplot(2,2,1),imshow(IM);
title('Original Image', 'FontSize', fontSize);
% Maximize the figure window.
set(gcf, 'Position', get(0, 'ScreenSize'));
axis square;
%Using histogram to adjust the image
I_eq = adapthisteq(IM);
subplot(2,2,2),imshow(I_eq);
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');
subplot(2,2,3),imshow(BW_filled);
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);

Answers (1)

Harikrishnan Balachandran Nair
Hi,
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

Community Treasure Hunt

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

Start Hunting!