简体   繁体   中英

Using OpenCV C++ interface do i need to release camera capture created with VideoCapture(int device?)

The documentation didnt say anything...but this, but cvCapture is a C type.

" Note

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."

I figure VideoCapture is an object though so no right?

The destructor for VideoCapture is

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

So it is not necessary to release it.

If you want to release without destructing the object calling the release() method on a VideoCapture object you well get the same effect:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM