iPhone and MacOS Dev

Build OpenCV on Snow Leopard

OpenCV (Open Source Computer Vision) is “a library of programming functions for real-time computer vision”.

It took me whole day yesterday to build OpenCV for my Snow Leopard. I still need to add the FFMPEG support but for now, it is turned off. I’ve followed the Mac OS X OpenCV Port doc.

svn co https://code.ros.org/svn/opencv/trunk opencv

cd opencv mkdir opencv/build cmake ..

ccmake .

Hit ‘t’ to toggle advanced mode. Set CMAKE_CXX_COMPILER=”/usr/bin/g++-4.0″ and CMAKE_C_COMPILER=”/usr/bin/gcc-4.0″. I also need to turn off FFMPEG and LIBDB1394, because I could not get them to install properly yet on Snow Leopard. Turn on the BUILD_EXAMPLE. Hit ‘c’ to configure and then ‘g’ to generate the config files and exit ccmake. make -j8 su make install To build the example, I need to change the opencv/sample/c/build_all.sh to the following: (change gcc to gcc-4.0 and g++ to g++-4.0, and also add “-arch i386″)

gcc-4.0 -arch i386 -ggdb `pkg-config opencv –cflags –libs` $base.c -o $base
g++-4.0 -arch i386 -ggdb `pkg-config –cflags opencv` -o `basename $i .cpp` $i `pkg-config –libs opencv`;

To build the c sample, just type:

./build_all.sh

Next step for me would be to build the universal library for OpenCV from Snow Leopard.

If you would like to use OpenCV with Java on Linux, check out this Walk into the Future article.

iPhone and MacOS Dev

Comments (0)

Permalink

MacOS: glibtool and glibtoolize

A typical autogen.sh (for Linux and Unix systems) script uses auto tools such as aclocal, libtool, and automake to generate necessary files for building a project. For MacOS, just replace libtool with glibtool and libtoolize with glibtoolize
#! /bin/sh
# a quick hack script to generate necessary files from
# auto* tools.
#
# WARNING: if you run this you will change the versions
# of the tools which are used and, maybe, required!
        touch Makefile.am configure.ac
{
        echo "running glibtoolize" >&2
        glibtoolize --force --copy --automake
} && {
        echo "running aclocal" >&2
        aclocal
} && {
        echo "running autoheader [ignore the warnings]" >&2
        autoheader
} && {
        echo "running automake" >&2
        automake --force-missing --foreign -a -c
} && {
        echo "running autoconf" >&2
        autoconf
} &&
        echo "autogen complete" >&2 ||
        echo "ERROR: autogen.sh failed, autogen is incomplete" >&2

iPhone and MacOS Dev

Comments (0)

Permalink

Build OpenCV for iPhone

If you are interested in building OpenCV (http://opencv.org ), Open Computer Vision Library for iPhone, follow the instructor on this great blog entry by Yoshimasa. Make sure to download his test project first. The test project contains a configure tool that helps configure the build scripts based on the SDK and OS version. I started out reading this infodan blog entry, but could not get it to work and finally had the success building OpenCV for my 3.0 device.

I am still working on the simulator.

iPhone and MacOS Dev

Comments (0)

Permalink