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 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 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
Image 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
Funny and Creative Programmers comments
Programming is always a stressed work. But it still is fun and creative. Here are some of the programmers comments collected during stumbling. Starting with my favourite
//
// Dear maintainer:
//
// Once you are done trying to ‘optimize’ this routine,
// and have realized what a terrible mistake that was,
// please increment the following counter as a warning
// to the next guy:
//
// total_hours_wasted_here = 16
//
=======
#define TRUE FALSE
//Happy debugging suckers
========
//You are not expected to understand the following
and
//If you can’t do pointer math in your sleep, while
//driving a car backwards on the freeway,
//you shouldn’t change this routine.
and
//Yes, this is stupid. no it wasn’t planned. Drunken
//Lemurs change the spec every day. Check your mail.
//US Postal mail, not email. They’re not that advanced.
========
//Don’t touch it or ninja will punish you
========
//Dear future me. Please forgive me.
//I can’t even begin to express how sorry I am.
========
// I don’t know why I need this, but it stops the people being upside-down
x = -x;
========
return 1; // returns 1
========
Exception up = new Exception(“Something is really wrong.”);
throw up; //ha ha
=======
//When I wrote this, only God and I understood what I was doing
//Now, God only knows
=======
// I dedicate all this code, all my work, to my wife, Darlene, who will
// have to support me and our three children and the dog once it gets
// released into the public.
=======
// sometimes I believe compiler ignores all my comments
=======
Proves not to screw with programmers
.
Source:Google,rachvela,stackoverflow.
General
Programming
Creative Programmer Comment
Humor
Programmer
Programmer Comment