image processing area calculation

Hi,
I am new to image processing in matlab and I am trying to get an area measurement out of histology slides. I want to convert the image to binary get a pixel count of the white area and using a known distance (scale bar) in the image calculate the area.
I am using a sample code for medical image processing webinar but I am having trouble getting the right amount of contrast in my images I am not getting them to completely convert to a binary image.
Is there a way for me to first close out the edges that are not complete in the image and fill and then convert to binary or another method that would work?
function [image] = getCA(image)
A = imread (image);
glayer = A(:,:,2);
figure;
imshow(glayer)
agray = rgb2gray (A);
level = graythresh (agray);
abinary = ~im2bw(glayer, level);
figure;
imshow(abinary)
cc = bwconncomp (abinary);
stats = regionprops (cc, 'basic');
B = [stats.Area];
[~,biggest] = max(B);
abinary(labelmatrix(cc)~=biggest) = 0;
imshow(abinary)
abinary = imfill(abinary, 'holes');
Thanks so much for the help!

回答 (2 件)

Image Analyst
Image Analyst 2014 年 7 月 18 日

0 投票

image is the name of a built in function. Do not use it as the name of a variable.
I'm not sure what you're calling "white" in the image, and what region(s) you'd like the area of.
I don't see any code there where you are trying to extract the 300 um scale bar.
See my Image Segmentation Tutorial for how to threshold and get areas: http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862
linson vincent
linson vincent 2018 年 1 月 26 日

0 投票

how to find area of a image using matlab

1 件のコメント

Image Analyst
Image Analyst 2018 年 1 月 26 日
Multiply the number of pixels in the image by the spatial calibration factor in real world units per pixel. See attached spatial calibration demo.

サインインしてコメントする。

質問済み:

2014 年 7 月 18 日

コメント済み:

2018 年 1 月 26 日

Community Treasure Hunt

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

Start Hunting!

Translated by