zoukankan      html  css  js  c++  java
  • 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)

  • 相关阅读:
    模块
    python运算符与表达式
    subShell与代码块
    参数展开与特殊字符
    变量和参数
    shelll Test
    Cypher查询语言--Neo4j 入门 (一)
    那些争议最大的编程观点
    大型网站架构不得不考虑的10个问题
    大型网站架构演变
  • 原文地址:https://www.cnblogs.com/tanhangbo/p/4333934.html
Copyright © 2011-2022 走看看