void PylonCamera::execute() { if(!mCam) { return; } try { updateParams(); // This smart pointer will receive the grab result data. CGrabResultPtr ptrGrabResult; // Wait for an image and then retrieve it. A timeout of 1000 ms is used. mCam->RetrieveResult(1000, ptrGrabResult); // Image grabbed successfully= if (ptrGrabResult && ptrGrabResult->GrabSucceeded()) { CPylonImage target; // Convert to correct format for vision system CImageFormatConverter converter; converter.OutputPixelFormat = PixelType_BGR8packed; converter.OutputBitAlignment = OutputBitAlignment_MsbAligned; converter.Convert(target, ptrGrabResult); // Now the grab result can be released. The grab result buffer is now // only held by the pylon image. ptrGrabResult.Release(); // Create an RGBImage from converted data RgbImage image(target.GetHeight(), target.GetWidth(), (uchar *)target.GetBuffer()); mOut.send(image.clone()); // The Release() method can be used to release any data. target.Release(); } } catch (GenICam::GenericException &e) { /*stop(); deinitialize();*/ throw std::runtime_error(e.GetDescription()); } catch(const std::exception& e) { throw std::runtime_error(e.what()); } }