Impact Acquire SDK C++
Capturing Image Data Using High-Level Helper Classes

Since version 2.33.0 Impact Acquire is shipped with a new header file: mvIMPACT_acquire_helper.h. This file which adds the classes mvIMPACT::acquire::helper::RequestProvider and mvIMPACT::acquire::helper::ThreadSafeQueue to the public interface.

The following code will illustrate how the RequestProvider class is used to capture data continuously and in a convenient way from a device. For more details please refer to mvIMPACT::acquire::helper::RequestProvider.

Note
This class might not be the right choice for complex applications! It intended use-case is for straight forward image acquisition tasks. When suitable it is extremely easy to use. See also the next chapter to find out how to use the API when you need more control over the acquisition process!
//-----------------------------------------------------------------------------
int main(int argc, char* argv[])
//-----------------------------------------------------------------------------
{
if( devMgr.deviceCount() == 0 )
{
cout << "No device found! Unable to continue!" << endl;
char ch = getch();
return 0;
}
cout << "Initializing the device. This might take some time..." << endl;
// create an interface to the first device found
mvIMPACT::acquire::Device* pDev = devMgr[0];
try
{
pDev->open();
}
{
// this e.g. might happen if the same device is already opened in another process...
cout << "An error occurred while opening the device(error code: " << e.errCode()
<< "). Press any key to end the application..." << endl;
char ch = getch();
return 0;
}
helper::RequestProvider requestProvider( pDev );
requestProvider.acquisitionStart();
for(size_t i = 0; i < 5; i++)
{
std::shared_ptr<Request> pRequest = requestProvider.waitForNextRequest();
std::cout << "Image captured: " << pRequest->imageOffsetX.read() << "x" << pRequest->imageOffsetY.read() << "@" << pRequest->imageWidth.read() << "x" << pRequest->imageHeight.read() << std::endl;
}
requestProvider.acquisitionStop();
return 0;
}
Grants access to devices that can be operated by this software interface.
Definition mvIMPACT_acquire.h:7081
unsigned int deviceCount(void) const
Returns the number of devices currently present in the system.
Definition mvIMPACT_acquire.h:7253
This class and its functions represent an actual device detected by this interface in the current sys...
Definition mvIMPACT_acquire.h:6059
void open(void)
Opens a device.
Definition mvIMPACT_acquire.h:6330
A base class for exceptions generated by Impact Acquire.
Definition mvIMPACT_acquire.h:256

Based on the previous code, there is the SingleCapture.cpp sample which explains the image acquisition much more detailed. For continuous image acquisition tasks, please refer to the ContinuousCapture.cpp sample.

For a detailed summary of our samples, please refer to the Typical Usage Scenarios And Example Applications page.