displaying image

10 views (last 30 days)
kash
kash on 9 Mar 2012
I have 10 images
y1=imread('..') ; ; ; y10=imread('..'),
now i have mean for each image and have stored in
variable
x1,,,,,,,x10
now i want to display the image which has minimum mean value

Answers (1)

Walter Roberson
Walter Roberson on 9 Mar 2012
[minval, minidx] = min([x1,x2,x3,x4,x5,x6,x7,x8,x9,x10]);
switch (minidx)
case 1: image(x1);
case 2: image(x2);
case 3: image(x3);
[etc]
end
If that seems a bit clumsy (as it should), then considering storing your images a different way. http://matlab.wikia.com/wiki/FAQ#How_can_I_create_variables_A1.2C_A2.2C....2CA10_in_a_loop.3F
  4 Comments
Jan
Jan on 9 Mar 2012
Please follow the link Walter has posted. If you store the images in a cell like x{1}, x{2}, ... the processing is much easier. Hiding an index in the name of a variable is very inconvenient and prone to errors.
Image Analyst
Image Analyst on 9 Mar 2012
kash, as you step through it with the debugger, which case statement is it going into? Also, you might have the last case be "otherwise" instead of case 10. Also are you sure you didn't make a typo? MATLAB will create new variables dynamically and y4 is different than x4.

Sign in to comment.

Categories

Find more on Images in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!