DSPRelated.com
Forums

Determine 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 picture should be printed.

for k = 1:length(jpegFiles) % loop to run large number of pictures
filename = jpegFiles(k).name;
data = imread(filename);
y = mean(mean(data));
end
--- In i..., colenajayi@... 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 picture should be printed.
>
> for k = 1:length(jpegFiles) % loop to run large number of pictures
> filename = jpegFiles(k).name;
> data = imread(filename);
> y = mean(mean(data));
> end
>

How about you try this...
y = 0;
for k = 1:length(jpegFiles) % loop to run large number of pictures
filename = jpegFiles(k).name;
data = imread(filename);
k = mean(mean(data));
if(k>y) y = k;
end

Then y will be your desired result...Khalid Gidaya
Thanks guys.

The advice was very helpful.

Regards,
Kay
On Sat, Aug 8, 2009 at 3:58 AM, Khalid Gidaya wrote:

> --- In i... , colenajayi@...
> 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 picture should be printed.
> >
> > for k = 1:length(jpegFiles) % loop to run large number of pictures
> > filename = jpegFiles(k).name;
> > data = imread(filename);
> > y = mean(mean(data));
> > end
> > How about you try this...
> y = 0;
> for k = 1:length(jpegFiles) % loop to run large number of pictures
> filename = jpegFiles(k).name;
> data = imread(filename);
> k = mean(mean(data));
> if(k>y) y = k;
> end
>
> Then y will be your desired result...Khalid Gidaya
>
>
>