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: Sun, 24 Sep 2006 09:46:52 -0700

Chris,

Thank you for your reply.  I'll study what you wrote in
detail.  

I may have already done a bit of what you described.  

See the tilted matrix in my other replies.  What I did with
that one is added 25 rows at the start and 25 rows at the
end [half the width of the smoothing profile], filling them
with the mirror data

>> xnu(26:325,:)=x;
>> xnu(1:26,:)=x(26:-1:1,:);
>> xnu(325:350,:)=x(300:-1:275,:);
>> znu=conv2(xnu,prof,'same');
>> znu=znu(26:325,:);
>> gsplot znu;

then the edges are not too bad, well preserved.  

BUT THIS ONLY WORKS WHEN THE MEAN HAS ZERO CHANGE

Can't do anything like that for column 1 or column 101.

I wrote a program that preseves the slope, much like this
one preserved the mean.  However, it destroys the second
derivative, and so on it goes.  Just thought there might be
some "all encompassing" strategy, instead of using apriori
knowledge regarding the matrix's characteristics.  

         - Robert -

On Sun, 24 Sep 2006 08:03:50 -0400
 "Chris Zarowski" <address@hidden> wrote:
> Hello.
> 
> It sounds like your problem may be startup transients
> in filtering, since it is convolution you are doing.
> 
> I have not tried this for 2D data, but for 1D data
> a possibility is:
>   1) Signal Augmentation
>       If x[n] is length N process the following
>       signal instead
>                        2x[0] - x[-n-1]  ,  -(N+1)<=n<=-1
>        x_a[n] = 
>                        x[n]                   ,  0 <= n
> <= N-1
> 
>        The transient "dissipates itself" on the
>        added portion.   For an FIR filter of length M
>        I believe the transient duration is M. For an IIR
>        filter you need to compute the transient response
>        case-by-case. Narrowband filters will tend to
>        have longer transient responses (poles closer to
>        unit circle).
> Also, this may be combined with
>    2) Forward-Backward Filtering
>        Digital Signal Processing by Oppenheim and
>        Schafer has a problem about this.  However ...
>        If x[n] is the input signal, y[n] the output, and
>        h[n] the filter impulse response, then 
> 
>                    g[n] = h[n] * x[n]
>                    r[n] = h[n] * g[-n]
>                    y[n] = r[-n]
> 
>        The overall frequency response is 
> 
>                      | H(omega) |^{2}
> 
>         i.e., is zero-phase.
> The net result gets rid of phase distortion.
> 
> Adaptation to 2D somehow should be possible.
> 
> Cheers,
> Chris Z


reply via email to

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