IC Imaging Control C++

Grabber::openDev Method

Grabber::openDev Method

Opens a video capture device for grabbing.
Syntax:
bool openDev( const VideoCaptureDeviceItem& dev );
bool openDev( const char* dev );
bool openDev( const std::string& devstring );
bool openDev( const std::wstring& devstring );
bool openDev( const int64_t& serial );

Parameter Description
VideoCaptureDeviceItem& dev

Specifies the video device to be opened.

char* dev

Specifies the name of the video capture device to be opened.

devstring

Specifies the name of the video capture device to be opened.

serial

Specifies the serial number of the video capture device to be opened.

Return value:

true, if the device was opened successfully, false, otherwise.

Remarks:

An already opened device will be closed before opening a new one.

openDev is usually one of the first actions on the Grabber. Querying for device capabilities such as the available video formats (Grabber::getAvailableVideoFormats ) is only possible, if a device is open. You can get a VideoCaptureDeviceItem by iterating the list generated by Grabber::getAvailableVideoCaptureDevices.

After opening the device, a video format has to be set to a valid one, using Grabber::setVideoFormat.

Please note that even if you have a device opened with Grabber::openDev, it may become invalid at any time (e.g. if the device is unplugged). A device which has become invalid will not automatically be reopened, if it gets plugged in again. You should rather check whether the device is still valid using Grabber::isDevValid by time and react accordingly.

See also: Grabber, Grabber::closeDev, Grabber::getAvailableVideoCaptureDevices, Grabber::isDevOpen

<< Grabber

Get in touch with us


About The Imaging Source

Established in 1990, The Imaging Source is one of the leading manufacturers of industrial cameras, frame grabbers and video converters for production automation, quality assurance, logistics, medicine, science and security.

Our comprehensive range of cameras with USB 3.1, USB 3.0, USB 2.0, GigE interfaces and other innovative machine vision products are renowned for their high quality and ability to meet the performance requirements of demanding applications.

Automated Imaging Association ISO 9001:2015 certified

Contact us