Hi,
I’m trying too make an addon for a BlackFly S camera from FLIR.
I’v tried to implement ofxSpinnaker without success and there is already so many classes in my final project that I need a quick and simple addon for a specific cam ( BFS-U3-13Y3M).
My work is based on doc and code provided by Flir and also on this repo :
The thing is I get an exception at the end of the first function I’ve built and can’t really find a way to understand it
Here is the code of the addon :
First the header ofxBlackFlyS.h
#pragma once
#include "Spinnaker.h"
#include "SpinGenApi/SpinnakerGenApi.h"
#include "ofMain.h"
class ofxBlackFlyS{
public:
void setup();
Spinnaker::CameraPtr pCam = 0;
int camWidth, camHeight;
};
the c++ file ofxBlackFlyS.cpp
#include "ofxBlackFlyS.h"
using namespace Spinnaker;
using namespace Spinnaker::GenApi;
using namespace Spinnaker::GenICam;
// -----------------------------------------------------------------------------
// Public methods
// -----------------------------------------------------------------------------
//-----------------------------------------------------------------
void ofxBlackFlyS::setup() {
// Retrieve singleton reference to system object
Spinnaker::SystemPtr system = Spinnaker::System::GetInstance();
// Print out current library version
const Spinnaker::LibraryVersion spinnakerLibraryVersion = system->GetLibraryVersion();
cout << "Spinnaker library version: " << spinnakerLibraryVersion.major << "." << spinnakerLibraryVersion.minor
<< "." << spinnakerLibraryVersion.type << "." << spinnakerLibraryVersion.build << endl
<< endl;
// Retrieve list of cameras from the system
Spinnaker::CameraList camList = system->GetCameras();
const unsigned int numCameras = camList.GetSize();
cout << "Number of cameras detected: " << numCameras << endl << endl;
pCam = camList.GetByIndex(0);
//once we have the camera clear the cam list
camList.Clear();
//Init cam
pCam->Init();
//turn off auto exposure
pCam->ExposureAuto.SetValue(::Spinnaker::ExposureAutoEnums::ExposureAuto_Off);
pCam->GainAuto.SetValue(::Spinnaker::GainAutoEnums::GainAuto_Off);
//get width & Height
camWidth = pCam->SensorWidth();
camHeight = pCam->SensorHeight();
pCam->PixelFormat.SetValue(PixelFormat_Mono8);
// Image acquisition
pCam->AcquisitionMode.SetValue(AcquisitionMode_Continuous);
//always capture the latest image from the camera (ideally this should be a parameter)
pCam->TLStream.StreamBufferHandlingMode.SetValue(::Spinnaker::StreamBufferHandlingMode_NewestFirstOverwrite);
}
// -----------------------------------------------------------------------------
// Private methods
// -----------------------------------------------------------------------------
In the ofApp, I declare the ofxBlackFlyS instance and calll setup. In debug mode and release mode it throws an exception at the end of the setup function like this
This is the first time I see such a case : an exception at the end of the function.
I’ve tried many things and I’m sure of one thing : everything goes fine before the end of the function. The trouble begins when I use the pCam variable which is cameraPtr.
You can find the project and the addon at