zoukankan      html  css  js  c++  java
  • opencv操作相机相关函数

    1、基本操作

    capture = cv2.VideoCapture(0)
    ret, image = capture.read()
    cv2.imwrite("photo.jpg", image)
    capture.release()

    2、相机属性设置(读、写)

    set:

    cv2.VideoCapture.set(propId, value) → retval

    cv.SetCaptureProperty(capture, property_id, value) → retval

    get:


      propId – 

        

    • CV_CAP_PROP_POS_MSEC Current position of the video file in milliseconds.
    • CV_CAP_PROP_POS_FRAMES 0-based index of the frame to be decoded/captured next.
    • CV_CAP_PROP_POS_AVI_RATIO Relative position of the video file: 0 - start of the film, 1 - end of the film.
    • CV_CAP_PROP_FRAME_WIDTH Width of the frames in the video stream.
    • CV_CAP_PROP_FRAME_HEIGHT Height of the frames in the video stream.
    • CV_CAP_PROP_FPS Frame rate.
    • CV_CAP_PROP_FOURCC 4-character code of codec.
    • CV_CAP_PROP_FRAME_COUNT Number of frames in the video file.
    • CV_CAP_PROP_FORMAT Format of the Mat objects returned by retrieve() .
    • CV_CAP_PROP_MODE Backend-specific value indicating the current capture mode.
    • CV_CAP_PROP_BRIGHTNESS Brightness of the image (only for cameras).
    • CV_CAP_PROP_CONTRAST Contrast of the image (only for cameras).
    • CV_CAP_PROP_SATURATION Saturation of the image (only for cameras).
    • CV_CAP_PROP_HUE Hue of the image (only for cameras).
    • CV_CAP_PROP_GAIN Gain of the image (only for cameras).
    • CV_CAP_PROP_EXPOSURE Exposure (only for cameras).
    • CV_CAP_PROP_CONVERT_RGB Boolean flags indicating whether images should be converted to RGB.
    • CV_CAP_PROP_WHITE_BALANCE_U The U value of the whitebalance setting (note: only supported by DC1394 v 2.x backend currently)
    • CV_CAP_PROP_WHITE_BALANCE_V The V value of the whitebalance setting (note: only supported by DC1394 v 2.x backend currently)
    • CV_CAP_PROP_RECTIFICATION Rectification flag for stereo cameras (note: only supported by DC1394 v 2.x backend currently)
    • CV_CAP_PROP_ISO_SPEED The ISO speed of the camera (note: only supported by DC1394 v 2.x backend currently)
    • CV_CAP_PROP_BUFFERSIZE Amount of frames stored in internal buffer memory (note: only supported by DC1394 v 2.x backend currently)
  • 相关阅读:
    NoteExpress 自定义参考文献输出样式
    Gabor学习笔记
    智能电视,谁的电视?谁的智能?
    智能手表的未来:独立还是附属,这是个问题!
    罗技Setpoint控制酷狗等第三方播放器
    Python中pip的SSL异常
    解决ArcPy脚本工具中文乱码问题
    文件夹exe病毒的清理
    WinRAR解压提示压缩包损坏
    网络数据集不能重命名
  • 原文地址:https://www.cnblogs.com/lulu147/p/4914044.html
Copyright © 2011-2022 走看看