First of all, it is necessary to download the source code from the following web page  http://sourceforge.net/projects/opencvlibrary/. Once downloaded and uncompressed, it is necessary to execute the ./configure command with the following options:

  • CXX=<path_gcc>/bin/arm-linux-g++ -> to choose the ARM compiler
  • --host=arm-linux --target=arm-linux -> to choose the target embedded system
  • --without-gtk --without-gthread --without-libjpeg --without-zlib --without-libpng --without-libtiff --without-libjasper --without-ffmpeg --without-raw1394 --without-v4l2 --without-python -> To exclude all the libraries which are not available in the embedded system (these libraries are not required for the correct compilation of the Open CV library itself).
  • --prefix=<path_image>/usr/ -> to choose the directory where the compiled files will be copied in the embedded system when the command make install is executed (this is optional but recomended)

Next, execute the command make to build all the Open CV libraries. This process should not report any error.

File that need to be copied to the embedded system root file system

If the --prefix option in the previous step is not included, it would be necessary to manually copy all the following files and also create the necessary soft links.

  • All the files in the /usr/include/opencv directory of the host computer to the same directory of the target system (<path_image>/usr/include/opencv).
  • The file ./opencv-1.0.0/cv/src/.libs/libcv.so.1.0.0 to the <path_image>/usr/lib directory of the target system (A compiled version for the colibri module can be found here attachment:libcv.so.1.0.0 Download)
  • The file ./opencv-1.0.0/cxcore/src/.libs/libcxcore.so.1.0.0 to the <path_image>/usr/lib directory of the target system (A compiled version for the colibri module can be found here attachment:libcxcore.so.1.0.0 Download)
  • The file ./opencv-1.0.0/others/highgui/.libs/libhighgui.so.1.0.0 to the <path_image>/usr/lib directory of the target system (A compiled version for the colibri module can be found here attachment:libhighgui.so.1.0.0 Download)
  • The file ./opencv-1.0.0/cvaux/src/.libs/libcvaux.so.1.0.0 to the <path_image>/usr/lib directory of the target system (A compiled version for the colibri module can be found here attachment:libcvaux.so.1.0.0 Download)
  • The file ./opencv-1.0.0/ml/src/.libs/libml.so.1.0.0 to the <path_image>/usr/lib directory of the target system (A compiled version for the colibri module can be found here attachment:libml.so.1.0.0 Download )

For each of the previous libraries, it is necessary to create two soft links with the following commands (in the target system directory <path_image>]/usr/lib directory):

ln -s <library name>.so.1.0.0 <library name>.so.1

ln -s <library name>.so.1 <library name>.so

Dependencies

Most of the Open CV libraries only depend on standard Linux libraries, which are normally present in any Linux distribution, even an embedded distribution. However, the highgui library depends on the following libraries:

  • libz.so.1: The source code for this library can be downloaded form the web page  http://www.zlib.net/. The instructions on how to compile it for the embedded system are here

Modifications to the configuration files

In order for the embedded Linux to find the new libraries, it is necessary to modify the file <path_rootfs>/etc/ld.co.conf adding the following two lines, which are the directories where the libraries have been copied (if the installation directories are different, change them accordingly):

/usr/lib

/lib

In order for these changes to take effect, it is necessary to execute the command ldconfig from the embedded system.

Attachments