Modification of output from regionprops

4 views (last 30 days)
Stefano
Stefano on 14 Jul 2014
Dear all,
I have a simple question that is slowly driving me crazy. I use the regionprops function recursively on some images taken with different magnification (50'000x and 100'000x) and I would like to translate the output of regionprops from 'pixel' to 'nanometers'. I know the conversion 'pixel2nm' (47pixels=100nm on my images) and I would like to keep the structure output from regionprops, but although I can extract the data from regionprops I couldn't find any way to replace it within the same variable. Here the code where 'props' in an array of cells with the properties I want regionprops to extract and data is a struct with the data of my image.
function [stats]=analyze_images(data, props)
img=imread(data.fileName);
BW=im2bw(imcomplement(img),data.threshold); % color --> black&white
BW=imcrop(BW, data.ROI); % crop image to the ROI
BW=bwareaopen(BW,data.minSize); % delete small features
%%get properties through "shape analysis"
[~,L] = bwboundaries(BW,'noholes');
stats=regionprops(L,props);
Now i would like to do something like to convert pixels to nanometers:
stats.Perimeter = stats.Perimetes .* pixel2nm;
... but it keeps giving me error in any way I tried to put my brackets [],{} or ()... -_-
any help would be appreciated!
Thanks,
-ste-

Answers (0)

Community Treasure Hunt

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

Start Hunting!