Setting scale (pixel to mm)
Show older comments
So I have an image taken by a microscope (cel.png) it has a scale bar and the cell is gray etc. I need to find the area of the cell. My code is
clear;
clc;
prompt = 'Enter filename (include extension name): ';
str = input(prompt,'s');
A = imread(str);
image(A)
%Thresholding the image to gray-scale
level = graythresh(A);
BW = im2bw(A,level);
imshow(BW)
%Determine image dimensions
size = size(BW);
xpixel = size(2); %image dimesnions in the x axis
ypixel = size(1); %image dimesnion in the y axis
wpixel = length(BW(BW==1))
bpixel = length(BW(BW==0))
The threshold (refer to thshld.png) us working, its counting the white and black pixels. However, now I need to figure a way so the scale bar doesn't get counted and also I need to find out how to make matlab get pixel to mm ratio using the scale bar.
Any suggestions or do I need to use imageJ to get the pixel to mm ratio.
1 Comment
Walter Roberson
on 18 Feb 2016
Edited: Walter Roberson
on 18 Feb 2016
The cel.png file contains errors, apparently. At least my browser thinks so, but Preview (OS-X) seems happy with it.
Answers (0)
Categories
Find more on Biomedical Imaging in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!