Sure you can have the code, but you will need MATLAB to run it...
MATLAB is great, but it is expensive. GNU Octave is a very
viable alternative. Octave runs under Linux, Windows and Mac OS X.
With the release of Octave 3 many of the remaining
incompatibilities between Octave and MATLAB have been eliminated and
the graphics much improved. Plotting and image display may not be as
fast or as polished as it is under MATLAB but you can do pretty well
everything you want to. Most of your MATLAB code will run under
Octave with no modifications required.
You will also find that Octave has a number of features that are
improvements on MATLAB. For example you can create stand-alone
executable scripts, you can write sin(x)(1:10); rather than being
forced to write y = sin(x); y = y([1:10]); and you can specify default
argument values for functions, to name a few.
The installation of Octave is straightforward and the installation of
packages (Octave's equivalent of MATLAB toolboxes) has been
I suggest you check the following links
Please do not mail me about any Octave installation problems, I
will not know how to help you. You should refer to the appropriate FAQ
A few gotchas to look out for
This list of gotchas is diminishing all the time and very few remain...
- Display of colour images can be washed out. This seems to be
caused by the rgb colormap having only 64 entries. If I create a 256
element colormap images are displayed fine. At least this is what I
find with my Mac OSX installation.
- Some image processing toolbox functions test the input image
against the function isgray which, if your data is of type
double, only returns true if all values lie in the range [0 1]. If
you get an error message saying your gray scale image is not a gray
scale image you probably need to rescale its values to [0 1].
- I have found on odd occasions (that I have difficulty replicating)
that the SVD in 'economy' mode can sometimes be too economical and I
lose a dimension in the decomposed matrices.
Notes on code modifications to provide Octave compatibility
In general very few modifications have been needed, indeed recently I
have been able to remove many of the Octave specific modifications. I
would like to thank Carnë Draug for checking over, and improving,
the Octave compatibility of many of the functions. In a few cases I
have had to create slightly different execution paths for Octave and
MATLAB. To detect whether the code is running under Octave I am using
the following test (thanks to Rosen Diankov and subsequent improvement
by Carnë Draug for this).
Octave = exist('OCTAVE_VERSION', 'builtin') == 5;
While MATLAB allows one to pass string arguments to functions without
enclosing quotes and brackets, for example
this is not (always) allowed under Octave. However, by writing code in the
proper functional form such as
compatibility under both MATLAB and Octave can be maintained. With
Octave 3 this problem is mostly eliminated.
With the earier versions of Octave there was a bit of fiddling around
required to get things to work. I wrote a number of functions to
allow execution of my code under Octave. With Octave 3 they are no
longer needed. Listed below are a few of these functions, you may
possibly want the placeholder functions.
- fspecial.m replacement for
MATLAB fspecial. Note the current image package now has an
implementation of fspecial (which incorporates some of this
code). This link is just here for historical reference.
- truesize.m Placeholder function that
does nothing except allow code written for MATLAB handle-graphics to
at least execute under Octave.
- pixval.m Placeholder
- rotate3d.m Placeholder