Page 1 of 1
[solved] Reverse polar coordinates?
Posted: 2019-04-08T22:17:45-07:00
by mhulse
Hello,
I am using this to make a "tiny planet" or "fisheye" effect (source is equirectangular image):
Code: Select all
magick \
convert \
${args.input} \
-distort Arc 360 \
${args.output}
Just curious if anyone knows if there is a straight forward way of flipping that? So the sky is on the inside and the land on the outside?
I found this this amazing program:
http://www.fmwconcepts.com/imagemagick/ ... /index.php
But I kinda wanted to know if there's a more simple way of just getting the "man hole" effect without the use of a large script? Something like the above single convert statement would be cool. From reading the source of pano2fisheye it looks like there's a lot of temp files and meta data read (and math calculations) before the output is made.
Optimally, I'd love for the "man hole" effect to repeat pixels like the above polar coordinates one-liner does. For example:
Thanks for reading!
Re: Reverse polar coordinates?
Posted: 2019-04-08T22:46:34-07:00
by GeeMack
mhulse wrote: ↑2019-04-08T22:17:45-07:00Just curious if anyone knows if there is a straight forward way of flipping that? So the sky is on the inside and the land on the outside?
Rotate the image 180 degrees before the "-distort arc". Then you rotate it back the other way by adding a second argument to the "-distort arc" operation.
Code: Select all
... -rotate 180 -distort arc "360 180" ...
Optimally, I'd love for the "man hole" effect to repeat pixels like the above polar coordinates one-liner does.
You can specify the way the edge pixels act by setting "-virtual-pixel" before a "-distort" operation. By using a setting of "-virtual-pixel edge" it will continue the outermost rows of pixels to the new canvas edges. Find out more
at THIS link.
Re: Reverse polar coordinates?
Posted: 2019-04-08T23:02:52-07:00
by fmw42
Is this what you want.
Code: Select all
convert 417327148_158bf17bf1_o.jpg -resize 100x200% \
-virtual-pixel edge -distort polar 0 \
417327148_158bf17bf1_o_manhole.png
or this
Code: Select all
convert 417327148_158bf17bf1_o.jpg -rotate 180 -resize 100x200% \
-virtual-pixel edge -distort arc 360 \
417327148_158bf17bf1_o_manhole2.jpg
Re: Reverse polar coordinates?
Posted: 2019-04-08T23:17:53-07:00
by mhulse
WOW WOW and WOW!!!!!!!!
That is AMAZING. You guys are genius!
Thank you so much for the help, code examples and guidance! I owe you both several Oregon micro brews.
Thank you GeeMack and Fred!!!!
Re: Reverse polar coordinates?
Posted: 2019-04-08T23:24:33-07:00
by fmw42
Try -virtual-pixel mirror or random.
Re: Reverse polar coordinates?
Posted: 2019-04-08T23:45:38-07:00
by mhulse
fmw42 wrote: ↑2019-04-08T23:24:33-07:00
Try -virtual-pixel mirror or random.
Mind ..... BLOWN!
A M A Z I N G!
Also, this:
-distort polar 0
Does an amazing job! I love how it doesn't "pinch" the center! I'm going to try and apply that to my tiny planet effect as I love the non-pinched look so much more than the pinched.
Thank you so much!!!!!!! I'm so happy!!!!!!!!!!
Re: [solved] Reverse polar coordinates?
Posted: 2019-04-09T09:09:49-07:00
by fmw42
You can do similar with -distort arc by reducing the resize on the Height. For example
Code: Select all
convert 417327148_158bf17bf1_o.jpg -rotate 180 -resize 100x125% \
-virtual-pixel edge -distort arc 360 \
417327148_158bf17bf1_o_manhole3.jpg
Re: [solved] Reverse polar coordinates?
Posted: 2019-04-09T09:33:31-07:00
by mhulse
SO COOL! This is amazing. I am seriously blown away. Until now, I thought only a Photoshop plugin could get this kind of quality result. Thank you so much for your help Fred, I can't thank you enough for showing me all of these tricks! This is just so COOL!!!!
Re: [solved] Reverse polar coordinates?
Posted: 2019-04-15T03:08:18-07:00
by mhulse
Just wanted to say thanks again for the help!
I wrote a node module (for a larger OSS project I'm working on) that uses the code Fred posted in this thread. Here's the repo:
https://github.com/mhulse/fisheye
The above module is a work in progress for my own personal use (so, not publishing via npm). Eventually, I have plans to make a node CLI for it.
Anyway, many many thanks!