フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

displaying image

2 ビュー (過去 30 日間)
kash
kash 2012 年 4 月 6 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
i have a code
for j1 = 1:size(A1_20,3)
for j = 1:J
% loop thru subbands
for s1 = 1:2
for s2 = 1:3
w{j}{s1}{s2} =A1_20(:,:,j1);
y1 = idualtree2D(w, J, Fsf, sf);
Er= mean2((single(x) - single(y1)).^2);
final_col2{j1}=Er;
end
end
end
end
in this i have 20 images in y1 and for each i have found error,now i want to display image which has minimum error,please help

回答 (2 件)

Image Analyst
Image Analyst 2012 年 4 月 6 日
I think you know the basic code for keeping track of the max or min where you set the global min to some huge number (say, inf)
globalMin = inf;
and then in the loop, get the value you want the min of, and do something like
if thisMin < globalMin
% This (the current) min is less than our lowest min.
% Save this min as our new global min and keep track of the index.
% Keep track of j1, j, s1 and s2 if you need to.
globalMin = thisMin;
indexAtGlobalMin = loopIndex;
end
The code is similar if you want to find the max, just use -inf and ">" instead of "<". In your case, of course, thisMin is your "Er" variable, and you might call globalMin "lowestError" or something descriptive like that.
  3 件のコメント
Image Analyst
Image Analyst 2012 年 4 月 7 日
thisMin is your "Er" variable. The loopIndex is j1, j, s1 and s2 - whichever you want to keep track of.
kash
kash 2012 年 4 月 11 日
if Er < globalMin
% This (the current) min is less than our lowest min.
% Save this min as our new global min and keep track of the index.
% Keep track of j1, j, s1 and s2 if you need to.
globalMin = thisMin;
indexAtGlobalMin = j1;
end
i sthis correct ,then how to display image

Thomas
Thomas 2012 年 4 月 6 日
do you have your 20 error values in final_col2? assuming you do..
final_col2=rand(20,1) % I have created random data for error
final_col2 =
0.75
0.26
0.51
0.70
0.89
0.96
0.55
0.14
0.15
0.26
0.84
0.25
0.81
0.24
0.93
0.35
0.20
0.25
0.62
0.47
>>q = min(final_col2)
q =
0.14
>>p =find(final_col2==(min(final_col2)))
p =
8.00
In the above example you will find that image 8 has the minimum error..
  5 件のコメント
Image Analyst
Image Analyst 2012 年 4 月 6 日
Why couldn't you just keep track of which has the lowest error like I showed you how to do?
Thomas
Thomas 2012 年 4 月 6 日
Yes, Image Analyst's answer is the best one in this case... Just keep track of the minimum inside the loop.
@ image analyst: +1 for your answer

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by