Installing Image libraries in mac

7 01 2010

Mac does come with OpenGL and GLUT preinstalled, But when it comes to Image processing libraries , they rely on mac specific libraries. Since my project requires a cross platform structure, i had ignore the preinstalled libraries and search for cross platform libraries. When it comes to Image Procession the most popular library is OpenCV by intel

OpenCV

OpenCV logoOpenCV is very popular and it is has the similar features of image processing as Matlab Image Processing toolbox. Installation of OpenCV is pretty straight forward. There are few binary available in the net , but most of which work only for the sample program attached in the binary. So its better to compile the framework from the source.

Installation:

Step 1: Download the Source from sourceforge

Step 2: Extract the package

Step 3: Remove the spaces present in the extracted folder name (ie rename the folder to some simple name , I use OpenCVsrc)

Step 4:Open Terminal and go to path where the OpenCV is extracted

>cd <path>/OpenCVsrc

then run the shell script

>./make_frameworks.sh

Step 5: Once this is done , a new folder is created under OpenCVsrc with the name OpenCV.framework. Copy this to the framework directory.This directory is under /Library/Frameworks.

And now the framework is available under xcode frameworks to add and compile. OpenCV for mac is available only in i386 architecture. So the architecture in Xcode needs to be changed before compilation. An alternative method to install OpenCV is to use cmake.

CImg

CImg LogoCImg is a opensource Library which provides simple classes and methods to Load/save various file formats, access pixel values, display, resize/rotate/mirror/filter and draw primitives. There are loads of classes , which makes programming with cImg easier. Buts its not as powerful as OpenCV.

CImg needs no installation, just needs ImageMagick to run. Image magick takes care of the behind the scene operations on CImg.

CImg can be downloaded , the header file can be directly used to in programs. No compilation necessary.

Program Compilation

>g++ -o <Executable name> <Program name> -O2 -L/usr/X11R6/lib -lm -lpthread -lX11

ImageMagick

ImageMagick LogoImage Magic, another opensource image processing library . This is required by CImg for compilation. This has variety of features like

Format conversion, Transform , Resize , Transparency, Draw, Animation , Special effects etc.

The installation is as follows

Step 1: Download the Binaries from imagemagick or from the ftp site

Step 2:Create (or choose) a directory to install the package into and change to that directory, for example:

$magick> cd $HOME
Step 3:Next, extract the contents of the package. For example:
$magick> tar xvfz ImageMagick-x86_64-apple-darwin10.2.0.tar.gz
Step 4:Set the MAGICK_HOME environment variable to the path where you extracted the ImageMagick files. For example:

$magick> export MAGICK_HOME=”$HOME/ImageMagick-6.5.8″
Step 5:If the bin subdirectory of the extracted package is not already in your executable search path, add it to your PATH environment variable. For example:

$magick> export PATH=”$MAGICK_HOME/bin:$PATH”
Set the DYLD_LIBRARY_PATH environment variable:
$magick> export DYLD_LIBRARY_PATH=”$MAGICK_HOME/lib”
Step 6:Finally, to verify ImageMagick is working properly, type the following on the command line:
$magick> convert logo: logo.gif
$magick> identify logo.gif
$magick> display logo.gif
Program Compilation

g++ -o <Executable Name> <Program Name> `Magick++-config –cppflags –cxxflags –ldflags –libs`

OpenCV is in i386 architecture while CImg and ImageMagick are in x86 architecture. OpenCV is dependent on third party libraries like libjpeg etc for handling various file formats, so have a backup of the libraries before modifying these libraries.

Reference:

OpenCV

CImg

ImageMagick

Advertisements




Snow Leopard arrives

30 08 2009

Just received my copy of the apples latest OS Snow Leopard

SnowLeopardThere was a lot of expectation for this OS , as its making in competetion with the MS windows 7. So was eager to see what it hold and started with started up the DVD. Well i was disappointed with this build.

  • Installation was pretty simple , Just a confirmation is asked and the process starts. First the open applications are closed and the installtion takes 50 mins to complete. Then started the computer and there were few thinks that i liked       >The new OS ran on my setting and nothing was changed except for the logon screen wallpaper all other setting were same.

>The Stacks are made scrollable , which is a pretty cool featur.

>Quicktime is now more powerful than ever. Starting with the cool borderless player , its also able to record videos , record screen , edit movies on the fly

>Realtime Icon preview, Icons can be resized in realtime and the content of the file can be viewed , even the movies can be played as they are icons. This is a neat feature for people with loads of files .

> Considerable faster application loading.

Even though theres loads of improvement , the main feature i was looking out for in this build was the exchange support. I not been able to configure the Exchange . Even the import mailbox option does not do good work in importing the mailbox from my other mail clients. Never expected such a failure from something which was advertised as the main achievement of this build .

What problems i faced after installing snow leopard

> amsn not supported in this build and it crashes.

>Yet to figure out a way to connect to exchange.

>Webcam was not detected after the install.

Some how there is no backward compatibility for amsn . it works fine with leopard but crashes on start with snow leopard. Next is the webcam . Was in for a complete surprise when the ichat couldn’t detect the webcam. At last had to reset the mac to enable cam again

To Reset the mac

>Switch off the mac

> press Shift+Alt+Control+power button  just once

> wait for 5 seconds and then power up the mac

Overall its a good build  if you are not expecting for the exchange support.