【问题标题】:Using OpenCV C++ interface do i need to release camera capture created with VideoCapture(int device?)使用 OpenCV C++ 接口,我是否需要发布使用 VideoCapture(int 设备?)
【发布时间】:2013-11-18 13:31:51
【问题描述】:

文档没有说什么...但是这个,但是 cvCapture 是一个 C 类型。

" 注意

In C API, when you finished working with video, release
 CvCapture structure with      cvReleaseCapture(), or 
use Ptr<CvCapture> that calls cvReleaseCapture() automa
tically in the destructor."

我认为 VideoCapture 是一个对象,但不是吗?

【问题讨论】:

    标签: c++ c opencv


    【解决方案1】:

    VideoCapture 的析构函数是

    VideoCapture::~VideoCapture() 
    {
        cap.release();
    }
    

    所以没有必要释放它。

    如果你想释放而不破坏调用 VideoCapture 对象的 release() 方法的对象,你会得到相同的效果:

    void VideoCapture::release()
    {
        cap.release();
    }
    

    【讨论】:

      猜你喜欢
      • 2017-05-08
      • 1970-01-01
      • 2013-10-01
      • 1970-01-01
      • 2011-02-28
      • 2022-07-12
      • 1970-01-01
      • 2011-01-26
      • 1970-01-01
      相关资源
      最近更新 更多