From 384aab9de4fe8b9c04a9f2b06f42cb888fcbbe66 Mon Sep 17 00:00:00 2001 From: Jan Grewe Date: Mon, 11 Mar 2024 09:13:59 +0100 Subject: [PATCH] some cleanup --- pylonwrapper.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pylonwrapper.cpp b/pylonwrapper.cpp index 9684f66..0d108e7 100644 --- a/pylonwrapper.cpp +++ b/pylonwrapper.cpp @@ -23,6 +23,7 @@ PylonWrapper::~PylonWrapper() { delete camera; camera = nullptr; } + terminate(); qDebug() << "Successfully deleted camera"; } @@ -162,13 +163,15 @@ bool PylonWrapper::grabFrame(MyImage &img) { } void PylonWrapper::resetCamera() { - int64_t maxWidth = 2048; - int64_t maxHeight = 1536; - qDebug() << "resetting camera to default ROI (" << maxWidth << ", " << maxHeight << ")"; + int64_t dfltWidth = 2048; + int64_t dfltHeight = 1536; + qDebug() << "resetting camera to default ROI (" << dfltWidth << ", " << dfltHeight << ")"; try { GenApi::INodeMap& nodemap = camera->GetNodeMap(); - Pylon::CIntegerParameter(nodemap, "Width").SetValue(maxWidth); - Pylon::CIntegerParameter(nodemap, "Height").SetValue(maxHeight); + // std::cerr << "MaxWidth: " << Pylon::CIntegerParameter(nodemap, "WidthMax").GetValue() << std::endl; + Pylon::CIntegerParameter(nodemap, "Width").SetValue(dfltWidth, false); + // std::cerr << "MaxHeight: " << Pylon::CIntegerParameter(nodemap, "HeightMax").GetValue() << std::endl; + Pylon::CIntegerParameter(nodemap, "Height").SetValue(dfltHeight, false); Pylon::CIntegerParameter(nodemap, "OffsetX").SetValue(0); Pylon::CIntegerParameter(nodemap, "OffsetY").SetValue(0); } catch (const Pylon::GenericException &e) { @@ -182,8 +185,6 @@ bool PylonWrapper::openCamera(std::string &message) { qDebug() << "opening camera"; try { camera = new Pylon::CInstantCamera(); - // Pylon::CInstantCamera camera( pTl->CreateDevice( lstDevices[0] ); - // Pylon::IPylonDevice *pDevice = Pylon::CTlFactory::GetInstance().CreateFirstDevice(); Pylon::String_t fname(fullName.c_str()); Pylon::IPylonDevice *pDevice = Pylon::CTlFactory::GetInstance().CreateDevice(fname); camera->Attach(pDevice); @@ -226,7 +227,6 @@ void PylonWrapper::closeCamera() { qWarning() << "An exception occurred." << e.GetDescription(); } } - qDebug() << "Successfully closed camera!"; } Pylon::CInstantCamera *PylonWrapper::getCamera() {