Cannot Change Opencv Webcam Setting

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 ..
make
sudo 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)

时间: 2024-08-26 02:05:01

Cannot Change Opencv Webcam Setting的相关文章

Install postfix on Ubuntu 14.04.txt

Ubuntu 14.04上安装和配置Postfix邮件服务详细教程 Postfix: 用来接受和发送邮件的邮件服务器,正确说法应该叫邮件传送代理(Mail Transfer Agent,MTA),是邮件服务最重要的部分:    Dovecot: POP 和 IMAP 服务器,用来管理本地邮件目录以便用户能通过 Mail.app, Thunderbird, Mutt 等邮件客户端(又叫邮件用户代理 Mail User Agent, MUA)登陆和下载邮件:    Postgrey: 邮件灰名单工具

Price Control V or S in Material Type (Price control in material master )

When is it useful to use the price control V or S in Material Master?  Do I have to follow the SAP standard setting in the material type for the following material types: - ROH (Raw materials) -> moving average price - HALB (Semifinished products) ->

ifconfig

命令格式: ifconfig [-v] [-a] [-s] [interface] ifconfig [-v] interface [aftype] options | address ... 配置网络接口 选项: -a     显示当前所有可获取的网络接口信息,包括状态为down的接口 -s     已短列表方式显示(类似 netstat -i) -v     be more verbose for some error conditions interface 网络接口名称 up     T

uC/OS-II内核的服务文件

/***********************************************************************************************************                                               uC/OS-II*                                         The Real-Time Kernel**                       

chrome http Request Header 修改插件

chrome http Request Header 修改插件 2013-05-31 11:03:03|  分类: JavaScript |  标签:chrome  extensions  change  http  header  |举报|字号 订阅 下载LOFTER我的照片书  | 最近因为需要搞 Chrome 的浏览器插件,所以了解了 Chrome Extensions 的一些基本知识.Chrome 插件都可以在以下目中找到. C:\Users\YouName\AppData\Local\

Xcode常见报错解决办法

这里总结了几个常见的Xcode报错以及解决办法,希望对大家学习Xcodehttp://www.maiziedu.com/course/234/有所帮助. 1. 死存储问题 CocoaChina CocoaChina CocoaChina 这个问题上篇文章提到过,之所以重新罗列出来,是因为这个问题也挺常见的.导致这个问题的原因是,当我们对某个对象直接赋值之后,如果包含这个对象的方法立马就结束了,那么这个对象就会被自动释放,但是我们本身根本还没有用到它,所以就形成了一个死存储代码,这个赋值语句其实也

Query runs slow via .NET

Slow in the Application, Fast in SSMS?Understanding Performance Mysteries An SQL text by Erland Sommarskog, SQL Server MVP. Last revision: 2013-08-30.This article is also available in Russian, translated by Dima Piliugin. Introduction When I read var

ModSecurity web application firewall (WAF) Research

catalog 0. 引言 1. OWASP ModSecurity Core Rule Set (CRS) Project 2. Installation mod_security for Apache 3. Installation mod_security for nginx 4. Installation mod_security for IIS 5. mod_security Configuration Directives 6. Processing Phases 7. Variab

Ubuntu 13.10 PHP 5.5.x mcrypt missing – Fatal Error: Undefined function mcrypt_encrypt()!

[原文]http://www.tuicool.com/articles/goto?id=myM7veR I had updgraded my Ubuntu from 13.04 to 13.10 last week and everything went quite good. The only problems that I faced as developer are: Apache 2.4 was not working with default previous installation