help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Smoothing Functions without distorting matrices' edges


From: Robert A. Macy
Subject: Re: Smoothing Functions without distorting matrices' edges
Date: Mon, 25 Sep 2006 09:17:13 -0700

Yes, I pad the matrix by adding rows, [shown in a previous
email response] but I have to add two sets of a number of
rows equal to half the size of the smoothing profile to get
decent effect.

This works very, very well *IF* the mean of the matrix has
no slope, or curvature, to it.  And I verified the noise
appears to increase at the edges by the expected sqrt(2)

Remember, the values in the matrix are buried in some
energetic noise, value=value+randn, where value is -1 to 1
and randn peaks can be over -3 to 3  thus you see the
problem with smoothing inappropriately.  

I have an iterative program that smooths when there is a
slope present, but it destroys the second derivative, just
like conv2 does to a simple slope.  

Not sure I need to preserve all the derivatives, but hoped
for a "general" solution that might preserve the curvatures
better.  

               - Robert -

On Mon, 25 Sep 2006 09:20:46 -0400 (EDT)
 Przemek Klosowski <address@hidden> wrote:
>    This may be slightly OT, but maybe someone may know an
> easy
>    function to do this - smooth a matrix without severely
>    distorting the edges.  
> 
> Perhaps pad the matrix, and smooth it? 
> 
> a=[1 2 3; 4 5 6; 7 8 9];
> b=zeros(size(a)+2);
> b(2:end-1,2:end-1)=a;
> 
> Even better, duplicate the edge values before smoothing:
> 
> b(2:end-1,1)=a(1:end,1);
> b(1,1)=a(1,1) 
> 
> etc. for the other three edges. By the way, can anyone
> think of a
> simpler way of doing that?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]