A. Installing the dependencies on Debian Squeeze
1. CMake
sudo apt-get install cmake
2. pkg-config
sudo apt-get install pkg-config
3. GTK
sudo apt-get install libgtk2.0-cil libgtk2.0-cil-dev
sudo apt-get install libgtk2.0-0 sudo apt-get install libgtk2.0-dev
sudo apt-get install libgtk2.0-0 sudo apt-get install libgtk2.0-dev
4. Miscellaneous dependencies
sudo apt-get install swig
sudo apt-get install libjpeg62 libjpeg62-dev
sudo apt-get install libtiff4 libtiff4-dev
sudo apt-get install libjasper1 libjasper-dev 
sudo apt-get install libpng12-0 libpng-dev
sudo apt-get install zlib1g zlib1g-dev
sudo apt-get install openexr
sudo apt-get install ffmpeg
sudo apt-get install libgstreamer0.10-0 libgstreamer0.10-dev
sudo apt-get install libv4l-0 libv4l-dev
sudo apt-get install libxine1 libxine-dev
sudo apt-get install libunicap2 libunicap2-dev
sudo apt-get install libdc1394-22 libdc1394-22-dev
sudo apt-get install libavcodec52 libavcodec-dev
sudo apt-get install libavutil49 libavutil-dev
sudo apt-get install libpostproc51 libpostproc-dev
sudo apt-get install libswscale0 libswscale-dev
sudo apt-get install libavfilter0 libavfilter-dev
B. Download the libcv libraries and untar it on a local directory. You can download it from here: http://opencv.willowgarage.com/wiki/
C. Compiling the libcv library and headers
cd /home/javier/Desktop/OpenCV-2.3.1/
mkdir release
cd release
cmake D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_EXAMPLES=ON ..
My results:
-- General configuration for opencv 2.3.1 =====================================
-- 
--     Built as dynamic libs?:     YES
--     Compiler:                   /usr/bin/c++
--     C++ flags (Release):          -Wall -pthread -march=i686 -ffunction-sections  -O3 -DNDEBUG  -fomit-frame-pointer -msse -msse2 -mfpmath=387 -DNDEBUG 
--     C++ flags (Debug):            -Wall -pthread -march=i686 -ffunction-sections  -g  -O0 -DDEBUG -D_DEBUG -ggdb3 
--     Linker flags (Release):
--     Linker flags (Debug):
-- 
--   GUI: 
--     GTK+ 2.x:                   YES
--     GThread:                    YES
-- 
--   Media I/O: 
--     ZLib:                       YES
--     JPEG:                       TRUE
--     PNG:                        TRUE
--     TIFF:                       TRUE
--     JPEG 2000:                  TRUE
--     OpenEXR:                    NO
--     OpenNI:                     NO
--     OpenNI PrimeSensor Modules: NO
--     XIMEA:                      NO
-- 
--   Video I/O:
--     DC1394 1.x:                 NO
--     DC1394 2.x:                 YES
--     FFMPEG:                     YES
--       codec:                    YES
--       format:                   YES
--       util:                     YES
--       swscale:                  YES
--       gentoo-style:             YES
--     GStreamer:                  NO
--     UniCap:                     NO
--     PvAPI:                      NO
--     V4L/V4L2:                   Using libv4l
--     Xine:                       NO
-- 
--   Other third-party libraries:
--     Use IPP:                    NO
--     Use TBB:                    NO
--     Use ThreadingFramework:     NO
--     Use Cuda:                   NO
--     Use Eigen:                  NO
-- 
--   Interfaces:
--     Python:                     YES
--     Python interpreter:         /usr/bin/python2.6 -B (ver 2.6)
--     Python numpy:               YES
--     Java:                       NO
-- 
--   Documentation:
--     Sphinx:                     NO
--     PdfLaTeX compiler:          NO
--     Build Documentation:        NO
-- 
--   Tests and samples:
--     Tests:                      YES
--     Examples:                   YES
-- 
--   Install path:                 /usr/local
-- 
--   cvconfig.h is in:             /home/javier/Desktop/OpenCV-2.3.1/release
-- -----------------------------------------------------------------
-- General configuration for opencv 2.3.1 =====================================
-- 
--     Built as dynamic libs?:     YES
--     Compiler:                   /usr/bin/c++
--     C++ flags (Release):          -Wall -pthread -march=i686 -ffunction-sections  -O3 -DNDEBUG  -fomit-frame-pointer -msse -msse2 -mfpmath=387 -DNDEBUG 
--     C++ flags (Debug):            -Wall -pthread -march=i686 -ffunction-sections  -g  -O0 -DDEBUG -D_DEBUG -ggdb3 
--     Linker flags (Release):
--     Linker flags (Debug):
-- 
--   GUI: 
--     GTK+ 2.x:                   YES
--     GThread:                    YES
-- 
--   Media I/O: 
--     ZLib:                       YES
--     JPEG:                       TRUE
--     PNG:                        TRUE
--     TIFF:                       TRUE
--     JPEG 2000:                  TRUE
--     OpenEXR:                    NO
--     OpenNI:                     NO
--     OpenNI PrimeSensor Modules: NO
--     XIMEA:                      NO
-- 
--   Video I/O:
--     DC1394 1.x:                 NO
--     DC1394 2.x:                 YES
--     FFMPEG:                     YES
--       codec:                    YES
--       format:                   YES
--       util:                     YES
--       swscale:                  YES
--       gentoo-style:             YES
--     GStreamer:                  NO
--     UniCap:                     NO
--     PvAPI:                      NO
--     V4L/V4L2:                   Using libv4l
--     Xine:                       NO
-- 
--   Other third-party libraries:
--     Use IPP:                    NO
--     Use TBB:                    NO
--     Use ThreadingFramework:     NO
--     Use Cuda:                   NO
--     Use Eigen:                  NO
-- 
--   Interfaces:
--     Python:                     YES
--     Python interpreter:         /usr/bin/python2.6 -B (ver 2.6)
--     Python numpy:               YES
--     Java:                       NO
-- 
--   Documentation:
--     Sphinx:                     NO
--     PdfLaTeX compiler:          NO
--     Build Documentation:        NO
-- 
--   Tests and samples:
--     Tests:                      YES
--     Examples:                   YES
-- 
--   Install path:                 /usr/local
-- 
--   cvconfig.h is in:             /home/javier/Desktop/OpenCV-2.3.1/release
-- -----------------------------------------------------------------
D. Installing the libraries and headers
make
sudo make install
sudo make install
E. Our first opencv project with Eclipse
1. Open Eclipse and add a new 'Hello World' C++ project
3. For our first project we will just open and display an image. Include the following code in your main method:
Note that it is supposed that it exists a picture called 'gnu-linux.jpg' on the folder /home/javier/Desktop/
Compile your project and run it. If you have have problems running your project:
error while loading shared libraries: libmytestsharedlibrary.so: cannot open shared object file: No such file or directory
Create the following file :
/etc/ld.so.conf.d/opencv.conf
Add the following line:
/usr/local/lib
And execute the following command:
sudo ldconfig
Explanations about all this process can be found as well in my previous post.
If everything went ok the system should have prompted your picture:
RESOURCES
Books:
http://www.amazon.com/Learning-OpenCV-Computer-Vision-Library/dp/0596516134
http://www.packtpub.com/opencv-2-computer-vision-application-programming-cookbook/book
Webs
http://opencv.willowgarage.com/wiki/
 
 
 
 
 
 




 
 
 
 
 
 
 
 
 
 
0 comments:
Post a Comment