Setting scale (pixel to mm)

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 commentaire

Walter Roberson
Walter Roberson le 18 Fév 2016
Modifié(e) : Walter Roberson le 18 Fév 2016
The cel.png file contains errors, apparently. At least my browser thinks so, but Preview (OS-X) seems happy with it.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Convert Image Type dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by