Fisheye 235° to equirectangular

A plethora of command-line scripts that perform geometric transforms, blurs, sharpens, edging, noise removal, and color manipulations.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Fisheye 235° to equirectangular

Post by fmw42 »

You cannot run the script in a Windows CMD. It must be run from a Unix terminal using Unix syntax. In unix, convert has no .exe at the end. So a Unix type ImageMagick must be first installed into the Linux part of your system and then my script can be run from the Linux terminal properly.

All you errors are likely from not having ImageMagick in your Linux system or from not installing bc in your Linux system.
jumpjack
Posts: 69
Joined: 2010-12-10T05:29:16-07:00
Authentication code: 8675308

Re: Fisheye 235° to equirectangular

Post by jumpjack »

Well, I am getting the results I need, so I am happy with it!
I don't know if I am skilled enought in Win+Lin to get a fully working, unmodified script.

Now I am playing with your other script, Fishey2Rect, and I have a question, but I opened a specific thread:
http://www.imagemagick.org/discourse-se ... =1&t=34388
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Fisheye 235° to equirectangular

Post by fmw42 »

If you are getting bc errors, then you are not likely getting proper results.
jumpjack
Posts: 69
Joined: 2010-12-10T05:29:16-07:00
Authentication code: 8675308

Re: Fisheye 235° to equirectangular

Post by jumpjack »

As far as I can understand from your source, you use BC to verify if parameters are inside allowed limits, is that right?
In such case, I've just to pay attention to what I write, but I should get right results.

Also these errors appear to be related to script robustness rather than script functionality, right?

Code: Select all

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 288: [: -eq: unary operator expected
fisheye2pano_win.sh: line 452: [: -eq: unary operator expected
fisheye2pano_win.sh: line 479: [: -eq: unary operator expected
I'll try to have a look to Cygwin, but I remember from last time I played with it years ago that it was a mess...
jumpjack
Posts: 69
Joined: 2010-12-10T05:29:16-07:00
Authentication code: 8675308

Re: Fisheye 235° to equirectangular

Post by jumpjack »

MobaXterm looks promising, I'll give a try with it.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Fisheye 235° to equirectangular

Post by snibgo »

@jumpjack: Fred's script uses the "bc" command. But you don't have it. So Fred's scripts won't work, and you get errors because variables that should have been set by bc haven't been.

Whichever variety of bash you use, if you don't have the tools that scripts expect, they won't work.
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Fisheye 235° to equirectangular

Post by fmw42 »

Also, some of my script, including this one, use bc for other things than testing arguments. Even if it was only for arguments, that would be bad if the bc test said one thing and it skipped the test and used a default value. So you would not get the correct result.
jumpjack
Posts: 69
Joined: 2010-12-10T05:29:16-07:00
Authentication code: 8675308

Re: Fisheye 235° to equirectangular

Post by jumpjack »

ok cygwin, as I remembered, is a nightmare: over 1 GB to download and configure just to have a script working...
Anyway, MobaXterm does implement BC command and no errors are raised by this command line:

Code: Select all

./fisheye2rect -o 90 -i 180 -l 500,500 400x300 test.jpg aaa.jpg
This command line:

Code: Select all

./fisheye2pano -v -90,52.5 -h 211.5 -f angle test.jpg f2p.jpg
raises these errors:

Code: Select all

(standard_in) 1: illegal character: ^M
./fisheye2pano: line 450: [: -eq: unary operator expected
Line 450:

Code: Select all

	[ `echo "$pfov >= 180" | bc` -eq 1 ] && errMsg="--- PFOV=$pfov MUST BE LESS THAN 180 DEG ---"
on line 450.

Anyway I had to edit the scripts to use the ./filename.exe syntax.

About editing, as it's very uncomfortable to have 2 pages of instructions every time there is an error in the command line, I disabled fucntions usage1 and usage2 by adding an "exit -1". Maybe showing the command syntax was useful at the beginning, 20 years ago ;-) , when your scripts had a couple of options... :-) Now I think it may be better to just show "use -h option to show command syntax".

Another note:
The above command line looks ambiguous in your page, because the font used makes no difference between character "l" and character "I".
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Fisheye 235° to equirectangular

Post by fmw42 »

Anyway I had to edit the scripts to use the ./filename.exe syntax.
I do not understand your comment here? In Windows, filename.suffix is never .exe for files. Bat scripts and Windows commands use .exe. My scripts would either be fisheye2rect or fisheye2rect.sh. You may use ./ as a prefix to the script.

So please clarify where you use ./filename.exe.

Sorry, that i and l look the same in your font. But at this time I will not change it.

A bc computation is being used for a test in line 450. If you do not have bc, then you may get an error. Your command works fine for me on my Mac OSX Sierra and IM 6.9.10.8 Q16 with no complaints about that line. I do not know why it is complaining about illegal character: ^M, since there is no M in that line, except if errMsg. The previous line at 449 tests for "$pfov" = "". If you do not have bc and the testing for whether pfov is provided in the arguments fails, then that could cause problems. I am sorry, but I just do not know how to help without making if fail.

To fix the double printout, see my home page for edits to make. That occurs on some Linux systems and not others. So I have two alternate edits for you to try, if you do not like the doubling. I will not go it and edit all my over 350 scripts to make those changes, since I do not know which version of Linux have this issue, nor which fix is needed. I do not have a universal solution other than your removing the part of the code that gives the help.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Fisheye 235° to equirectangular

Post by snibgo »

Some comments that may or may not help.

1. Bash complaining about ^M (control-M) might refer to a script that contains carriage-return as well as line-fed at a line end, perhaps because a script file has been edited in a Windows editor. Cygwin bash can be told to ignore ^M. I don't know about other bash versions.

2. .exe is a file extension for Windows EXEcutable program binaries. We don't need to add the extension when running the program from the Windows comand line or from Cygwin bash, but other versions of bash might need it. Unix traditionally has no extensions for executables.
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Fisheye 235° to equirectangular

Post by fmw42 »

Snibgo. Thanks for the comments. Your first comment is like the issue. My scripts need to be edited with a Unix text editor and not Notepad or Wordpad. As you have said, line endings are different in Windows than for Unix. Or if using a Windows editor, then all the line endings must be changed from the Windows default (\r\n) to Unix line endings (\n).
jumpjack
Posts: 69
Joined: 2010-12-10T05:29:16-07:00
Authentication code: 8675308

Re: Fisheye 235° to equirectangular

Post by jumpjack »

fmw42 wrote: 2018-07-17T12:37:27-07:00
Anyway I had to edit the scripts to use the ./filename.exe syntax.
I do not understand your comment here? In Windows, filename.suffix is never .exe for files. Bat scripts and Windows commands use .exe. My scripts would either be fisheye2rect or fisheye2rect.sh. You may use ./ as a prefix to the script.

So please clarify where you use ./filename.exe.
I'm talking about the ImageMagick executables called by the script: convert and identify ; I had to change them to ./convert.exe and ./identify.exe
(I am using ImageMagick for Windows)

fmw42 wrote: 2018-07-17T12:37:27-07:00 A bc computation is being used for a test in line 450. If you do not have bc, then you may get an error.
Using MobaXTerm linux environment, errors on missing BC commands are no more raised, hence I assume the command is present.
I don't know why I get the "[: -eq: unary operator expected" error on 450.
Before switching to MobaXTerm I got tons of them, now just one.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Fisheye 235° to equirectangular

Post by fmw42 »

Linux should not need .exe suffixes. Perhaps you have not put the path to ImageMagick in your PATH environment variable.I do not know Windows Linux, so I cannot comment. If bc is installed, then I do not know why you get that error.

I made one change to the script to see if I can get rid of that message for you. Download fisheye2pano and try it again and let me know.
jumpjack
Posts: 69
Joined: 2010-12-10T05:29:16-07:00
Authentication code: 8675308

Re: Fisheye 235° to equirectangular

Post by jumpjack »

Yes this solves the issue about unary operator.
The "^M" error remains, but I don't get why as I left the file in UNIX format as downloaded and just replaced the calls to IM executables as said.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Fisheye 235° to equirectangular

Post by fmw42 »

One more point about your use of convert.exe. Did you install ImageMagick into your Linux install or are you still trying to use your Windows install. You should have installed a Linux version of ImageMagick into your Linux system on your PC Windows 10.

I have no clue about the ^M, since I do not use a Windows PC. Did you make the script executable and the other things from my Pointers for Use on my home page?
Post Reply