How can I implement a fisheye lens effect (barrel transformation) in MATLAB?

前端 未结 3 1773
庸人自扰
庸人自扰 2020-12-03 12:39

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

\"fisheye

One can us

3条回答
  •  情话喂你
    2020-12-03 12:53

    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):

    [I,map] = imread('logo.gif');
    [h,w] = size(I);
    
    sphere; 
    
    hS = findobj('Type','surface');
    
    hemisphere = [ones(h,w),I,ones(h,w)];
    
    set(hS,'CData',flipud(hemisphere),...
        'FaceColor','texturemap',...
        'EdgeColor','none')
    
    colormap(map)
    colordef black
    axis equal
    grid off
    set(gca,'xtick',[],'ztick',[],'ytick',[],'box','on')
    view([90 0])
    

    This will give you the circular frame you are looking for but the aliasing artifacts might be too much to deal with.

提交回复
热议问题