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 で Contrast Adjustment についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!