|Spare Time Labs 2.0|
PIC CDC ACM
Fun with HC08
Java Goes Native
Gas Fired Furnace
Down Memory Lane
Camera Calibration Toolbox for Octave
Here are some notes I jotted down when adapting 'Camera Calibration Toolbox for Matlab' for use with Octave. I've cleaned them up a bit and whipped up a this webpage to help myself and others later when I need to re-visit this issue.
Octave, in case you did not know, is a Free (in every sense of the word) Matlab clone that is able to run most Matlab scripts. Matlab is great tool for matrix math that has been around for years. It used to be reasonably priced but nowdays the price is extraorbitant and predatory and the licensing policy leaves a lot to be desired for, especially if all you need is to run some little nice script (like the Toolbox here) that some good man (or woman for that matter) has made available on the net. Fortunately we have a good alternative: Octave.
Octave is available for Mac OS X, Linux and Windows. Since I'm mainly a Mac user the following has some Mac specific notes but a lot of the info here is totally generic as Octave scripts are pretty much platform agnostic. I used Octave version 3.0.3, for which you can download the Mac OS X pre-build version of Octave from octave.sourceforge.net, which also includes gnuplot that you will need. However, before going that route and downloading it here you may want to read more.
The Camera Calibration Toolbox uses some features that are not part of the basic Octave distribution. Most of the missing parts can be found from Octave Forge. However, I found that the easiest way to install Octave AND all the other necessary gear is through MacPorts. This is not the fastest way to install Octave as this involves building the code on your machine but it was the only way in which I was able to get all the necessary parts to install without resorting to hacking.
Without further ado, after installing MacPorts the following should install everything you need to run Camera Calibration Toolbox. Open the terminal and enter following commands:
sudo port install octave
sudo port install gnuplot
sudo port install octave-plot
sudo port install octave-image
sudo port install imagemagick
sudo port install octave sudo port install gnuplot sudo port install octave-plot sudo port install octave-image sudo port install imagemagick
(I'm not 100% sure if
Next download the Toolbox archive, uncompress it somewhere and add the directory to your path. To do that you can edit your profile (type open ~/.bash_profile) and add a line like:
or you can just (temporarily) add it to the Octave path from within Octave shell with
Most of the Toolbox code runs pretty much as-is which is a testimony to the Octave Matlab compatibility. The one part that does not run is the main function
You will probabply want to go through the 'First calibration example' described on the Toolbox home page. The first step is to read in the images. The documentation tells you to click the 'Image names' button. Peeping inside the 'calib_gui_normal.m' file you'll see that function name is actualy
parse error near line 282 of file /Users/nyholku/TOOLBOX_calib/click_ima_calib.m
>>> zoom on;
parse error near line 282 of file /Users/nyholku/TOOLBOX_calib/click_ima_calib.m syntax error >>> zoom on;
There is a similar issue with 'rotate3d on'. Just delete it. With above instructions you should be able to work through most of the camera calibration.
You will also get the something like following when running
which is because Octave does not (yet) have the
You can ignore this as the plot that this function is supposed to create is already generated and visible when the error occurs. To get rid of the error just delete everything after line 195 or thereabouts. Of course you will not be able to use buttons that the
Many thanks for Jean-Yves Bouguet for making the Toolbox publicly available and kudos to all the good folks in the GNU Octave project.