[wrapper] setting of framerates

This commit is contained in:
Jan Grewe 2020-03-12 17:48:07 +01:00
parent e2b1f44997
commit 3071c0bc3b
2 changed files with 55 additions and 10 deletions

View File

@ -22,25 +22,62 @@ bool PylonWrapper::isOpen() {
return valid;
}
double PylonWrapper::maxFrameRate() {
double max_rate = -1;
if (valid) {
GenApi::INodeMap& nodemap = camera->GetNodeMap();
GenApi::INode* n = nodemap.GetNode( "AcquisitionFrameRate" );
Pylon::CFloatParameter framerate( n );
return framerate.GetMax();
}
return max_rate;
}
bool PylonWrapper::frameRate(uint new_framerate) {
if (valid) {
GenApi::INodeMap& nodemap = camera->GetNodeMap();
GenApi::INode* n = nodemap.GetNode( "AcquisitionFrameRateEnable" );
Pylon::CBooleanParameter enableframerate(n);
enableframerate.SetValue(true);
n = nodemap.GetNode( "AcquisitionFrameRate" );
Pylon::CFloatParameter framerate( n );
framerate.SetValue( new_framerate );
return true;
}
return false;
}
double PylonWrapper::frameRate() {
double rate = -1.;
if (valid) {
GenApi::INodeMap& nodemap = camera->GetNodeMap();
GenApi::INode* n = nodemap.GetNode( "AcquisitionFrameRate" );
Pylon::CFloatParameter framerate( n );
rate = framerate.GetValue();
}
return rate;
}
ImageSettings PylonWrapper::getImageSettings() {
ImageSettings settings;
if (valid) {
Pylon::CIntegerParameter width( camera->GetNodeMap(), "Width");
Pylon::CIntegerParameter height( camera->GetNodeMap(), "Height");
Pylon::CEnumParameter pixelFormat( camera->GetNodeMap(), "PixelFormat");
settings.width = width.GetValue();
settings.height = height.GetValue();
}
Pylon::CIntegerParameter width( camera->GetNodeMap(), "Width");
Pylon::CIntegerParameter height( camera->GetNodeMap(), "Height");
Pylon::CEnumParameter pixelFormat( camera->GetNodeMap(), "PixelFormat");
settings.width = width.GetValue();
settings.height = height.GetValue();
}
return settings;
}
bool PylonWrapper::grabFrame(MyImage &img) {
Pylon::CGrabResultPtr frame;
if (valid) {
camera->StartGrabbing();
camera->RetrieveResult( 5000, frame, Pylon::TimeoutHandling_ThrowException);
camera->StopGrabbing();
}
camera->StartGrabbing();
camera->RetrieveResult( 5000, frame, Pylon::TimeoutHandling_ThrowException);
camera->StopGrabbing();
}
img.setFrame(frame);
return frame.IsValid();
}
@ -69,3 +106,7 @@ void PylonWrapper::closeCamera() {
}
}
}
Pylon::CInstantCamera *PylonWrapper::getCamera() {
return camera;
}

View File

@ -22,6 +22,10 @@ public:
bool openCamera(std::string &message);
void closeCamera();
bool grabFrame(MyImage &img);
bool frameRate(uint framerate);
double frameRate();
double maxFrameRate();
Pylon::CInstantCamera *getCamera();
private:
Pylon::CInstantCamera *camera;