Page 1 of 3

Fisheye 235° to equirectangular

Posted: 2017-04-20T13:00:58-07:00
by jumpjack
How can I convert a fisheye picture with FOV=235° into an equirectangular projection?

Re: Fisheye 235° to equirectangular

Posted: 2017-04-20T13:16:03-07:00
by Bonzo
You could try one of fmw42's scripts; for instance this one: http://www.fmwconcepts.com/imagemagick/ ... /index.php

Re: Fisheye 235° to equirectangular

Posted: 2017-04-20T13:29:46-07:00
by jumpjack
It looks interesting, but how can I run it in Windows?

Re: Fisheye 235° to equirectangular

Posted: 2017-04-20T13:38:56-07:00
by Bonzo
Windows 10 has a developer mode where you can run bash but I tried one of fmw42's scripts before and it came up with errors. I think it is for basic bash commands only.

Install Cygwin which might work and there are some instructions in snibgo's site: http://im.snibgo.com/cygwin.htm

Find some other software to do the job.

Re: Fisheye 235° to equirectangular

Posted: 2017-04-20T13:48:27-07:00
by jumpjack
I'm studying "Generic Mapping Tools" (GMT), Flexify Plugin, NASA G.projector, Marzipano tool,... but still can't figure out how to get what I need. :-(

Re: Fisheye 235° to equirectangular

Posted: 2017-04-20T14:00:03-07:00
by fmw42
Please identify your IM version and platform when asking questions on this forum.

Please post an example input and output image (to some free hosting service and put the URLs here). Also post any links to the camera/lens system being used.

I suspect you might want my script at http://www.fmwconcepts.com/imagemagick/ ... /index.php, which allows large FOV. The last example shows the equivalent Imagemagick commands to achieve most of what my script does and they can be run individually in Windows. See http://www.imagemagick.org/Usage/windows/ for any potential Windows vs Unix syntax issues with Imagemagick.

My scripts only run in Unix-like environments. So on Windows you would need to install Cygwin or try Windows 10.

Re: Fisheye 235° to equirectangular

Posted: 2017-04-21T01:22:17-07:00
by jumpjack
SED converter is not working on my system (Win7), it complains about some "garbage" being present in cim.txt.
I'll try with manual conversion described in last example.

Re: Fisheye 235° to equirectangular

Posted: 2017-04-21T03:31:12-07:00
by snibgo
On my Windows 8.1 computer, with Cygwin, Fred's fisheye2pano script, example 1...

Code: Select all

bash fisheye2pano -v -90,52.5 -h 211.5 -f angle testimage2.jpg out.png
... runs with no problem, and makes the expected output.

Re: Fisheye 235° to equirectangular

Posted: 2018-07-15T13:48:07-07:00
by jumpjack
I installed Linux inside Windows 10, so now I can run BASH; I copied the script directly inside Imagemagick folder, together with test image, but if I run this commmand:

Code: Select all

bash fisheye2pano -v -90,52.5 -h 211.5 -f angle test.jpg out.png
I get these errors:

Code: Select all

fisheye2pano: line 197: -h}: command not found
fisheye2pano: line 294: [: too many arguments
fisheye2pano: line 302: [: too many arguments
fisheye2pano: line 303: [: too many arguments
fisheye2pano: line 304: [: too many arguments
fisheye2pano: line 229: [: too many arguments
fisheye2pano: line 278: [: too many arguments
fisheye2pano: line 286: [: too many arguments
fisheye2pano: line 229: [: too many arguments
fisheye2pano: line 411: convert: command not found

--- FILE test.jpg DOES NOT EXIST OR IS NOT AN ORDINARY FILE, NOT READABLE OR HAS ZERO SIZE ---


basename $PROGNAME:
sed: can't read dirname $PROGNAME/basename $PROGNAME: No such file or directory
Line 197 is:

Code: Select all

PROGNAME=`type $0 | awk `{print $3}``  # search for executable on path

Re: Fisheye 235° to equirectangular

Posted: 2018-07-15T14:04:33-07:00
by fmw42
There is no "-h}" at that line in my script! Not sure what is going on. But I would suggest you test with a simple ImageMagick command line first. If that works, then try one of my simpler scripts such as 2colorthresh. But be sure you have followed my Pointers For Use on my home page at my like below. Also be sure you have all the Unix commands, such as bc, expr, type, sed, tr, etc.

I do not think you needed to install a separate Linux. Windows 10 comes with its own Unix. See the notes on my home page and especially, http://www.howtogeek.com/249966/how-to- ... indows-10/

Are you calling the script and the images from a Linux terminal or from a Windows CMD window?

Re: Fisheye 235° to equirectangular

Posted: 2018-07-16T01:20:48-07:00
by jumpjack
fmw42 wrote: 2018-07-15T14:04:33-07:00 There is no "-h}" at that line in my script!
I know, i pasted the line in my post... but it's what the command prompt says.
It also says another weird thing:

Code: Select all

--- FILE test.jpg DOES NOT EXIST OR IS NOT AN ORDINARY FILE, NOT READABLE OR HAS ZERO SIZE ---
This is not true, it's a regular JPG image which opens fine in Windows image viewer.
But this could mean my environment is not properly configured.
Not sure what is going on. But I would suggest you test with a simple ImageMagick command line first. If that works, then try one of my simpler scripts such as 2colorthresh. But be sure you have followed my Pointers For Use on my home page at my like below. Also be sure you have all the Unix commands, such as bc, expr, type, sed, tr, etc.
I'll try.
I do not think you needed to install a separate Linux. Windows 10 comes with its own Unix.
Yes I read so, but just typing "bash" in ALT+R window or in CMD window resulted in an error message redirecting to Windows Store to download Linux, so I did that.
See the notes on my home page and especially, http://www.howtogeek.com/249966/how-to- ... indows-10/
Yes, this is what I did.
Are you calling the script and the images from a Linux terminal or from a Windows CMD window?
From Windows CMD window.
But I don't know what happens when calling bash from inside CMD window: does bash use current DOS folder as its current folder or as its home folder? How do I make a Windows folder directly accessible to bash?

Re: Fisheye 235° to equirectangular

Posted: 2018-07-16T10:00:57-07:00
by fmw42
You must call the script from a Linux window, not a Windows DOS CMD window. If the script errors earlier in the argument parsing, then it may fail later with other messages about not being able to read the input image. So I would not worry about the second message. You need to run the script from a proper Linux terminal and then see if you get the -h error, which is not at the line you mention, but in the argument parsing.

Sorry I am not Windows (Unix) user, so cannot advise. But you should read more about the Windows built in Linux and how to get to its terminal window.

Re: Fisheye 235° to equirectangular

Posted: 2018-07-16T12:07:30-07:00
by jumpjack
It looks like your scripts cannot directly be used in Windows bash, they need a little tuning: when calling ImageMagick executables, script must use syntax ./FILENAME.exe rather than just the filename, and script itself must end by ".sh".

Apart from this, one version of your script which I have had characters ' and ` messed up; I downloaded it again and now they are ok.

But that's not enough:
running this command from command prompt:

Code: Select all

bash fisheye2pano_win.sh -v -90,52.5 -h 211.5 -f angle test.jpg out.png
results in these errors:

Code: Select all

line 197: type: fisheye2pano_win.sh: not found
dirname: missing operand
Try 'dirname --help' for more information.
basename: missing operand
Try 'basename --help' for more information.
fisheye2pano_win.sh: line 301: bc: command not found
fisheye2pano_win.sh: line 302: bc: command not found
fisheye2pano_win.sh: line 303: bc: command not found
fisheye2pano_win.sh: line 304: [: -eq: unary operator expected
fisheye2pano_win.sh: line 305: [: -eq: unary operator expected
fisheye2pano_win.sh: line 306: [: -eq: unary operator expected
fisheye2pano_win.sh: line 287: bc: command not found
fisheye2pano_win.sh: line 288: [: -eq: unary operator expected
fisheye2pano_win.sh: line 452: bc: command not found
fisheye2pano_win.sh: line 452: [: -eq: unary operator expected
fisheye2pano_win.sh: line 479: bc: command not found
fisheye2pano_win.sh: line 479: [: -eq: unary operator expected
Mogrify/Image/.[fisheye2pano_430.mpc]: 1 of 2, 100% complete
A little less errors appear if I run bash and then I run:

Code: Select all

fisheye2pano_win.sh -v -90,52.5 -h 211.5 -f angle test.jpg out.png

Code: Select all

line 197: type: fisheye2pano_win.sh: not found
fisheye2pano_win.sh: line 301: bc: command not found
fisheye2pano_win.sh: line 302: bc: command not found
fisheye2pano_win.sh: line 303: bc: command not found
fisheye2pano_win.sh: line 304: [: -eq: unary operator expected
fisheye2pano_win.sh: line 305: [: -eq: unary operator expected
fisheye2pano_win.sh: line 306: [: -eq: unary operator expected
fisheye2pano_win.sh: line 287: bc: command not found
fisheye2pano_win.sh: line 288: [: -eq: unary operator expected
fisheye2pano_win.sh: line 452: bc: command not found
fisheye2pano_win.sh: line 452: [: -eq: unary operator expected
fisheye2pano_win.sh: line 479: bc: command not found
fisheye2pano_win.sh: line 479: [: -eq: unary operator expected
But it looks like they are jut warnings, because then the scripts starts processing:

Code: Select all

Mogrify/Image/.[fisheye2pano_430.mpc]: 1 of 2, 100% complete
image[]: 1 of 1621, 00% complete
At the end of the processing I eventually get the equirectangular image. I have yet to test if I can properly view it in some SW, but in the meantime I have a question: is it possible for the script to add to the final image the exif data needed by Facebook (and I guess other platforms and tools) to recognize it as a panoramic photo? (called "spherical photo)
https://developers.google.com/streetvie ... l-metadata
https://developers.facebook.com/docs/gr ... nce/photo/

Second question:
which are the correct parameters to use to convert a 235° fisheyes photo into equirectangular? I don't see any "235" in the commandline I used (copied from this thread).

Re: Fisheye 235° to equirectangular

Posted: 2018-07-16T12:27:52-07:00
by fmw42
Adding .exe is not correct for Linux.

To get rid of those issue, you need to follow the directions on my home page to put the path to the scripts into your PATH environment variable. Without doing that, the script cannot use the unix type command to find the script. As you found out, those are warnings. That also allows you to run the script without using bash and from any directory. The other issue is that you need to be sure that your Windows 10 unix has all the unix tools it needs. It seems that you do not have the unix calculator, bc, installed. This was also noted on my home page about using Windows 10 unix.

Please read my home page carefully about the Pointers for Use and the Windows 10 installation notes.

ImageMagick does not have tools to add XMP or EXIF meta data. Any EXIF data would need to be added perhaps by EXIFTOOL. I am not sure it can write XMP data.

See the -h argument for the angular coverage in degrees of your fisheye. See my examples for other types of fisheye views and angular coverage.

Re: Fisheye 235° to equirectangular

Posted: 2018-07-16T12:30:49-07:00
by jumpjack
I have the windows versione of ImageMagick, it uses .exe files.

So bc command is not necessary for a proper output?

What about this error?
[: -eq: unary operator expected