From: mops zaki on
i have to do normalization...for it first i have to calculate mean and variance of the image
i use M = mean(I5(:)) ; to calculate mean...but the size of image reduce to 1x1 after mean.. WAT I HAVE DONE WRONG

MY FULL CODE IS..
clear all
image=imread('0001hv1.bmp');
%Designing guasian filter%%%%%%%%%%%%%%%%%%(LOW PASS)
sigma=0.8;
H=fspecial('gaussian',[5 5],sigma);
I5=imfilter(image,H);
figure(2),imshow(I5);
M = mean(I5(:)) ;

HELP ME PLZ
From: Wayne King on
"mops zaki" <zaki_achi(a)hotmail.com> wrote in message <htdm05$kgj$1(a)fred.mathworks.com>...
> i have to do normalization...for it first i have to calculate mean and variance of the image
> i use M = mean(I5(:)) ; to calculate mean...but the size of image reduce to 1x1 after mean.. WAT I HAVE DONE WRONG
>
> MY FULL CODE IS..
> clear all
> image=imread('0001hv1.bmp');
> %Designing guasian filter%%%%%%%%%%%%%%%%%%(LOW PASS)
> sigma=0.8;
> H=fspecial('gaussian',[5 5],sigma);
> I5=imfilter(image,H);
> figure(2),imshow(I5);
> M = mean(I5(:)) ;
>
> HELP ME PLZ

Hi, did you just intend to calculate the mean of each column in the image? Then, just enter:

M = mean(I5);

Your line
M = mean(I5(:));
is equivalent to
M = mean(mean(I5));
you're calculating the mean of the column means. That's why it's a scalar.

Wayne
From: Sean on
"mops zaki" <zaki_achi(a)hotmail.com> wrote in message <htdm05$kgj$1(a)fred.mathworks.com>...
> i have to do normalization...for it first i have to calculate mean and variance of the image
> i use M = mean(I5(:)) ; to calculate mean...but the size of image reduce to 1x1 after mean.. WAT I HAVE DONE WRONG
>
> MY FULL CODE IS..
> clear all
> image=imread('0001hv1.bmp');
> %Designing guasian filter%%%%%%%%%%%%%%%%%%(LOW PASS)
> sigma=0.8;
> H=fspecial('gaussian',[5 5],sigma);
> I5=imfilter(image,H);
> figure(2),imshow(I5);
> M = mean(I5(:)) ;

The mean of a vector is always going to be a scalar. What else would you expect?
Is this what you're trying to do?
http://bigwww.epfl.ch/demo/jlocalnormalization/index.html

If so; you're not going to want the mean of the whole image(:) but rather local means.

Also note 'sigma' is a built-in function
From: mops zaki on
"Wayne King" <wmkingty(a)gmail.com> wrote in message <htdo7e$ej4$1(a)fred.mathworks.com>...
> "mops zaki" <zaki_achi(a)hotmail.com> wrote in message <htdm05$kgj$1(a)fred.mathworks.com>...
> > i have to do normalization...for it first i have to calculate mean and variance of the image
> > i use M = mean(I5(:)) ; to calculate mean...but the size of image reduce to 1x1 after mean.. WAT I HAVE DONE WRONG
> >
> > MY FULL CODE IS..
> > clear all
> > image=imread('0001hv1.bmp');
> > %Designing guasian filter%%%%%%%%%%%%%%%%%%(LOW PASS)
> > sigma=0.8;
> > H=fspecial('gaussian',[5 5],sigma);
> > I5=imfilter(image,H);
> > figure(2),imshow(I5);
> > M = mean(I5(:)) ;
> >
> > HELP ME PLZ
>
> Hi, did you just intend to calculate the mean of each column in the image? Then, just enter:
>
> M = mean(I5);
>
> Your line
> M = mean(I5(:));
> is equivalent to
> M = mean(mean(I5));
> you're calculating the mean of the column means. That's why it's a scalar.
>
> Wayne


hi i want to calculate mean of whole image....ofter calulating mean i have to subtract the mean image from the original one....
From: mops zaki on
"Sean " <sean.dewolski(a)nospamplease.umit.maine.edu> wrote in message <htdoms$ftr$1(a)fred.mathworks.com>...
> "mops zaki" <zaki_achi(a)hotmail.com> wrote in message <htdm05$kgj$1(a)fred.mathworks.com>...
> > i have to do normalization...for it first i have to calculate mean and variance of the image
> > i use M = mean(I5(:)) ; to calculate mean...but the size of image reduce to 1x1 after mean.. WAT I HAVE DONE WRONG
> >
> > MY FULL CODE IS..
> > clear all
> > image=imread('0001hv1.bmp');
> > %Designing guasian filter%%%%%%%%%%%%%%%%%%(LOW PASS)
> > sigma=0.8;
> > H=fspecial('gaussian',[5 5],sigma);
> > I5=imfilter(image,H);
> > figure(2),imshow(I5);
> > M = mean(I5(:)) ;
>
> The mean of a vector is always going to be a scalar. What else would you expect?
> Is this what you're trying to do?
> http://bigwww.epfl.ch/demo/jlocalnormalization/index.html
>
> If so; you're not going to want the mean of the whole image(:) but rather local means.
>
> Also note 'sigma' is a built-in function


thanx sean...but i want mean of entire image...becuze this mean image would be subractes from original image....

zaki