calculating area and perimeter for pap-smear image

1 vue (au cours des 30 derniers jours)
vidhya v
vidhya v le 11 Mar 2020
Modifié(e) : vidhya v le 14 Mar 2020
Greetings,
I want to calculate the area and perimeter of the nucleus of image i have attached here. i have tried some of the codes, but i cant get it. please help me with the code for calculating the area and perimeter.
Thank you in advance.

Réponse acceptée

Turlough Hughes
Turlough Hughes le 11 Mar 2020
Modifié(e) : Turlough Hughes le 11 Mar 2020
There are numerous ways you could segment the nucleus, I elected here to threshold based on R,G,B values in the image. To work out appropriate threshold values you can use the color thresholder app (I have already done that in this case). You will have to change the filename and you may also change rgb threshold values as you please. Note the thresholds are set to accept values less than rThresh, gThresh, bThresh.
I suggest you also look at the definitions for the properties obtained using the regionprops function. You will need to have some scale in terms of pixels per mm or pixels per micrometer to determine meaningful perimeter and area quantites.
% Parameters
% RGB threshold values
rThresh = 130;
gThresh = 130;
bThresh = 150;
% filename
filename = 'vidhya.bmp';
% Setup
fontSize = 16;
figure('Units', 'Normalized', 'OuterPosition', [0 0 1 1])
% Load & show image
A = imread(filename);
subplot(2,2,1), imshow(A)
title('Original Image','fontSize',fontSize)
% Implent thresholding
B = A(:,:,1)<rThresh & A(:,:,2)<gThresh & A(:,:,3)<bThresh;
% Display result of threshold
subplot(2,2,2), imshow(B)
title(sprintf('Values less than threshold (R:%d, G:%d, B:%d)', ...
rThresh,gThresh,bThresh),'fontSize',fontSize)
% Filter out all but the largest area & display results
C = bwareafilt(B,1);
subplot(2,2,3), imshow(C)
title('Largest area selected','fontSize',fontSize)
% Fill the area so all pixels inside are true
D = imfill(C,'holes');
% Get Area and Perimeter
props = regionprops(D,'Area','Perimeter');
% Show results
subplot(2,2,4), imshow(D);
title(sprintf('Final region (area filled) \n Area: %dpx Perimeter: %4.2fpx', ...
props.Area,props.Perimeter),'fontSize',fontSize)
  7 commentaires
Image Analyst
Image Analyst le 14 Mar 2020
Then like I said, if img_comp_s is your binary image mask, do:
props = regionprops(img_comp_s, 'Area');
allAreas = [props.Area];
Attach your .fig file if you want more help.
vidhya v
vidhya v le 14 Mar 2020
Modifié(e) : vidhya v le 14 Mar 2020
function area_Callback(hObject, eventdata, handles)
% hObject handle to area (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global im im2 I feature img_comp_s img_comp_s1
axes(handles.axes2);
feature = findobj(handles.axes2, 'type', 'image');
handles.ImgData2 = img_comp_s;
guidata(hObject,handles);
J = imcrop(img_comp_s);
bin = imbinarize(img_comp_s);
props = regionprops(bin,'Area');
allarea = [props.Area];
This is my code i tried sir. The problem is I have to show the calculated value of area in the edit text if i click the pushbutton of 'AREA'
please suggest me how can i get it done.
Thanking you.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Biomedical Imaging dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by