DSPRelated.com
Forums

Determine highest mean from set of images

Started by cole...@gmail.com August 7, 2009
I want determine the picture with the highest mean from a set of images loaded into matlab as matrix. The code is below. I want to know the exact picture with the highest mean so as to make it as a basis for further calculation. This should be printed out.

for k = 1:length(jpegFiles) % loop to run large number of pictures
filename = jpegFiles(k).name;
data = imread(filename);
y = mean(mean(data));
end
Hello,

The code you have seems pretty good, I would suggest making the 'y' variable
a vector. y(k). Make sure for speed to reallocate the space for the
variable. Then you can use the Max function to give the max mean and the
indices which it belongs to.

I think that should work,

LM

On Thu, Aug 6, 2009 at 9:22 AM, wrote:

> I want determine the picture with the highest mean from a set of images
> loaded into matlab as matrix. The code is below. I want to know the exact
> picture with the highest mean so as to make it as a basis for further
> calculation. This should be printed out.
>
> for k = 1:length(jpegFiles) % loop to run large number of pictures
> filename = jpegFiles(k).name;
> data = imread(filename);
> y = mean(mean(data));
> end
>
>