Determine average of an image in .fig format
显示 更早的评论
Hi all,
I've saved a number of images as .fig as a result of extensive computations in Matlab 2007b. However, I would like to glean some extra info from these images without having to reprocess all files. I simply want to get the mean of a number of values dictated by a defined region (set by rect()). Is this possible? Obviously my matrices of values are no longer in memory, in which case this would be easy. I've been using uiopen to view the files; is there another option that would allow me to perform this?
Any advice would be appreciated, Kista
采纳的回答
更多回答(3 个)
Shashank Prasanna
2013-2-8
编辑:Shashank Prasanna
2013-2-8
Here is an example you can hopefully modify it for your use:
% Create a figure with a rectangle:
rectangle('Position',[0.59,0.35,3.75,1.37],'LineWidth',2,'LineStyle','--')
hgsave(gcf,'rect.fig'); % you can save it manually from file if you like.
h = importdata('rect.fig');
pos = h.children.children.properties.Position
pos =
0.5900 0.3500 3.7500 1.3700
How did i find the position properties, well you can just explore the entire 'h' structure, depending on what type of image you have you can extract the properties appropriately. You can later maybe do a sum average etc.
Image Analyst
2013-2-8
Just avoid the problem in the first place. Don't save images as .fig files. Save them as image files, for example .PNG files. Then you simply read it back in with imread() and get the mean with mean2():
grayImage = imread(fullFileName);
theMean = mean2(grayImage(row1:row2, col1:col2));
Susan
2013-2-11
0 个投票
1 个评论
Image Analyst
2013-2-11
Saving as a fig file is a mistake. Save the variables in a mat file and you'll be able to get the numbers out exactly as they were.
类别
在 帮助中心 和 File Exchange 中查找有关 Graphics Objects 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!