help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: need example for fisheye effect on images


From: Tim Bate
Subject: Re: need example for fisheye effect on images
Date: Sat, 22 Sep 2012 05:23:04 +1000

I'm on the road, so this might have to be a bit pseudo-code. Fish-eye should just be an extreme radial distortion. I've done radial lens distortion, so perhaps something like below. I tried writing the algorithm without for loops, but it is hard to follow.

1 Read image (imread)
2 Fill destination array with X and Y coordinates (these will be parameters to index from new back to old) so each pixel has an X and Y array element equal to its position in the array.
3 Subtract the X and Y of the center pixel. Now coordinates are relative to center.
4 Convert yo polar. Now you go from X and Y to Rho and Theta.
5 Rho2 = a*Rho^4 + b*Rho^2 + Rho, Theta2 = Theta. This is the transform. Change a and b accordingly.
6 Convert the Rho2s and Theta2s back to X and Y (reverse of above)
7 If pixel coordinate is in original image, set to original image pixel. Use interpolation as required. If not, set to black (or whatever).

That's it. You may want to scale the Rho2s before step 7. I'm not sure why only even terms are used, but that's the most common three term approximation used. Some use more terms.

On Sep 22, 2012 2:15 AM, "Andy Buckle" <address@hidden> wrote:
On 21 September 2012 16:21, paiuia <address@hidden> wrote:
> Andy and Nicholas thanks,
> I have to study the manual but in the meantime....
> any script or tutorial on mathematical deformation of images with Octave?
>
> With
> I = imread('c:\users\ax\desktop\_math\sfera.jpg');
> S = conv2 (I, ones (5, 5) / 25, "same");
> [Dx, Dy] = gradient (S);
>
> I get error:
> " error: invalid conversion of uint8 matrix to Matrix "
>
> -------------------------------
> Octave 3.2.4
> QtOctave 0.10.1
> Windows 7- 64bit

(I have not tested) but this it=s probably the answer

I =double( imread('c:\users\ax\desktop\_math\sfera.jpg'));

--
/* andy buckle */
_______________________________________________
Help-octave mailing list
address@hidden
https://mailman.cae.wisc.edu/listinfo/help-octave

reply via email to

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