void QPylonCamera::open()
{
if(isOpen())
return;
try {
// Create an instant camera object with the camera device found first.
DeviceInfoList_t devices;
CTlFactory& tlFactory = CTlFactory::GetInstance();
if (tlFactory.EnumerateDevices( devices ) == 0)
{
qDebug()<<"No Camera Found";
}
mCamera = new CInstantCamera(tlFactory.CreateDevice(devices[cam]));
// Print the camera information.
qInfo()<<"Using device : "<< mCamera->GetDeviceInfo().GetModelName();
qInfo()<<"Friendly Name: "<< mCamera->GetDeviceInfo().GetFriendlyName();
qInfo()<<"Full Name : "<< mCamera->GetDeviceInfo().GetFullName();
qInfo()<<"SerialNumber : "<< mCamera->GetDeviceInfo().GetSerialNumber();
// Handle image event
mCamera->RegisterImageEventHandler(mImageEventHandler, RegistrationMode_Append, Cleanup_Delete);
mCamera->Open();
// Get the integer nodes describing the AOI.
const INodeMap& nodemap = mCamera->GetNodeMap();
CIntegerPtr offsetX( nodemap.GetNode( "OffsetX"));
CIntegerPtr offsetY( nodemap.GetNode( "OffsetY"));
CIntegerPtr width( nodemap.GetNode( "Width"));
CIntegerPtr height( nodemap.GetNode( "Height"));
qInfo()<<"OffsetX: "<<offsetX->GetValue();
qInfo()<<"OffsetY: "<<offsetY->GetValue();
qInfo()<<"Width: "<<width->GetValue();
qInfo()<<"Height: "<<height->GetValue();
mRect = QRect(offsetX->GetValue(),
offsetY->GetValue(),
width->GetValue(),
height->GetValue());
} catch (GenICam::GenericException &e) {
mCamera = Q_NULLPTR;
qWarning() << "Camera Error: " << e.GetDescription();
}
}
And in the main.cpp
engine.rootContext()->setContextProperty("cam1", new QPylonCamera(Q_NULLPTR,0));
engine.rootContext()->setContextProperty("cam2", new QPylonCamera(Q_NULLPTR,1));
Hi, I tried to use 2 GigE cameras but one camera is raising an exception after 5 seconds :
LOG : pylon.base.InstantCamera : Camera 0000015C4813CD10: OnGrabError msg=Cannot convert image. The passed source image is invalid. : InvalidArgumentException thrown (file 'imageformatconverter.cpp', line 77)
I did few changes here :
and Here:
And in the main.cpp