by cohenguy1 » Mon May 14, 2012 9:46 am
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