当前位置: 首页 > 工具软件 > VideoCapture > 使用案例 >

python opencv cv2.VideoCapture()类

钮兴安
2023-12-01

from cv2\VideoCapture.py

# encoding: utf-8
# module cv2.cv2
# from D:\20191031_tensorflow_yolov3\python\lib\site-packages\cv2\cv2.cp36-win_amd64.pyd
# by generator 1.147
""" Python wrapper for OpenCV. """

# imports
import cv2.cv2 as  # D:\20191031_tensorflow_yolov3\python\lib\site-packages\cv2\cv2.cp36-win_amd64.pyd
import cv2.Error as Error # <module 'cv2.Error'>
import cv2.cuda as cuda # <module 'cv2.cuda'>
import cv2.detail as detail # <module 'cv2.detail'>
import cv2.dnn as dnn # <module 'cv2.dnn'>
import cv2.fisheye as fisheye # <module 'cv2.fisheye'>
import cv2.flann as flann # <module 'cv2.flann'>
import cv2.instr as instr # <module 'cv2.instr'>
import cv2.ipp as ipp # <module 'cv2.ipp'>
import cv2.ml as ml # <module 'cv2.ml'>
import cv2.ocl as ocl # <module 'cv2.ocl'>
import cv2.ogl as ogl # <module 'cv2.ogl'>
import cv2.samples as samples # <module 'cv2.samples'>
import cv2.utils as utils # <module 'cv2.utils'>
import cv2.videoio_registry as videoio_registry # <module 'cv2.videoio_registry'>
import cv2 as __cv2


from .object import object

class VideoCapture(object):
    # no doc
    def get(self, propId): # real signature unknown; restored from __doc__
        """
        get(propId) -> retval
        .   @brief Returns the specified VideoCapture property
        返回指定的VideoCapture属性
        .   
        .   @param propId Property identifier from cv::VideoCaptureProperties (eg. cv::CAP_PROP_POS_MSEC, cv::CAP_PROP_POS_FRAMES, ...)
        .   or one from @ref videoio_flags_others
        propId来自cv :: VideoCaptureProperties的属性标识符
        (例如cv :: CAP_PROP_POS_MSEC,cv :: CAP_PROP_POS_FRAMES等)
        或@ref videoio_flags_others中的一个
        
        .   @return Value for the specified property. Value 0 is returned when querying a property that is
        .   not supported by the backend used by the VideoCapture instance.
        指定属性的值。 查询VideoCapture实例使用的后端不支持的属性时,返回值0。
        .   
        .   @note Reading / writing properties involves many layers. Some unexpected result might happens
        .   along this chain.
        读/写属性涉及许多层。 在此链上可能会发生一些意外的结果。
        
        .   @code {.txt}
        .   `VideoCapture -> API Backend -> Operating System -> Device Driver -> Device Hardware`
        `VideoCapture-> API后端->操作系统->设备驱动程序->设备硬件`
        
        .   @endcode
        .   The returned value might be different from what really used by the device or it could be encoded
        .   using device dependent rules (eg. steps or percentage). Effective behaviour depends from device
        .   driver and API Backend
        返回的值可能与设备实际使用的值不同,或者可以使用设备相关的规则
        (例如,步骤或百分比)对其进行编码。 有效行为取决于设备驱动程序和API后端
        """
        pass

    def getBackendName(self): # real signature unknown; restored from __doc__
        """
        getBackendName() -> retval
        .   @brief Returns used backend API name
        返回使用的后端API名称
        .   
        .   @note Stream should be opened.
        流应打开。
        """
        pass

    def grab(self): # real signature unknown; restored from __doc__
        """
        grab() -> retval
        .   @brief Grabs the next frame from video file or capturing device.
        从视频文件或捕获设备中获取下一帧。
        .   
        .   @return `true` (non-zero) in the case of success.
        如果成功,则返回“ true”(非零)。
        .   
        .   The method/function grabs the next frame from video file or camera and returns true (non-zero) in
        .   the case of success.
        该方法/函数从视频文件或摄像机中获取下一帧,并在成功的情况下返回true(非零)。
        .   
        .   The primary use of the function is in multi-camera environments, especially when the cameras do not
        .   have hardware synchronization. That is, you call VideoCapture::grab() for each camera and after that
        .   call the slower method VideoCapture::retrieve() to decode and get frame from each camera. This way
        .   the overhead on demosaicing or motion jpeg decompression etc. is eliminated and the retrieved frames
        .   from different cameras will be closer in time.
        该功能的主要用途是在多相机环境中,尤其是在相机没有硬件同步的情况下。 
        也就是说,您为每个摄像机调用VideoCapture :: grab(),
        然后调用较慢的方法VideoCapture :: retrieve()解码并从每个摄像机获取帧。 
        这样,消除了去马赛克或运动jpeg压缩等方面的开销,并且从不同摄像机检索到的帧将在时间上更近。
        .   
        .   Also, when a connected camera is multi-head (for example, a stereo camera or a Kinect device), the
        .   correct way of retrieving data from it is to call VideoCapture::grab() first and then call
        .   VideoCapture::retrieve() one or more times with different values of the channel parameter.
        另外,当连接的摄像机是多头摄像机(例如,立体摄像机或Kinect设备)时,
        从中检索数据的正确方法是先调用VideoCapture :: grab(),
        然后再调用VideoCapture :: retrieve() 使用不同的channel参数值一次或多次。
        .   
        .   @ref tutorial_kinect_openni
        """
        pass

    def isOpened(self): # real signature unknown; restored from __doc__
        """
        isOpened() -> retval
        .   @brief Returns true if video capturing has been initialized already.
        如果视频捕获已经初始化,则返回true。
        .   
        .   If the previous call to VideoCapture constructor or VideoCapture::open() succeeded, the method returns
        .   true.
        如果先前对VideoCapture构造函数或VideoCapture :: open()的调用成功,
        则该方法返回true。
        """
        pass

    def open(self, filename, apiPreference=None): # real signature unknown; restored from __doc__
        """
        open(filename[, apiPreference]) -> retval
        .   @brief  Opens a video file or a capturing device or an IP video stream for video capturing.
        打开视频文件或捕获设备或IP视频流以进行视频捕获。
        .   
        .   @overload
        .   
        .   Parameters are same as the constructor VideoCapture(const String& filename, int apiPreference = CAP_ANY)
        参数与构造函数VideoCapture相同(常量字符串和文件名,int apiPreference = CAP_ANY)
        
        .   @return `true` if the file has been successfully opened
        如果文件已成功打开,则返回“ true”
        .   
        .   The method first calls VideoCapture::release to close the already opened file or camera.
        该方法首先调用VideoCapture :: release以关闭已打开的文件或摄像机。
        
        
        
        open(index[, apiPreference]) -> retval
        .   @brief  Opens a camera for video capturing
        打开相机进行视频拍摄
        .   
        .   @overload
        .   
        .   Parameters are same as the constructor VideoCapture(int index, int apiPreference = CAP_ANY)
        参数与构造函数VideoCapture(int index,int apiPreference = CAP_ANY)相同
        
        .   @return `true` if the camera has been successfully opened.
        如果摄像机已经成功打开,则返回“ true”。
        .   
        .   The method first calls VideoCapture::release to close the already opened file or camera.
        该方法首先调用VideoCapture :: release以关闭已打开的文件或摄像机。
        """
        pass

    def read(self, image=None): # real signature unknown; restored from __doc__
        """
        read([, image]) -> retval, image
        .   @brief Grabs, decodes and returns the next video frame.
        抓取,解码并返回下一个视频帧。
        .   
        .   @param [out] image the video frame is returned here. If no frames has been grabbed the image will be empty.
        图片视频帧返回此处。 如果没有抓取帧,图像将为空。
        
        .   @return `false` if no frames has been grabbed
        如果没有抓取帧,则返回“ false”
        .   
        .   The method/function combines VideoCapture::grab() and VideoCapture::retrieve() in one call. This is the
        .   most convenient method for reading video files or capturing data from decode and returns the just
        .   grabbed frame. If no frames has been grabbed (camera has been disconnected, or there are no more
        .   frames in video file), the method returns false and the function returns empty image (with %cv::Mat, test it with Mat::empty()).
        该方法/函数在一次调用中将VideoCapture :: grab()和VideoCapture :: retrieve()组合在一起。 
        这是读取视频文件或从解码捕获数据并返回刚抓取的帧的最方便的方法。 
        如果没有抓取任何帧(相机已断开连接,或者视频文件中没有其他帧),
        则该方法返回false,并且该函数返回空图像
        (使用%cv :: Mat,使用Mat :: empty()对其进行测试 )。
        .   
        .   @note In @ref videoio_c "C API", functions cvRetrieveFrame() and cv.RetrieveFrame() return image stored inside the video
        .   capturing structure. It is not allowed to modify or release the image! You can copy the frame using
        .   cvCloneImage and then do whatever you want with the copy.
        在@ref videoio_c“ C API”中,函数cvRetrieveFrame()和cv.RetrieveFrame()
        返回存储在视频捕获结构内的图像。 禁止修改或发布图像! 
        您可以使用cvCloneImage复制框架,然后对副本进行任何操作。
        """
        pass

    def release(self): # real signature unknown; restored from __doc__
        """
        release() -> None
        .   @brief Closes video file or capturing device.
        关闭视频文件或捕获设备。
        .   
        .   The method is automatically called by subsequent VideoCapture::open and by VideoCapture
        .   destructor.
        该方法由随后的VideoCapture :: open和VideoCapture析构函数自动调用。
        .   
        .   The C function also deallocates memory and clears \*capture pointer.
        C函数还会取消分配内存并清除\ * capture指针。
        """
        pass

    def retrieve(self, image=None, flag=None): # real signature unknown; restored from __doc__
        """
        retrieve([, image[, flag]]) -> retval, image
        .   @brief Decodes and returns the grabbed video frame.
        解码并返回抓取的视频帧。
        .   
        .   @param [out] image the video frame is returned here. If no frames has been grabbed the image will be empty.
        图片视频帧返回此处。 如果没有抓取帧,图像将为空。
        
        .   @param flag it could be a frame index or a driver specific flag
        它可以是帧索引或驱动程序特定标志
        
        .   @return `false` if no frames has been grabbed
        如果没有抓取帧,则返回“ false”
        .   
        .   The method decodes and returns the just grabbed frame. If no frames has been grabbed
        .   (camera has been disconnected, or there are no more frames in video file), the method returns false
        .   and the function returns an empty image (with %cv::Mat, test it with Mat::empty()).
        该方法解码并返回刚抓取的帧。 
        如果没有抓取任何帧(相机已断开连接,或者视频文件中没有其他帧),
        则该方法返回false,并且该函数返回空图像(使用%cv :: Mat,使用Mat :: empty( ))。
        .   
        .   @sa read()
        .   
        .   @note In @ref videoio_c "C API", functions cvRetrieveFrame() and cv.RetrieveFrame() return image stored inside the video
        .   capturing structure. It is not allowed to modify or release the image! You can copy the frame using
        .   cvCloneImage and then do whatever you want with the copy.
        在@ref videoio_c“ C API”中,函数cvRetrieveFrame()和cv.RetrieveFrame()
        返回存储在视频捕获结构内的图像。 禁止修改或发布图像! 
        您可以使用cvCloneImage复制帧,然后对副本进行任何操作。
        """
        pass

    def set(self, propId, value): # real signature unknown; restored from __doc__
        """
        set(propId, value) -> retval
        .   @brief Sets a property in the VideoCapture.
        在VideoCapture中设置属性。
        .   
        .   @param propId Property identifier from cv::VideoCaptureProperties (eg. cv::CAP_PROP_POS_MSEC, cv::CAP_PROP_POS_FRAMES, ...)
        .   or one from @ref videoio_flags_others
        来自cv :: VideoCaptureProperties的属性标识符
        (例如cv :: CAP_PROP_POS_MSEC,cv :: CAP_PROP_POS_FRAMES等)
        或@ref videoio_flags_others中的一个
        
        .   @param value Value of the property.
        属性值
        
        .   @return `true` if the property is supported by backend used by the VideoCapture instance.
        如果VideoCapture实例使用的后端支持该属性,则返回true。
        
        .   @note Even if it returns `true` this doesn't ensure that the property
        .   value has been accepted by the capture device. See note in VideoCapture::get()
        即使返回“ true”,也不能确保捕获设备已接受该属性值。 
        请参阅VideoCapture :: get()中的注释
        """
        pass

    def __init__(self, *args, **kwargs): # real signature unknown
        pass

    @staticmethod # known case of __new__
    def __new__(*args, **kwargs): # real signature unknown
        """ Create and return a new object.  See help(type) for accurate signature. """
        pass

    def __repr__(self, *args, **kwargs): # real signature unknown
        """ Return repr(self). """
        pass



 类似资料: