displaying image
정보
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
이전 댓글 표시
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
댓글 수: 0
답변 (2개)
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
kash
2012년 4월 7일
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
2012년 4월 11일
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
kash
2012년 4월 6일
Thomas
2012년 4월 6일
Do you mean as you are running through the loop you wan to display the image with the current lowest error?
kash
2012년 4월 6일
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
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!