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: Søren Hauberg
Subject: Re: Smoothing Functions without distorting matrices' edges
Date: Sun, 24 Sep 2006 19:06:08 +0200

Robert,
  There was a bug in the program I sent you (I just programmed in from
the top of my head). You need to change 
    out = (Ipad./C);
to
    out = (Ipad./C)(w(1)+1:end-w(1), w(2)+1:end-w(2));

But, looking at your example, the mentioned program doesn't solve your
problem. However, the Perona-Malik seems to solve your problem. Just
download
http://www.csse.uwa.edu.au/~pk/Research/MatlabFns/Spatial/anisodiff.m
(it's from the link I sent you earlier), and type the following:

x=randn(300,101)+ones(300,1)*(-50:1:50)/12;
y=anisodiff(x, 100, 50, 0.2, 1);

There are problems along the border of the image (matrix, if you like),
but the edges looks fairly good to me.

Søren

søn, 24 09 2006 kl. 09:32 -0700, skrev Robert A. Macy:
> 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
> > 



reply via email to

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