How can one implement the fisheye lens effect illustrated in that image:
One can use Google's logo for a try:
BTW, what's the term for it?
How can one implement the fisheye lens effect illustrated in that image:
One can use Google's logo for a try:
BTW, what's the term for it?
Just for the record:
This effect is a type of radial distortion called "barrel distortion".
For more information please see:
http: //en.wikipedia.org/wiki/Distortion_(optics)
Here is a different method to apply an effect similar to barrel distortion using texture mapping (adapted from MATLAB Documentation):
This will give you the circular frame you are looking for but the aliasing artifacts might be too much to deal with.
I think you are referring to the fisheye lens effect. Here is some code for imitating fisheye in matlab.
I believe this is typically referred to as either a "fisheye lens" effect or a "barrel transformation". Here are two links to demos that I found:
Sample code for how you can apply fisheye distortions to images using the
'custom'
option for the functionmaketform
from the Image Processing Toolbox.An image processing demo which performs a barrel transformation using the function
tformarray
.Example
In this example, I started with the function
radial.m
from the first link above and modified the way it relates points between the input and output spaces to create a nice circular image. The new functionfisheye_inverse
is given below, and it should be placed in a folder on your MATLAB path so you can use it later in this example:The fisheye distortion looks best when applied to square images, so you will want to make your images square by either cropping them or padding them with some color. Since the transformation of the image will not look right for indexed images, you will also want to convert any indexed images to RGB images using
ind2rgb
. Grayscale or binary images will also work fine. Here's how to do this for your sample Google logo:Now we can create the transform with
maketform
and apply it withimtransform
(orimwarp
as recommended in newer versions):And here's the image you should see:
You can adjust the degree of distortion by changing the third value in the
options
array, which is the exponential power used in the radial deformation of the image points.