ubuntu12.04LTS下eclipse indigo版配置opencv2.4.9

1.安装依赖包

sudo apt-get install

libgtk2.0-dev

libjpeg62-dev

libtiff4-dev

libjasper-dev

libopenexr-dev

cmake

python-dev

python-numpy

libtbb-dev

libeigen2-dev

yasm

libfaac-dev

libopencore-amrnb-dev

libopencore-amrwb-dev

libtheora-dev

libvorbis-dev

libxvidcore-dev 

注:会出现libtiff4-dev依赖于libjpeg-dev


2.安装ffmpeg1.0

(1)下载ffmpeg1.0     下载地址:http://linux.linuxidc.com/         用户名和密码都是:www.linuxidc.com       具体下载目录在 /2012年资料/12月/8日/Ubuntu 安装FFmpeg1.0 ,OpenCV2.4.2

(2) 1.cd  用户主目录         注:这里是/usr/你的计算机名

           2.tar -xvf ffmpeg1.0

           3.cd ffmpeg1.0

           4.  

                 ./configure --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-libfaac --enable-libopencore-amrnb --enable-libopencore-amrwb    --enable-libtheora --enable-libvorbis --enable-libxvid --enable-x11grab --enable-swscale --enable-shared

           5. make

           6. sudo make install


3.安装opencv2.4.9

(1)下载opencv-2.4.9

(2) 1.cd  用户主目录

            2.tar -xvf opencv-2.4.9

            3. cd /opencv-2.4.9

            4.mkdir release

            5.cd  release

            6.

            cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_TBB=ON -D WITH_V4L=OFF -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON ..
            7.make

            8. sudo make install


4.添加opencv-2.4.9库的路径

       (1)  sudo gedit /etc/ld.so.conf.d/opencv.conf       注:此时虚拟终端的路径为:用户主目录 

                   加入:/usr/local/lib  然后保存

        (2) sudo ldconfig

        (3) sudo gedit /etc/environment

                    加入:PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig


5.新建一个C++项目。首先右键点击新建的项目,在项目属性的C++ Build->Settings,这里要对编译器参数进行设置。

   在GCC C++ Compiler->Directories的include paths中新增一个/usr/local/include/opencv;和/usr/local/include/opencv2


6.终端输入

pkg-config --libs opencv

我的显示如下

/usr/local/lib/libopencv_calib3d.so /usr/local/lib/libopencv_contrib.so /usr/local/lib/libopencv_core.so /usr/local/lib/libopencv_features2d.so /usr/local/lib/libopencv_flann.so /usr/local/lib/libopencv_gpu.so /usr/local/lib/libopencv_highgui.so /usr/local/lib/libopencv_imgproc.so /usr/local/lib/libopencv_legacy.so /usr/local/lib/libopencv_ml.so /usr/local/lib/libopencv_nonfree.so /usr/local/lib/libopencv_objdetect.so /usr/local/lib/libopencv_photo.so /usr/local/lib/libopencv_stitching.so /usr/local/lib/libopencv_ts.so /usr/local/lib/libopencv_video.so /usr/local/lib/libopencv_videostab.so

7.找到 GCC C++ Linker,在右侧 First in Library search path (-L) 中加入这些库

    opencv_core    opencv_highgui      opencv_ml      opencv_video   opencv_imgproc    opencv_objdetect     opencv_features2d     opencv_flann    opencv_legacy


8.结束


参考:http://www.linuxidc.com/Linux/2012-12/75640.htm

你可能感兴趣的:(eclipse,python,ubuntu,opencv,CDT)