finding the minimum value

I have a code performing inverse dualtree dwt
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
I have 5 images w denotes it,and A1_20(:,:,j1) contains 20 matrices of ,I have multiplied those matrices,with image so for each image i get 20 images and have found error,now i want to display the image with minimum error ,like this i want to do for 5 images
please help

Risposte (2)

Sean de Wolski
Sean de Wolski il 10 Mag 2012

0 voti

Use the second output argument from min() and the correct dim input to min() to tell you where the minimum is.

1 Commento

kash
kash il 10 Mag 2012
Sean i cant understand ,please can you explain it please ,if possible with an example

Accedi per commentare.

Sargondjani
Sargondjani il 10 Mag 2012

0 voti

i have difficulty understanding your code... but lets say you have: w(:,:,1:5)
you can add another loop (iw=1:5;), store the errors in a vector: Er(iw,1).
Then
[value,index]=min(Er); %if Er is not a vector, then add the dimension (like Sean says)
w(:,:,index) gives you the matrix that minimized the error
something like that

4 Commenti

kash
kash il 11 Mag 2012
Sargondjani ,It is a for loop for wher e5 images are processed one by one,where each image is multiplied the matrix A1_20(:,:,j1),for example let us take first image,it is multiplied with A1_20(:,:,j1),so i get 20 images ,now in this i want to find the image which has minimum error and dispay,like this i have to do for 5 images,i cant understand why u used w(:,:,1:5),please provide assuistance
Sargondjani
Sargondjani il 11 Mag 2012
i didnt understand much of your question, really. because you said you 20 images, but you want to do it for 5 images.... to confusing for me...
so let's say we change 5 into 20, do you get it then?
i mean, you have to store the 20 images + errors. say im=1:20, so you have images(:,:,im) and errors(im,1).
then pick the minimum error with:
[value,index]=min(error)
now you have the index, so you just have to retrive the corresponding image: image(:,:,index)
do you understand the method???
kash
kash il 11 Mag 2012
Sargondjani i think i did not explain you well,
1.i have 5 images,i am passing it to a loop,one by one
2.ten i am multiplying each image by the matrix A1_20(:,:,j1),where this matrix contains 20 matrix values of zeros and ones,
3.so for 1st image i get 20 matices.(images),in this i want to find the image having minimum error ..
4.finally i want to do for all 5 images
Sargondjani
Sargondjani il 11 Mag 2012
do you understand my method??
i mean, i prefer not to spell out solutions, but to give exampls so you can figure out the details yourself :-)

Accedi per commentare.

Categorie

Richiesto:

il 10 Mag 2012

Community Treasure Hunt

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

Start Hunting!

Translated by