[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:32:47 -0700 |
Soren,
Thank you for the program and the URL. I'll examine the
program's principles - it didn't work, generated error
messages regarding matching sizes...
here's a profile and a tilted matrix
try this and see:
>> prof=(1-cos(2*pi()*( (1:51)-1)/50))';
>> prof=prof-min(prof);
>> prof=prof/sum(prof);
>> x=randn((300,101)+ones(300,1)*(-50:1:50)/12;
>> y=conv2(x,prof,'same');
>> gsplot y;
you can see how the edges have been destroyed.
regarding smoothing:
1) gradients inside the matrix - very expected. The noise
is pretty gaussian and larger than the mean, magnitudes may
be more than three times. Picture sample is v1, but I have
v1+v1*randn, is about right.
2) yes, the edges get destroyed. The matrix has a complex
curve along each row, but luckily each adjacent row is very
similar, much like the tilted matrix above.
I've got some "work arounds" and they are vectorized so
fast. but I probably reinvented the wheel here. So
looking for "accepted" ways to smooth a matrix without
distorting the edges.
- Robert -
On Sun, 24 Sep 2006 10:38:42 +0200
Søren Hauberg <address@hidden> wrote:
> Hi,
> When you say "without severely distorting the edges" do
> you mean:
> 1) The border of the matrix, or
> 2) points with high gradients?
>
> In the case of 1) you can use normalised convolution
> instead of regular
> convolution. I'm attaching a simple function for this.
> In the case of 2) you should probably use some non-linear
> diffusion. A
> lot of people use the Perona-Malik algorithm, but in
> general I think the
> algorithms of Joachim Weickert work better. You can find
> an
> implementation of the Perona-Malik algorithm at
> http://www.csse.uwa.edu.au/~pk/Research/MatlabFns/
>
> Hope that helps just a little bit
>
> Søren
>