Jump to content

Projective Transformation needed


Recommended Posts

Hello Forum!

 

I have a picture which looks like the source.jpg and I need the target.jpg picture.

 

I do this at the moment with the software "Luminance HDR" with the "Projective Transformation": look at the function.jpg

 

I would like to do this inside Paint.NET but I didn't found such a plugin here.

 

My question: can somebody create such a plugin or is it dificult to modify an existing "similar" plugin?

 

I maybe found also the code for this transformation at: http://searchcode.com/codesearch/view/20747084

 

 

Thanks for any suggestion,...... Annotator

post-134981-0-76339100-1390572267_thumb.

post-134981-0-26355400-1390572277_thumb.

post-134981-0-44619800-1390572518_thumb.

Link to comment
Share on other sites

Hello Annotator,

I'm not sure what you mean about the source.jpg and target .jpg - as both images are distortions already?

The first one looks like a 'fisheye' distortion - you could try Effects/distortions/ 'bulge' - I think it's a built-in effect.
The second appears to be a sinusoidal distortion  - you could try seperate bulges?

Or you could try my 'squirklewarp' plugin (link in sig), for more strange distortions!

'LuminanceHDR' looks interesting - must investigate - thanks for the tip!
 

 

Red ochre Plugin pack.............. Diabolical Drawings ................Real Paintings

 

PdnForumSig2.jpg

Link to comment
Share on other sites

I think he's trying to take a 360 degree photo (the "fisheye") and change it to a panoramic image.

I don't know of any plugins that currently do this.

EDIT: as a side note, inside out and polar transformation had some interesting results...

  • Upvote 1

No, Paint.NET is not spyware...but, installing it is an IQ test. ~BoltBait

Blend modes are like the filling in your sandwich. It's the filling that can change your experience of the sandwich. ~Ego Eram Reputo

Link to comment
Share on other sites

So I am on an Android tablet and don't have a copy of PdN handy to try it on, but have you given the Polar2Rect plugin a try?

EDIT: It's in illnab1024's pack. http://forums.getpaint.net/index.php?showtopic=8677

 

The Doctor: There was a goblin, or a trickster, or a warrior... A nameless, terrible thing, soaked in the blood of a billion galaxies. The most feared being in all the cosmos. And nothing could stop it, or hold it, or reason with it. One day it would just drop out of the sky and tear down your world.
Amy: But how did it end up in there?
The Doctor: You know fairy tales. A good wizard tricked it.
River Song: I hate good wizards in fairy tales; they always turn out to be him.

Link to comment
Share on other sites

I tried that already, david. It's basically the same result as polar transformation. Close, but no cookie.

No, Paint.NET is not spyware...but, installing it is an IQ test. ~BoltBait

Blend modes are like the filling in your sandwich. It's the filling that can change your experience of the sandwich. ~Ego Eram Reputo

Link to comment
Share on other sites

This isn't a fish-eye effect, and he's looking for a way to go from the first image to the second.

No, Paint.NET is not spyware...but, installing it is an IQ test. ~BoltBait

Blend modes are like the filling in your sandwich. It's the filling that can change your experience of the sandwich. ~Ego Eram Reputo

Link to comment
Share on other sites

A whole rep point says you can make a plugin for this :P

No, Paint.NET is not spyware...but, installing it is an IQ test. ~BoltBait

Blend modes are like the filling in your sandwich. It's the filling that can change your experience of the sandwich. ~Ego Eram Reputo

Link to comment
Share on other sites

You know he can, and probably will :lol:

Link to comment
Share on other sites

Annotator,

 

After much head scratching and thought experiments I came up with this code:

// Submenu: Distort
// Name: Reverse Fish Eye
// Title: Reverse Fish Eye - v1.0
// Author: TechnoRobbo
// URL: http://www.technorobbo.com

#region UICode
#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;
    float offx =0;
    float offy =0;

    ColorBgra CurrentPixel;

    
    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(offx,offy);
            dst[(int)x,(int)y]=CurrentPixel;  
        }
    }
}

which takes this image:

 

http://technorobbo.home.comcast.net/unfishtest.png

 

and turns it into this image (I ran the plugin then resized the width):

 

http://technorobbo.home.comcast.net/unfish2.png

 

but it would not transform you samples correctly - I think your sample's fisheye is greater than 180°.

 

the plugin is in PDN 4.0  ReverseFisheye.zip

 

If I can get my son off his computer I can compile it in 3.5

 

It's in the "Distort" menu called "Reverse Fish Eye"

Edited by TechnoRobbo
  • Upvote 5

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

You know he can, and probably will :lol:

Told ya!

+1. TechnoRobbo - are you going to release this in it's own thread?

Link to comment
Share on other sites

Like I said, it's a 360 degree image ;)

Great plugin, though! +1

No, Paint.NET is not spyware...but, installing it is an IQ test. ~BoltBait

Blend modes are like the filling in your sandwich. It's the filling that can change your experience of the sandwich. ~Ego Eram Reputo

Link to comment
Share on other sites

Dear TechnoRobo!

Dear Forum!

 

Thank's for your help.

Once again the description on other words:

 

I get an image out of our render software (pCon.planner) which is a 360 dregree panorama image, look at source-360degreePanorama.jpg.

But our panorama tour software krpano.com needs an image with another projection, look at target-afterTransformation.jpg.

At the moment I do this transformation with the software Luminance HDR, but that's inconvenient.

Then the krpano software makes out of this picture: look at demo.html which uses demo.swf

 

@TechnoRobo: I need a 100% correct transformation, otherwise the virtual tour from krpano is to bad....

 

It should be for version 3.5

Maybe the correct transformation code for this is a part in: http://searchcode.com/codesearch/view/20747084 I found this, but I am not a programmer...

 

I put all example files at: http://exch.bene.com/default.aspx?id=fa1724be-c1e8-4b22-b0c5-9b9887c9cfb4-example.zip

 

 

Thank's again to all of you!...... Annotator.

Edited by Annotator
Link to comment
Share on other sites

Ok, I get it your taken a virtual design planners rendered output (pCon) which is a spherical-type projection, used in a virtual tour for presentations, and trying to convert it into a  panorama viewer's (kprano) format which is based on stitched photographs,also a virtual tour but used typically on a webpage.

 

I thought a fish-eye lens was the source, that explains why it didn't conform. 

 

These are very specific applications more suited to a 3D app. like Blender

 

I'll research the projections types an see if I come up with something. 

 

http://pcon-planner.com/en/gallery.html#c1464

 

http://krpano.com/examples/vtour/#top

Edited by TechnoRobbo

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

I have absolutely no experience with this software but according to this link

 

http://help.pcon-planner.com/en/help/

 

you may be able to generate your image directly from pcon in the Media Maker section under "Presenting the Design"

 

Also that fisheye looking image appears (in my opinion) to be a 360° "reflection map" used to create the the reflections on the render. 

 

Scroll to the bottom of this link and you'll see why I say that. 

 

http://www.pauldebevec.com/ReflectionMapping/

Edited by TechnoRobbo
  • Upvote 1

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

Dear TechnoRobbo!

 

Yes, the pCon.planner creates this view at the end, but we export the renderjob before and make the rendering of the image on external computers (Renderslaves) and that's the point. These external renderslaves cannot convert the 360degree result at the end to the panorama view for krpano before saving the picture (like the pCon.planner).

 

And we work with these renderslaves because these compters,work in the background for 2-48 (or more) hours for the image.

Otherwise the PC would be blocked for hours and we cannot work......

 

I got the hint via Luminance HDR from the pCon guys, but as I mentiend it is a litte bit inconvenient. It would be great when we can do this only in one step and within paint.net.

 

BR Annotator

Link to comment
Share on other sites

The source image in your first post is probably a reflection (enviroment) map and may not hold enough pixel data at the edges to give good looking results. Is there a different output from p.con that could possibly be used. 

Edited by TechnoRobbo

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

In the first post was a reduced image, just for the visualisation of what I want.

In my second post I have better examples:

Link: http://exch.bene.com/default.aspx?id=fa1724be-c1e8-4b22-b0c5-9b9887c9cfb4-example.zip

 

source-360degreePanorama.jpg is the picture which I get from my renderslave and target-afterTransformation.jpg  is the image what Luminace HDR converts for krpano

 

Are these better?

Link to comment
Share on other sites

I have done research and lot's and lot's code writing and have come to this conclusion.

 

The 360° has been rendered incorrectly.

 

If you create the 360° Fisheye Image with the table top in the center then you can use Illnab's Polar to Rect Plugin to create an image that Krpano will happily convert to a tour. (Plugin Settings:Angular Offset 0, Radial Scaling 100, then resize results to double the width.)

 

You can get the plugin here Illnabs1024 Plugin Pack

 

When you process the image it will look like this - 

 

https://www.dropbox.com/s/31zik8zhse27cwb/target-afterTransformation.jpg?raw=1

 

Notice the table's in the Center. If you can produce the fisheye with the table in the center then the image will appear normal with the table at the bottom.

 

Second Solution: Krpano has a drag-n-drop tool (Convert SPHERE to CUBE droplet) that can convert the spherical image made by the PDN, into individual images that can be rotated and renamed (the key is l for left, r for right, b for back, f for front ,u for up d for down.). This requires a few steps but it should be quick

 

Here's how:

 

The results with PDN is actually a better and more accurate 3D!!!!!

 

 

 

 

EER - +1. TechnoRobbo - are you going to release this in it's own thread? 

Gosh, I guess I can - I'll need to find some public domain fisheye images. I don't own a fisheye lens.

Edited by TechnoRobbo

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

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.

×
×
  • Create New...