I have mass images that I want to extract the feret, circularity and area of but how do I know that's what is being counted?
1 次查看(过去 30 天)
显示 更早的评论
I managed to write this code. But what in the image is it measuring the properties from? like how can i confirm that it is measuring the area and number of the cells in the image?:
% read the image and convert to binary
im = imread('my_image.png');
bw = im2bw(im);
% remove small objects
bw = bwareaopen(bw, 50);
% fill the holes
bw = imfill(bw, 'holes');
% label the objects
cc = bwconncomp(bw);
labeled = labelmatrix(cc);
% extract region properties
props = regionprops(cc, 'Area', 'Perimeter', 'Centroid', 'Eccentricity', 'Circularity', 'MinorAxisLength', 'MajorAxisLength');
% loop over the objects
for i = 1:length(props)
% extract the properties for the i-th object
% display the properties
disp(['Object ', num2str(i), ':']);
disp(['Area = ', num2str(area)]);
disp(['Perimeter = ', num2str(perimeter)]);
disp(['Centroid = ', num2str(centroid)]);
disp(['Eccentricity = ', num2str(eccentricity)]);
disp(['Circularity = ', num2str(circularity)]);
disp(['Feret diameter = ', num2str(feret_diameter)]);
end
% display the labeled image
imshow(label2rgb(labeled))
Thanks,
L.
0 个评论
采纳的回答
Image Analyst
2023-3-7
You can display bw:
imshow(bw);
That will show you the blobs that are being measured.
0 个评论
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!