image processing area calculation

조회 수: 6 (최근 30일)
Maria Rodriguez
Maria Rodriguez 2014년 7월 18일
댓글: Image Analyst 2018년 1월 26일
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일
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일
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.

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

Community Treasure Hunt

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

Start Hunting!

Translated by