Welcome to Doom9's Forum, THE in-place 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.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 16th March 2015, 15:45   #1  |  Link
Kisa_AG
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 equal-area projection (this is my choise, the reason why I decided to make this function)
30 degrees - Behrmann cylindrical equal-area 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:
#### Cylindrical_Equal_Area #######
Typical usage:
ConvertToRGB32(matrix="Rec709")
Cylindrical_Equal_Area(FocalLenght=3.5, zoom=0.97, VCropping=54)
ConvertToYV12(matrix="Rec709")

Usage instruction:
1. Input color format must be RGB32
2. Set the desired StandardLatitude_Fi_s (in degrees). For the first time it's better to leave it by default.
Default value is 0 degree, it's Lambert cylindrical equal-area projection.
3. Set FocalLenght and MatrixWidth (in mm). Then you can fine tune it visually, if you want.
Default FocalLenght is 2.77mm and MatrixWidth=6.28mm, these values are for GoPro 3BE.
4. Set zoom=0, open script in VirtualDub and move forward to find the number of frame,
which have no left and right black areas.
5. Set zoom=frame_number_founded/100.
6. Set VCropping=-1, open script in VirtualDub and move forward to find the frame,
which have no top and bottom black areas between cropping lines.
Read the correct cropping value in upper left corner of picture.
7. Set VCropping=cropping value founded.

###################################

#### Mercator_Projection #######
Typical usage:
ConvertToRGB32(matrix="Rec709")
Mercator_Projection(FocalLenght=3.5, zoom=0.97, VCropping=54, Miller=True)
ConvertToYV12(matrix="Rec709")

Usage instruction:
1. Input color format must be RGB32
2. Set the desired projection - Mercator or Miller.
3. Set FocalLenght and MatrixWidth (in mm). Then you can fine tune it visually, if you want.
Default FocalLenght is 2.77mm and MatrixWidth=6.28mm, these values are for GoPro 3BE.
4. Set zoom=0, open script in VirtualDub and move forward to find the number of frame,
which have no left and right black areas.
5. Set zoom=frame_number_founded/100.
6. Set VCropping=-1, open script in VirtualDub and move forward to find the frame,
which have no top and bottom black areas between cropping lines.
Read the correct cropping value in upper left corner of picture.
7. Set VCropping=cropping value founded.

###################################
More info on functions are in ReadMe files inside ZIP archive.

And here are six pictures which shows (I hope so) the advantage of Lambert cylindrical equal-area, Mercator and Miller

projections over the standard defishing.

PS: These Lambert cylindrical equal-area, 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.
Attached Images
 
Attached Files
File Type: zip Defish_Different_Projections_v.1.1.zip (7.2 KB, 103 views)

Last edited by Kisa_AG; 17th March 2015 at 09:22. Reason: version update from 1.0 to 1.1
Kisa_AG is offline   Reply With Quote
Old 16th March 2015, 23:00   #2  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
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.
__________________
My AviSynth filters / I'm the Doctor
wonkey_monkey is offline   Reply With Quote
Old 17th March 2015, 09:26   #3  |  Link
Kisa_AG
Registered User
 
Join Date: Sep 2005
Location: Moscow, Russia
Posts: 61
Quote:
Originally Posted by davidhorman View Post
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.
Yes, it's much, MUCH faster!
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.
Kisa_AG is offline   Reply With Quote
Old 24th April 2015, 14:31   #4  |  Link
bigboss97
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
Attached Images
 
bigboss97 is offline   Reply With Quote
Old 24th April 2015, 15:45   #5  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,302
Attachment approval can take some time. You could try an external image host instead.
__________________
My AviSynth filters / I'm the Doctor
wonkey_monkey is offline   Reply With Quote
Old 24th April 2015, 15:48   #6  |  Link
Kisa_AG
Registered User
 
Join Date: Sep 2005
Location: Moscow, Russia
Posts: 61
Quote:
Originally Posted by bigboss97 View Post
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
Hello!

Sorry, I can take a look on it only on monday because I'm skiing in mountains right now.
Kisa_AG is offline   Reply With Quote
Old 26th April 2015, 01:46   #7  |  Link
bigboss97
Registered User
 
Join Date: Jul 2008
Posts: 31
Quote:
Originally Posted by Kisa_AG View Post
Sorry, I can take a look on it only on monday because I'm skiing in mountains right now.
Thanks in advance. Have a good time!

Here are some camera information from that image:
F-Number: F2.1
Focal length [mm]: 0.75
35mm focal length [mm]: 6
bigboss97 is offline   Reply With Quote
Old 6th May 2015, 05:12   #8  |  Link
bigboss97
Registered User
 
Join Date: Jul 2008
Posts: 31
Quote:
Originally Posted by Kisa_AG View Post
Sorry, I can take a look on it only on monday because I'm skiing in mountains right now.
Any update?
bigboss97 is offline   Reply With Quote
Old 6th May 2015, 08:31   #9  |  Link
Kisa_AG
Registered User
 
Join Date: Sep 2005
Location: Moscow, Russia
Posts: 61
Quote:
Originally Posted by bigboss97 View Post
Any update?
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.
Kisa_AG is offline   Reply With Quote
Old 7th May 2015, 02:10   #10  |  Link
bigboss97
Registered User
 
Join Date: Jul 2008
Posts: 31
Quote:
Originally Posted by Kisa_AG View Post
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.
Thanks.
I'll play around with the defish plug-in first. I love avisynth :-) I've used it for so many different purposes. It's really powerful.
bigboss97 is offline   Reply With Quote
Old 29th July 2020, 11:19   #11  |  Link
an3k
Registered User
 
an3k's Avatar
 
Join Date: Oct 2006
Location: Omicron Persei 8
Posts: 176
Please excuse my probably stupid question but can I use your script to "defish" into "Equirectangular" for eg. VR180 videos? What projection (degree) would I have to use? Thanks A LOT!
an3k is offline   Reply With Quote
Old 16th March 2021, 19:55   #12  |  Link
Hotte
Registered User
 
Join Date: Oct 2014
Posts: 206
x64 Version of xyremap?

I`d like to use these variants of different defish projections with AVS+. However I did not find a an x64 version of xyremap. Any ideas ?
Hotte is offline   Reply With Quote
Old 16th March 2021, 20:04   #13  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
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
__________________
My AviSynth filters / I'm the Doctor

Last edited by wonkey_monkey; 16th March 2021 at 20:08.
wonkey_monkey is offline   Reply With Quote
Old 16th March 2021, 22:14   #14  |  Link
Hotte
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 4K-fisheye 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.
Hotte is offline   Reply With Quote
Old 16th March 2021, 23:00   #15  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
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.
__________________
My AviSynth filters / I'm the Doctor

Last edited by wonkey_monkey; 16th March 2021 at 23:50.
wonkey_monkey is offline   Reply With Quote
Old 17th March 2021, 08:36   #16  |  Link
Hotte
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 x64-suggestion 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,Width-1,current_frame,lval=255).drawlines(0,FrameCount,Width-1,height-current_frame-1,0, height-current_frame-1, 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 / +")
Hotte is offline   Reply With Quote
Old 17th March 2021, 12:32   #17  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,302
Quote:
Since you seem to be a veteran of this matter
Well I did write xyremap/Remap...

Try replacing all occurences of " ^ " with " pow ".
__________________
My AviSynth filters / I'm the Doctor
wonkey_monkey is offline   Reply With Quote
Old 17th March 2021, 13:48   #18  |  Link
Hotte
Registered User
 
Join Date: Oct 2014
Posts: 206
Ahhhh - there it is!



Do you think the static parameter could contribute to performance ? Any chance to get this done ?

Thank you so much!
Hotte is offline   Reply With Quote
Old 17th March 2021, 14:39   #19  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
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.
__________________
My AviSynth filters / I'm the Doctor
wonkey_monkey is offline   Reply With Quote
Old 17th March 2021, 16:06   #20  |  Link
Hotte
Registered User
 
Join Date: Oct 2014
Posts: 206
Thanks David. Now with YV24 and static reestablished I am getting decent performance.

X64-Remap 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.
Hotte is offline   Reply With Quote
Reply

Tags
defish, fisheye, lambert, mercator, projection

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:11.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.