Saturday, November 10, 2012

Compile Octave using 16/32 bits colour - Ubuntu


  Hello there,

  This post is a little different of I'm using to write, but yet very useful for us engineers! It's about how to compile octave to be able to load 16 or 32 bits colour images. First of all, what's Octave?
  Octave is a gnu version of Matlab (and it almost compatible with it. Actually most of commands are identical, so migrating for Matlab to Octave should not be very hard. The official site is here!
  Ok, what's the problem? The problem is that Octave uses GraphicsMagick (an image processing program) and by default it comes configured in 8bits in Ubuntu. So, we need to recompile GraphicsMagick to use 16 or 32 bits and then recompile Octave with the new GraphicsMagick. I'm using Ubuntu 12.04, Octave-3.6.3 and GraphicsMagick-1.3.12.
  Here you are the steps:
  1) Download all packages needed.
sudo apt-get install g++ gcc gfortran make libblas-dev liblapack-dev libpcre3-dev libreadline-dev libarpack2-dev libcurl4-gnutls-dev libfftw3-dev libfltk-dev libfontconfig1-dev libfreetype6-dev libglpk-dev libgraphicsmagick++-dev gnuplot libhdf5-serial-dev libgl-dev libqhull-dev libqrupdate-dev libsuitesparse-dev texinfo zlib1g-dev libgraphicsmagick++1-dev libgraphicsmagick++3
  2) Download GraphicsMagick source from Ubuntu repository
wget https://launchpad.net/ubuntu/precise/+source/graphicsmagick/1.3.12-1.1build1/+files/graphicsmagick_1.3.12.orig.tar.gz
  3) Configure and install GraphicsMagick.If you want 16 bits set --with-quantum-depth=16!
tar zxvf graphicsmagick_1.3.12.orig.tar.gz
cd GraphicsMagick-1.3.12
./configure  --with-quantum-depth=32 --enable-shared --disable-static --with-magick-plus-plus=yes
make
sudo make install
  4) Set GraphicsMagick libs path
export PATH=$PATH:/usr/local/lib
  5) Download Octave
wget ftp://ftp.gnu.org/gnu/octave/octave-3.6.3.tar.gz
  6) Configure and install Octave
tar zxvf octave-3.6.3.tar.gz
cd octave-3.6.3
./configure --prefix=/usr/local/octave  --with-blas="-L/usr/lib -lblas" --with-lapack="-L/usr/lib -llapack" --with-fftw3f-libdir=/usr/local/fftw/lib --with-fftw3-includedir=/usr/local/fftw/include --without-curl --enable-shared --disable-static
make
sudo make install
  Here some links that can help you if you have any problems:
GraphicsMagick wiki
Discussed in forum

  Bye
 Marcelo

No comments:

Post a Comment