MATLAB Answers

How to choose circular shape in image after segmentation ?

조회 수: 1(최근 30일)
Ali Zulfikaroglu
Ali Zulfikaroglu 2021년 5월 10일
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);
  댓글 수: 1
Ali Zulfikaroglu
Ali Zulfikaroglu 2021년 5월 12일
@Image Analyst could you please check this question ? thank you .

댓글을 달려면 로그인하십시오.

답변(1개)

Harikrishnan Balachandran Nair
Harikrishnan Balachandran Nair 2021년 8월 18일
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!

Translated by