Implement Opencv on DARwIn-OP

Dedicated to the new Dynamic Anthropomorphic Robot with Intelligence - Open Platform By Robotis and related projects
2 postsPage 1 of 1
2 postsPage 1 of 1

Implement Opencv on DARwIn-OP

Post by JaneSun » Sun May 06, 2012 10:37 pm

Post by JaneSun
Sun May 06, 2012 10:37 pm

Opencv with DARwIn-OP, anyone??

I upgraded DARwIn to ubuntu 10.10 and installed opencv2.2. Tries to opencv working with robotis source code. The plan was to ignore the vision part of the source code and use opencv only. So far, opencv has only succeeded to catch DARwIn's camera in opencv sample projects, it seems that Darwin's framework libraries conflict with opencv's. whoever comes first in the headers will cause (syntax) errors on the later one.

Scratching head for 2 days. :oops: :x
Feel free to drop me email: suncy0012@gmail.com
Thanks enormously.
Opencv with DARwIn-OP, anyone??

I upgraded DARwIn to ubuntu 10.10 and installed opencv2.2. Tries to opencv working with robotis source code. The plan was to ignore the vision part of the source code and use opencv only. So far, opencv has only succeeded to catch DARwIn's camera in opencv sample projects, it seems that Darwin's framework libraries conflict with opencv's. whoever comes first in the headers will cause (syntax) errors on the later one.

Scratching head for 2 days. :oops: :x
Feel free to drop me email: suncy0012@gmail.com
Thanks enormously.
JaneSun offline
Newbie
Newbie
Posts: 1
Joined: Sun May 06, 2012 10:38 am

Post by cohenguy1 » Mon May 14, 2012 9:46 am

Post by cohenguy1
Mon May 14, 2012 9:46 am

Here is out guide to install opencv2.2 on the darwin:

sudo apt-get install cmake g++ build-essential pkg-config cmake-qt-gui libgtk2.0-dev libavformat-dev libswscale-dev
sudo apt-get install bzip2 libavcodec-dev libavfilter-dev libjpeg-dev libtiff-dev libjasper-dev libpng-dev zlib1g-dev
sudo apt-get install libgstreamer0.10-dev libv4l-dev libxine-dev libdc1394-22-dev

extract library OpenCV-2.2.0 (from OpenCV-2.2.0.tar.bz2)
mv OpenCV-2.2.0/ ./Documents/opencv

now install ffmpeg:
http://ubuntuforums.org/showthread.php?t=786095

Just the section about ffmpeg (no need for x264 or anything else). Don't forget to install the dependencies.

This thread is about installing ffmpeg in full version. it is installed in /home/username/ffmpeg/ffmpeg_201111051415-git-1_i386.deb
You can remove it from your system anytime using:
dpkg -r ffmpeg

Building the OpenCV Directory
=======================
cd ./Documents/opencv
mkdir release
cd release/
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_PYTHON_SUPPORT=ON ..

Compile:
cd release/
make -j [num_of_threads]
make install

includes are now in: /usr/local/include/opencv
links are now in: /usr/local/lib
-- IF THIS IS NOT WORKING, REPEAT THE LAST STEP -- IF STILL NOT WORKING, run:
sudo ldconfig

configuring projects (makefile):
g++ -o my_example my_example.cpp -lopencv_core -lopencv_imgproc -lopencv_calib3d -lopencv_video
-lopencv_features2d -lopencv_ml -lopencv_highgui -lopencv_objdetect -lopencv_contrib -lopencv_legacy

OR use the pkg:
1. pkg-config opencv --libs # should print something like -lopencv_core -lopencv_imgproc ...
2. g++ -o my_example my_example.cpp `pkg-config opencv --cflags --libs`


ERRORS
========

1. If you installed opencv on your linux machine and are able to compile opencv programs but cannot run them and are receiving the following error :

error while loading shared libraries: libcxcore.so.2: cannot open shared object file: No such file or directory

This means that the program is not able to locate the shared libraries it needs to execute.
To sort this out you to have set the LD_LIBRARY_PATH environment variable to the path of your opencv lib directory.
This directory should be located in your opencv installation directory(if you installed opencv using the tar rather than using your linux distribution repositories).
You can do this by the following command (assuming you have installed opencv in your user directory in a folder named "opencv" :

export LD_LIBRARY_PATH=/home/username/Documents/opencv/release/lib
Here is out guide to install opencv2.2 on the darwin:

sudo apt-get install cmake g++ build-essential pkg-config cmake-qt-gui libgtk2.0-dev libavformat-dev libswscale-dev
sudo apt-get install bzip2 libavcodec-dev libavfilter-dev libjpeg-dev libtiff-dev libjasper-dev libpng-dev zlib1g-dev
sudo apt-get install libgstreamer0.10-dev libv4l-dev libxine-dev libdc1394-22-dev

extract library OpenCV-2.2.0 (from OpenCV-2.2.0.tar.bz2)
mv OpenCV-2.2.0/ ./Documents/opencv

now install ffmpeg:
http://ubuntuforums.org/showthread.php?t=786095

Just the section about ffmpeg (no need for x264 or anything else). Don't forget to install the dependencies.

This thread is about installing ffmpeg in full version. it is installed in /home/username/ffmpeg/ffmpeg_201111051415-git-1_i386.deb
You can remove it from your system anytime using:
dpkg -r ffmpeg

Building the OpenCV Directory
=======================
cd ./Documents/opencv
mkdir release
cd release/
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_PYTHON_SUPPORT=ON ..

Compile:
cd release/
make -j [num_of_threads]
make install

includes are now in: /usr/local/include/opencv
links are now in: /usr/local/lib
-- IF THIS IS NOT WORKING, REPEAT THE LAST STEP -- IF STILL NOT WORKING, run:
sudo ldconfig

configuring projects (makefile):
g++ -o my_example my_example.cpp -lopencv_core -lopencv_imgproc -lopencv_calib3d -lopencv_video
-lopencv_features2d -lopencv_ml -lopencv_highgui -lopencv_objdetect -lopencv_contrib -lopencv_legacy

OR use the pkg:
1. pkg-config opencv --libs # should print something like -lopencv_core -lopencv_imgproc ...
2. g++ -o my_example my_example.cpp `pkg-config opencv --cflags --libs`


ERRORS
========

1. If you installed opencv on your linux machine and are able to compile opencv programs but cannot run them and are receiving the following error :

error while loading shared libraries: libcxcore.so.2: cannot open shared object file: No such file or directory

This means that the program is not able to locate the shared libraries it needs to execute.
To sort this out you to have set the LD_LIBRARY_PATH environment variable to the path of your opencv lib directory.
This directory should be located in your opencv installation directory(if you installed opencv using the tar rather than using your linux distribution repositories).
You can do this by the following command (assuming you have installed opencv in your user directory in a folder named "opencv" :

export LD_LIBRARY_PATH=/home/username/Documents/opencv/release/lib
cohenguy1 offline
Newbie
Newbie
Posts: 3
Joined: Sun Oct 09, 2011 1:50 pm


2 postsPage 1 of 1
2 postsPage 1 of 1
cron