Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: quick way to calculate standard deviation of multiple images
Replies: 5   Last Post: Oct 10, 2012 8:35 PM

 Messages: [ Previous | Next ]
 Mike Posts: 338 Registered: 4/17/07
Re: quick way to calculate standard deviation of multiple images
Posted: Oct 10, 2012 8:33 PM

I want to generate standard deviation image from multiple images.
Thanks
Mike
On Wednesday, October 10, 2012 11:05:22 AM UTC+8, Nasser M. Abbasi wrote:
> On 10/9/2012 9:54 PM, Mike wrote:
>

> > Hi
>
> >
>
> > I have n images and want to calculate standard deviation of these images for every pixel.
>
> > My code is
>
> >
>
> > X=zeros(nrow,ncol,nimg);
>
> > for irow=1:nrow
>
> > for icol=1:ncol
>
> > tmp=X(irow,icol,:);
>
> > Xstd(irow,icol)=std2(tmp);
>
> > end
>
> > end
>
> >
>
> > It takes a lot of time to run it.
>
> > Is there a quick way to do this?
>
> > Thanks
>
> > Mike
>
> >
>
>
>
>
>
> try to pre-allocate space for 'Xstd' matrix above.
>
> Also, no need for the tmp there. Just type something like
>
>
>
> X=zeros(nrow,ncol,nimg);
>
> Xstd=zeros(nrow,ncol);
>
>
>
> for irow=1:nrow
>
> for icol=1:ncol
>
> Xstd(irow,icol)=std2(X(irow,icol,:));
>
> end
>
> end
>
>
>
> (I do not understand what you actually doing there, what
>
> do you mean by finding std for a pixel?
>
>
>
> --Nasser

Date Subject Author
10/9/12 Mike
10/9/12 Nasser Abbasi
10/10/12 Bruno Luong
10/10/12 Mike
10/10/12 Bruno Luong
10/10/12 Mike