Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 709441
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T04:30:17+00:00 2026-05-14T04:30:17+00:00

How can one implement the fisheye lens effect illustrated in that image: One can

  • 0

How can one implement the fisheye lens effect illustrated in that image:

fisheye example

One can use Google’s logo for a try:

alt text

BTW, what’s the term for it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T04:30:17+00:00Added an answer on May 14, 2026 at 4:30 am

    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 function maketform 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 function fisheye_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:

    function U = fisheye_inverse(X, T)
    
      imageSize = T.tdata(1:2);
      exponent = T.tdata(3);
      origin = (imageSize+1)./2;
      scale = imageSize./2;
    
      x = (X(:, 1)-origin(1))/scale(1);
      y = (X(:, 2)-origin(2))/scale(2);
      R = sqrt(x.^2+y.^2);
      theta = atan2(y, x);
    
      cornerScale = min(abs(1./sin(theta)), abs(1./cos(theta)));
      cornerScale(R < 1) = 1;
      R = cornerScale.*R.^exponent;
    
      x = scale(1).*R.*cos(theta)+origin(1);
      y = scale(2).*R.*sin(theta)+origin(2);
      U = [x y];
    
    end
    

    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:

    [X, map] = imread('logo1w.png');  % Read the indexed image
    rgbImage = ind2rgb(X, map);       % Convert to an RGB image
    [r, c, d] = size(rgbImage);       % Get the image dimensions
    nPad = (c-r)/2;                   % The number of padding rows
    rgbImage = cat(1, ones(nPad, c, 3), rgbImage, ones(nPad, c, 3));  % Pad with white
    

    Now we can create the transform with maketform and apply it with imtransform (or imwarp as recommended in newer versions):

    options = [c c 3];  % An array containing the columns, rows, and exponent
    tf = maketform('custom', 2, 2, [], ...  % Make the transformation structure
                   @fisheye_inverse, options);
    newImage = imtransform(rgbImage, tf);   % Transform the image
    imshow(newImage);                       % Display the image
    

    And here’s the image you should see:

    enter image description here

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In Android can one use/implement a listener that fires a callback when the number
It seems advantages of using Partial NotInheritable Class is that one can declare/implement shared
How would one implement KeyListener so that I can create a two-player system where
can any one tell me how to implement a standalone java client for playing
interfaces provide a useful abstraction capability. One can have a class Foo implement some
I am starting to study map-reduce databases. How can one implement a reference in
I'm looking into Windows Azure now and wondering if one can implement a TCP/IP
In order to implement auto-vivification of Ruby hash, one can employ the following class
Possible Duplicate: How can one use multi threading in php applications Does anybody know
With WinGHCi, how can one implement the following code? soma :: Int -> Int

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.