some cleanup

This commit is contained in:
Jan Grewe 2024-03-11 09:13:59 +01:00
parent 4e617e9505
commit 384aab9de4

View File

@ -23,6 +23,7 @@ PylonWrapper::~PylonWrapper() {
delete camera; delete camera;
camera = nullptr; camera = nullptr;
} }
terminate();
qDebug() << "Successfully deleted camera"; qDebug() << "Successfully deleted camera";
} }
@ -162,13 +163,15 @@ bool PylonWrapper::grabFrame(MyImage &img) {
} }
void PylonWrapper::resetCamera() { void PylonWrapper::resetCamera() {
int64_t maxWidth = 2048; int64_t dfltWidth = 2048;
int64_t maxHeight = 1536; int64_t dfltHeight = 1536;
qDebug() << "resetting camera to default ROI (" << maxWidth << ", " << maxHeight << ")"; qDebug() << "resetting camera to default ROI (" << dfltWidth << ", " << dfltHeight << ")";
try { try {
GenApi::INodeMap& nodemap = camera->GetNodeMap(); GenApi::INodeMap& nodemap = camera->GetNodeMap();
Pylon::CIntegerParameter(nodemap, "Width").SetValue(maxWidth); // std::cerr << "MaxWidth: " << Pylon::CIntegerParameter(nodemap, "WidthMax").GetValue() << std::endl;
Pylon::CIntegerParameter(nodemap, "Height").SetValue(maxHeight); 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, "OffsetX").SetValue(0);
Pylon::CIntegerParameter(nodemap, "OffsetY").SetValue(0); Pylon::CIntegerParameter(nodemap, "OffsetY").SetValue(0);
} catch (const Pylon::GenericException &e) { } catch (const Pylon::GenericException &e) {
@ -182,8 +185,6 @@ bool PylonWrapper::openCamera(std::string &message) {
qDebug() << "opening camera"; qDebug() << "opening camera";
try { try {
camera = new Pylon::CInstantCamera(); 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::String_t fname(fullName.c_str());
Pylon::IPylonDevice *pDevice = Pylon::CTlFactory::GetInstance().CreateDevice(fname); Pylon::IPylonDevice *pDevice = Pylon::CTlFactory::GetInstance().CreateDevice(fname);
camera->Attach(pDevice); camera->Attach(pDevice);
@ -226,7 +227,6 @@ void PylonWrapper::closeCamera() {
qWarning() << "An exception occurred." << e.GetDescription(); qWarning() << "An exception occurred." << e.GetDescription();
} }
} }
qDebug() << "Successfully closed camera!";
} }
Pylon::CInstantCamera *PylonWrapper::getCamera() { Pylon::CInstantCamera *PylonWrapper::getCamera() {