displaying image
10 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(1 个)
Walter Roberson
2012-3-9
[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 个评论
Jan
2012-3-9
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
2012-3-9
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.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!