Jump to content

TR's Reverse Fisheye v1.0


Recommended Posts

TechnoRobbo's Reverse Fisheye v1.0

Removes or reduces the fisheye distortion to produce a panoramic image.

 

This plugin was developed while assisting another user. It got some reps and downloads so I decided to publish it.

There were 2 algorithms I developed - Linear and Circular. Which one you use is up to you.

 

 

 
Image Attributions:
Jimee at en.wikipedia
Cezary Piwowarski
National Aeronautics and Space Administration 

 

ReverseFish.png?raw=1

 

The Codelab Source Code (for programmers)

Hidden Content:

// Submenu: Distort
// Name: TR's ReverseFishEye
// Title: TR's ReverseFishEye - v1.0
// Author: TechnoRobbo
// URL: http://www.technorobbo.com

#region UICode
byte Amount1 = 0; // [1] Reverse Type|Linear|Circular
#endregion

void Render(Surface dst, Surface src, Rectangle rect)
{
  
    Rectangle selection = EnvironmentParameters.GetSelection(src.Bounds).GetBoundsInt();
    double CenterX = ((selection.Right - selection.Left) / 2)+selection.Left;
    double CenterY= ((selection.Bottom - selection.Top) / 2)+selection.Top;

    double offx ,offy ,u, v;

    ColorBgra CurrentPixel;

    if (Amount1==1){
        
        for (float y = rect.Top; y < rect.Bottom; y++)
        {
            for (float x = rect.Left; x < rect.Right; x++)
            {
                //find direction and distance
                
                u = (x - CenterX ) / CenterX ;
                v = (y - CenterY ) / CenterY ;
    
                double wide = Math.Sqrt(1 - v * v);
                wide = wide * u * CenterX ;
    
                offx =wide + CenterX;
                offy =y;
    
    
                CurrentPixel = src.GetBilinearSample((float)offx,(float)offy);
                dst[(int)x,(int)y]=CurrentPixel;  
            }
        }
    }else{
        for (float y = rect.Top; y < rect.Bottom; y++)
        {
            for (float x = rect.Left; x < rect.Right; x+=.5f)
            {
                //find direction and distance
                double maxradx = x-CenterX ;
                double maxrady = y-CenterY;
                double howfar = Math.Sqrt(maxradx * maxradx + maxrady * maxrady);
                double dirz =  Math.Atan2(maxrady,maxradx);
                double mymax = maxradx *  Math.Tan(dirz);
                double maxfar = Math.Sqrt(CenterX * CenterX + mymax * mymax);
                double normal =  howfar/maxfar;
                offx = (float)(CenterX +  Math.Cos(dirz) * CenterX * normal);
                offy = (float)(CenterY +  Math.Sin(dirz) * CenterY * normal);
                
                CurrentPixel = src.GetBilinearSample((float)offx,(float)offy);
                dst[(int)x,(int)y]=CurrentPixel;
  
            }
        }
    }
   
}

 

The Plugin

ReverseFisheye.zip

 

PDN 3.5 version ReverseFisheye35.zip

Edited by TechnoRobbo
  • Upvote 2

Go out there and be amazing. Have Fun, TR
TRsSig.png?raw=1
Some Pretty Pictures Some Cool Plugins

Link to comment
Share on other sites

  • 2 years later...
  • 4 years later...

NO  ,THAT IS THE ONE i DO  HAVE.. tHE ONE  i need keeps it fiheye effect as   .PING IMAGE ,AND  then I change its shape to my desired effect. I have downloaded  this fisheye but it will just not go into plugin effect. The other  ones did the same and oddly finally made it into effects. I don't know  why this fisheye is giving me so much trouble. It was in my plugins before. It is by far my favorite " fisheye " effect. But I will press on till I get it. Thanks Pixey.

 By the way Pixey, do you develop and create plugins too?

 

Edited by Cakie67
Link to comment
Share on other sites

@Cakie67 If you have the Reversed Fisheye already, then it must be this one:

 

 

Are you sure you are putting the .dlls into the Effects Folder that you made after you downloaded the Store Bought version of Paint.net?  You know you had to make your own folder for them? 

 

" a folder in Documents called "paint.net App Files" then a set of sub-folders including one called Effects."

 

1 hour ago, Cakie67 said:

By the way Pixey, do you develop and create plugins too?

 

No, I'm not into that - too much script and lines for me to digest 🤪

30b8T8B.gif

How I made Jennifer & Halle in Paint.net

My Gallery | My Deviant Art

"Rescuing one animal may not change the world, but for that animal their world is changed forever!" anon.

 
Link to comment
Share on other sites

Yes dear. you are so sweet..,   I did everything Red Ochre told me to do. today i was making a  Desert art  design . just to see if everything was working like I need. Gridwarp would shut down my Paint.Net I lost everything  of my design and had to start over. Gridwarp  I got installed, but it does not work. I was completely lost in making this design without " Distort Fisheye, and Gridwarp and Reshape .dll. here is the design, title " Desert Dreaming".. I was playing around with BoltBaits new " effect Dream. I do like that. 

Deasert Dreaming.jpg

  • Upvote 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...