We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › Image Fisheye Projection
Page Index Toggle Pages: 1
Image Fisheye Projection (Read 1860 times)
Image Fisheye Projection
Apr 14th, 2009, 1:37pm
 
Hi,
i tried to make a sketch which projects an image like a fisheye camera lens.
I searched a while how to do it and found this formula for MathMap:

filter fisheye (image in)
   in(ra:[r*r/R,a])
end
(http://www.complang.tuwien.ac.at/schani/mathmap/stills.html)
Example picture: http://www.gdargaud.net/Photo/Fisheye/20050606_FisheyeChristophe2.jpg

I don't know how to adopt it to the cartesian coodinatesystem.

Here's my basic sketch:

PImage img1;
float r;  // Radius from specific point to the middle (width/2, height/2)
float rMax;  //Max Radius = Distance from the middle to a corner

void setup()
{
 size(640, 480, P2D);
 img1 = loadImage("img.jpg");
 img1.resize(640, 480);
 rMax = dist(0, 0, width/2, height/2);
}

void draw()
{
 loadPixels();
 img1.loadPixels();
 
 for(int x=0 ; x<width; x++)
 {
   for(int y=0; y<height; y++)
   {
     r = dist(width/2, height/2, x, y);
    //pixels[y*width+x] = img1.pixels[ ... ];
   }
 }
 updatePixels();
}


Would be really nice if someone can help me!
Greetings Tim
Re: Image Fisheye Projection
Reply #1 - Apr 14th, 2009, 11:09pm
 
Maybe Re: Help: making a 'caricature' of an image is close of what you need.
Re: Image Fisheye Projection
Reply #2 - Apr 14th, 2009, 11:30pm
 
Wouldnt that be a good start for a ImageFilter/manipulation Librarie for Processing Smiley ?Does something like this already exist ?
Re: Image Fisheye Projection
Reply #3 - Apr 15th, 2009, 2:41pm
 
you might find this interesting: http://iquilezles.org/www/material/deform/deform.htm
Page Index Toggle Pages: 1