nonlinear antialiasing Re: [ptx] i would like to help.

Pablo d'Angelo pablo.dangelo at web.de
Tue Apr 13 09:25:07 BST 2004


Hi Juaquin,

> i want to help.  i have alot of knowledge about algorithms and mathematics.
> 
> i have had some experience with programming specialized pattern
> recognition algorithms in the 80's.  
> 
> i have been trying to see where i could add to the effort.  mabe  i could
> write a slick antialiasing algorithm.  antialiasing is important for a
> quality output.
> 
> antialiasing is a tricky subject.  especially where nonlinear projections
> are involved.  you want to filter out frequencys below 1/2 sample rate
> before sampleing,  but the nonlinear projection makes that tricky.

Jep, thats true. I haven't noticed the effect when creating full resolution
panoramas, but if the panorama is smaller, the aliasing becomes quite
visible.

> its hard to avoid two things,  a slow algorithm,  and a noisy signal.
> 
> to get a realy clean anti aliasing, you could filter the signal, then sample it.  but the nonlinear mappings make that tricky.  you could sample with a bunch of samples spread out like a sync, but then it wouldn't be clean and it would be slow.
> 
> i developed an algorithm that would be great for this application.  it
> works by filtering the input images before they are resampled and remaped.
> it uses a filter that is fast to compute and is clean and correct for the
> nonlinearitys of whatever mapping you apply.   no big convolutions.
> 
> i would like to write this code as a library or a utility.  

Great! Do you have a paper or something like that about the algorithm?

> i don't have much experiance with this modern programming environment.  i
> don't know the programmers interface and librarys that you are useing.  i
> do have alot of experience writing in C.

No problem, hope I can help out here. I'm currently reorganizing the
stitching sourcecode, will check it into cvs soon.

Basically there is one remapImage() function that loops over the image,
calculates the transformation and interpolates. (Implemented interpolation
functions are described on: http://www.path.unimelb.edu.au/~dersch/interpolator/interpolator.html )

foreach x
  foreach y
    double sx,sy;
    transform.transformImgCoord(sx,sy,x,y);
    // make sure that the interpolator doesn't
    // access pixels outside.. Should we introduce
    // some sort of border treatment?
    if (sx < interp.size/2 -1
        || sx > srcSize.x-interp.size/2 - 1
        || sy < interp.size/2 - 1
        || sy > srcSize.y-interp.size/2 - 1)
    {
      // outside source image 
      *alpha = 0;
    } else {
      // use given interpolator function.
      *remapped = interpol(src.first, sx, sy);
      *alpha = 255;
    }

that stuff is in src/include/PT/ImageTransforms.h

I'm currently working on that stuff, so please wait until I committed some
the changes (in the next days), if you want to change the source.

> the utility or library, needs as input the image and the parameters of the
> projection remaping that is to be applied,  and it needs to be able to
> output a filtered image,  of the same reolution.  basicaly i need to know
> that there is a particular tiff library.   and the library that does the
> transform from planar image to panorama image with (y,p,r,v,a,b,c).
> basically the parameters for the nonlinear mapping.

Ok, then you need the transform.transformImgCoord() function. Actually I'd
like to incorporate your library into the stitching routine, instead of
calling a separate antialias program (which we can provide nevertheless).

Do you need the complete transformation for all the pixels, when
antialiasing, or is the transformation of the current pixel (and maybe a
neighbourhood) enought?

I have been using the VIGRA image processing library, because it can easily
be adjusted to work with different image types. But its a weird pice of
software if you come straight from C.

If you don't want to use it, and perfer to work with simple C, I can write a
small program that outputs the transform for each image point (as tiff file, or
raw double matrices). Then you can use whatever library you're familiar with,
and I can port it to VIGRA, once the code is there.

> i just need help getting started with writing a little utility.  And testing it.

Once you have that library/program, I can integrate that into the nona stitcher,
and take care of that VIGRA library used inside hugin and nona.

Thanks,
  Pablo


More information about the ptX mailing list