Welcome to Doom9's Forum, THE inplace to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. 
16th March 2015, 15:45  #1  Link  
Registered User
Join Date: Sep 2005
Location: Moscow, Russia
Posts: 61

"Defish" with different map projections
I made few functions which make defish with different map projections, like Lambert Cylindrical Equal Area, Mercator and Miller
projections. These function are based on xyremap, thanks davidhorman for such a powerful filter! Right now there are two different functions ready. Both these functions available in ZIP archive attached. Current version: 1.1 Here is the direct link: https://www.dropbox.com/s/il7g2lh39s...v.1.1.zip?dl=0 ####################### CHANGE LIST: 16/03/2015 v1.0  First release 17/03/2015 v1.1  Core plugin (xyremap v0.2) changed to v0.3 due to great speed improvements (up to 40x). ####################### It's Cylindrical_Equal_Area.avsi and Mercator_Projection.avsi. The first one makes the following projections depending on the Standard Latitude settings: 0 degrees  Lambert cylindrical equalarea projection (this is my choise, the reason why I decided to make this function) 30 degrees  Behrmann cylindrical equalarea projection 37.383 degrees  Tristan Edwards projection 44.138 degrees  Peters projection 45 degrees  Gall orthographic projection 50 degrees  Balthasart projection The second one makes Mercator and Miller projections depending on "Miller" settings. There are special features which helps to find right zoom and crop values to get output picture without black areas around it. Quote:
And here are six pictures which shows (I hope so) the advantage of Lambert cylindrical equalarea, Mercator and Miller projections over the standard defishing. PS: These Lambert cylindrical equalarea, Miller and Mercator projections are very suitable for defishing of 4:3 frames because the output frame is very close to 16:9 apect rate and it's not necessary to crop big parts of picture. PPS: Special thanks to Edgar from MathMap Google group! His letter about different projections (https://groups.google.com/forum/#!to...ap/9aL2CqC8eDA) saved me a huge amount of time for formulation and debugging. Last edited by Kisa_AG; 17th March 2015 at 09:22. Reason: version update from 1.0 to 1.1 

16th March 2015, 23:00  #2  Link 
Formerly davidh*****
Join Date: Jan 2004
Posts: 2,302

You should try your functions with the new version of xyremap (new URL, the old version is still at the old URL), and add "static=true" to the parameter list when you call it. You should find it a lot quicker.

17th March 2015, 09:26  #3  Link  
Registered User
Join Date: Sep 2005
Location: Moscow, Russia
Posts: 61

Quote:
Up to 40 times on my GoPro 3BE 2.7K @25p files! Incredebly! Thnaks, davidhorman! I've updated functions and changed links in the first post. 

24th April 2015, 14:31  #4  Link 
Registered User
Join Date: Jul 2008
Posts: 31

I'm attaching an image from my Ricoh Theta camera. Would you be able to give me some advice how I can apply the defish function?
There are 2 "eyes" :) So I assume the image cannot be flatten as one. My aim is to simulate camera pan 360, i.e. there is always only one part of the image visible. Thanks 
24th April 2015, 15:48  #6  Link  
Registered User
Join Date: Sep 2005
Location: Moscow, Russia
Posts: 61

Quote:
Sorry, I can take a look on it only on monday because I'm skiing in mountains right now. 

6th May 2015, 08:31  #9  Link 
Registered User
Join Date: Sep 2005
Location: Moscow, Russia
Posts: 61

Sorry, I have no idea what can be done with it.
It seems to me that photos has been defished during panorama creation. I would suggest you to take a look on Hugin  panorama creation tool, there are many different projections there for all kind of panorams. 
7th May 2015, 02:10  #10  Link  
Registered User
Join Date: Jul 2008
Posts: 31

Quote:
I'll play around with the defish plugin first. I love avisynth :) I've used it for so many different purposes. It's really powerful. 

16th March 2021, 20:04  #13  Link 
Formerly davidh*****
Join Date: Jan 2004
Posts: 2,302

Give this a try. I changed its name to just Remap so you'll have to edit Kisa_AG's scripts accordingly.
http://horman.net/avisynth/download/Remap.zip Last edited by wonkey_monkey; 16th March 2021 at 20:08. 
16th March 2021, 22:14  #14  Link 
Registered User
Join Date: Oct 2014
Posts: 206

Thanks a lot, David.
Unfortunately I am getting only a pure black clip with Miller=false and all parameters on their defaults. I altered some of the parms but only black is being returned. Input is 4Kfisheye footage that used to work well. Don`t know whats wrong. I had to remove the static parameter since it does not seem to be supported by remap. 
16th March 2021, 23:00  #15  Link 
Formerly davidh*****
Join Date: Jan 2004
Posts: 2,302

Ah, sorry about that. It's very much a work in progress  clearly only a subset of features are working as they should. You could try replacing any occurences of "PI" with "3.14159265359" and any occurences of "TAU" with "6.28318530718" but I haven't tried the scripts myself so there could be other problems.
Edit: actually the issue may be the use of capital W/H. Try replacing them with w/h. Last edited by wonkey_monkey; 16th March 2021 at 23:50. 
17th March 2021, 08:36  #16  Link 
Registered User
Join Date: Oct 2014
Posts: 206

I replaced capital W/H and PI (no TAU) but same blackness. This is the core of the code from Mercator_Projection() where my changes applied. Complex  eh?
Don't want to force, just like this type of projection. My actual intention is a projection where defishing is only being done vertically ("banana doors") and less or not for horizontal lines ("pitfall tables"). I was not able to get this while playing with the parameters of the plugins around. Since you seem to be a veteran of this matter I`d be happy to receive any other x64suggestion for how to get there... Code:
Right=remap(x="2 "+f+" * "+exp+" 2 "+MK+" * y h 2 /  * "+f+" "+zoom+" * / ^ 1  2 "+exp+" "+MK+" y h 2 /  * "+f+" "+zoom+" * / ^ * / atan "+MK+" / cos x w 2 /  "+f+" / "+zoom+" / sin * 2 ^ "+exp+" 2 "+MK+" * y h 2 /  * "+f+" "+zoom+" * / ^ 1  2 "+exp+" "+MK+" y h 2 /  * "+f+" "+zoom+" * / ^ * / atan "+MK+" / sin 2 ^ + sqrt asin 2 / sin * "+exp+" 2 "+MK+" * y h 2 /  * "+f+" "+zoom+" * / ^ 1  2 "+exp+" "+MK+" y h 2 /  * "+f+" "+zoom+" * / ^ * / atan "+MK+" / sin "+exp+" 2 "+MK+" * y h 2 /  * "+f+" "+zoom+" * / ^ 1  2 "+exp+" "+MK+" y h 2 /  * "+f+" "+zoom+" * / ^ * / atan "+MK+" / cos x w 2 /  "+f+" / "+zoom+" / sin * / atan cos * w 2 / +", y="2 "+f+" * "+exp+" 2 "+MK+" * y h 2 /  * "+f+" "+zoom+" * / ^ 1  2 "+exp+" "+MK+" y h 2 /  * "+f+" "+zoom+" * / ^ * / atan "+MK+" / cos x w 2 /  "+f+" / "+zoom+" / sin * 2 ^ "+exp+" 2 "+MK+" * y h 2 /  * "+f+" "+zoom+" * / ^ 1  2 "+exp+" "+MK+" y h 2 /  * "+f+" "+zoom+" * / ^ * / atan "+MK+" / sin 2 ^ + sqrt asin 2 / sin * "+exp+" 2 "+MK+" * y h 2 /  * "+f+" "+zoom+" * / ^ 1  2 "+exp+" "+MK+" y h 2 /  * "+f+" "+zoom+" * / ^ * / atan "+MK+" / sin "+exp+" 2 "+MK+" * y h 2 /  * "+f+" "+zoom+" * / ^ 1  2 "+exp+" "+MK+" y h 2 /  * "+f+" "+zoom+" * / ^ * / atan "+MK+" / cos x W 2 /  "+f+" / "+zoom+" / sin * / atan sin * h 2 / +") Right=(VCropping==1) ? \ ScriptClip(Right.crop(Width/2,0,0,0),"drawlines(1,FrameCount,0,current_frame,Width1,current_frame,lval=255).drawlines(0,FrameCount,Width1,heightcurrent_frame1,0, heightcurrent_frame1, lval=255)") \ : Right.crop(Width/2,VCropping,0,VCropping) #Left half of picture Left=remap(x="2 "+f+" * "+exp+" 2 "+MK+" * y h 2 /  * "+f+" "+zoom+" * / ^ 1  2 "+exp+" "+MK+" y h 2 /  * "+f+" "+zoom+" * / ^ * / atan "+MK+" / cos x w 2 /  "+f+" / "+zoom+" / sin * 2 ^ "+exp+" 2 "+MK+" * y h 2 /  * "+f+" "+zoom+" * / ^ 1  2 "+exp+" "+MK+" y h 2 /  * "+f+" "+zoom+" * / ^ * / atan "+MK+" / sin 2 ^ + sqrt asin 2 / sin * "+exp+" 2 "+MK+" * y h 2 /  * "+f+" "+zoom+" * / ^ 1  2 "+exp+" "+MK+" y h 2 /  * "+f+" "+zoom+" * / ^ * / atan "+MK+" / sin "+exp+" 2 "+MK+" * y h 2 /  * "+f+" "+zoom+" * / ^ 1  2 "+exp+" "+MK+" y h 2 /  * "+f+" "+zoom+" * / ^ * / atan "+MK+" / cos x w 2 /  "+f+" / "+zoom+" / sin * / atan 3.14159265359 + cos * w 2 / +", y="2 "+f+" * "+exp+" 2 "+MK+" * y h 2 /  * "+f+" "+zoom+" * / ^ 1  2 "+exp+" "+MK+" y h 2 /  * "+f+" "+zoom+" * / ^ * / atan "+MK+" / cos x w 2 /  "+f+" / "+zoom+" / sin * 2 ^ "+exp+" 2 "+MK+" * y h 2 /  * "+f+" "+zoom+" * / ^ 1  2 "+exp+" "+MK+" y h 2 /  * "+f+" "+zoom+" * / ^ * / atan "+MK+" / sin 2 ^ + sqrt asin 2 / sin * "+exp+" 2 "+MK+" * y h 2 /  * "+f+" "+zoom+" * / ^ 1  2 "+exp+" "+MK+" y h 2 /  * "+f+" "+zoom+" * / ^ * / atan "+MK+" / sin "+exp+" 2 "+MK+" * y h 2 /  * "+f+" "+zoom+" * / ^ 1  2 "+exp+" "+MK+" y h 2 /  * "+f+" "+zoom+" * / ^ * / atan "+MK+" / cos x w 2 /  "+f+" / "+zoom+" / sin * / atan 3.14159265359 + sin * h 2 / +") 
17th March 2021, 14:39  #19  Link 
Formerly davidh*****
Join Date: Jan 2004
Posts: 2,302

I've added static as a parameter. Same link:
http://horman.net/avisynth/download/Remap.zip You should also get a speed increase (and slightly better quality) by using ConverttoYV24 instead of ConverttoRGB32. 
17th March 2021, 16:06  #20  Link 
Registered User
Join Date: Oct 2014
Posts: 206

Thanks David. Now with YV24 and static reestablished I am getting decent performance.
X64Remap in conjunction with Kisa_AG's script has brought the alternative projections back to stage. Great work, thanks guys! Last edited by Hotte; 17th March 2021 at 16:08. 
Tags 
defish, fisheye, lambert, mercator, projection 
Thread Tools  Search this Thread 
Display Modes  

