博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Cannot Change Opencv Webcam Setting
阅读量:5242 次
发布时间:2019-06-14

本文共 1777 字,大约阅读时间需要 5 分钟。

 

I have encountered a problem that when I use opencv API, I cannot change the width and height of

Webcam output:

cvSetCaptureProperty(capture, CV_CAP_PROP_FRAME_WIDTH, 320);    cvSetCaptureProperty(capture, CV_CAP_PROP_FRAME_HEIGHT, 240);

But after seaching the internet, I have found the key point:

The webcam on linux usually uses the V4L api, and I have not install the library for V4L.

When OpenCV is built, it does not includes the V4L API interface.

 

So, that's the solution:

1.install V4L dev library on ubuntu: libv4l-dev

2. enter opencv sourcecode dir, and reinstall it:

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local  -D WITH_IPP=OFF ..makesudo make install

 After using cmake, I can see the output for V4L:

--   Video I/O:--     DC1394 1.x:                  NO--     DC1394 2.x:                  NO--     FFMPEG:                      YES--       codec:                     YES (ver 53.35.0)--       format:                    YES (ver 53.21.1)--       util:                      YES (ver 51.22.2)--       swscale:                   YES (ver 2.1.0)--       gentoo-style:              YES--     GStreamer:                   NO--     OpenNI:                      NO--     OpenNI PrimeSensor Modules:  NO--     OpenNI2:                     NO--     PvAPI:                       NO--     GigEVisionSDK:               NO--     UniCap:                      NO--     UniCap ucil:                 NO--     V4L/V4L2:                    Using libv4l (ver 0.8.6)--     XIMEA:                       NO--     Xine:                        NO--

3. After you have rebuilt your program, it will work well.

I can see my 720P camera works well:

 

have fun!

(ibus not installed, can only type english on ubuntu 12.04)

转载于:https://www.cnblogs.com/tanhangbo/p/4333934.html

你可能感兴趣的文章
多进程与多线程的区别
查看>>
Ubuntu(虚拟机)下安装Qt5.5.1
查看>>
java.io.IOException: read failed, socket might closed or timeout, read ret: -1
查看>>
个人寒假作业项目《印象笔记》第一天
查看>>
java 常用命令
查看>>
CodeForces Round #545 Div.2
查看>>
卷积中的参数
查看>>
51nod1076 (边双连通)
查看>>
Item 9: Avoid Conversion Operators in Your APIs(Effective C#)
查看>>
学习Spring Boot:(二十八)Spring Security 权限认证
查看>>
IT学习神器——慕课网App获App Store、Android应用市场重磅推荐
查看>>
Linux网络状态工具ss命令使用详解
查看>>
深入浅出JavaScript(2)—ECMAScript
查看>>
编程珠玑第十一章----排序
查看>>
Face The Right Way POJ - 3276 (开关问题)
查看>>
STEP2——《数据分析:企业的贤内助》重点摘要笔记(六)——数据描述
查看>>
变量的命名规范
查看>>
手机端自动跳转
查看>>
react中进入某个详情页URL路劲参数Id获取问题
查看>>
首届.NET Core开源峰会
查看>>