ubuntu配置opencv,测试摄像头V4L2成功

【原文:http://hi.baidu.com/huxyz1991/item/7b32140d196d05046d9048ba

我的config文件:

-- General configuration for opencv 2.3.2 =====================================

-- 

--     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:          /usr/local/bin/pdflatex

--     Build Documentation:        NO

-- 

--   Tests and samples:

--     Tests:                      YES

--     Examples:                   NO

-- 

--   Install path:                 /usr/local

-- 

--   cvconfig.h is in:            ~/Downloads/trunk/opencv/release

-- -----------------------------------------------------------------

 

其中红色部分为重点。之前摄像头无法驱动,重新编译后改动的地方为dc1394.2和v4l那个(原来显示为1/1,现在为Using libv4l)。

测试程序选用sample:camshiftdemo,可以清晰捕捉到图像。

1.配置关键在于opencv的前期安装(关于视频IO的):

apt-get install ffmpeg libavcodec-dev libavcodec52 libavformat52 libavformat-dev

apt-get install libgstreamer0.10-0-dbg libgstreamer0.10-0 libgstreamer0.10-dev 

 apt-get install libxine1-ffmpeg libxine-dev libxine1-bin 

 apt-get install libunicap2 libunicap2-dev 

 apt-get install libdc1394-22-dev libdc1394-22 libdc1394-utils 

 apt-get install swig 

 apt-get install libv4l-0 libv4l-dev 

 apt-get install python-numpy 

 apt-get install libpython2.6 python-dev python2.6-dev #You must install this for python support

2.准备完后,用svn获得最新的opencv:

cd ~/<my_working_directory> 

svn co https://code.ros.org/svn/opencv/trunk

mkdir release

cd release

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_PYTHON_SUPPORT=ON ..

sudo make

sudo make install

3.测试

g++ `pkg-config opencv --libs --cflags opencv` -o camshiftdemo camshiftdemo.cpp 

./camshiftdemo 

有BUG说缺东西的试试export LD_LIBRARY_PATH=你的lib地址
  • 2
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值