问题描述
我正在使用Spinnaker SDK来控制FLIR摄像机。如果应用程序在任何时候由于正在使用相机而崩溃,则该应用程序的每次下一次执行都会抛出AccessException
,例如:
Spinnaker :: GenApi :: CommandNode :: Execute:消息= GenICam :: AccessException =节点不可写。 :调用“ UserSetLoad.Execute()”时在节点“ UserSetLoad”中抛出AccessException
到目前为止,我发现的唯一解决方案是拔掉相机的插头,但是在某些将要使用该应用程序的环境中,这不是可接受的解决方案。
这里有一个示例代码(由于它是从较大的代码库中提取的,因此无法完全编译,但是可以让您对工作流程有所了解):
// System instance is prepared before using the camera
Spinnaker::SystemPtr m_system = Spinnaker::System::GetInstance();
// Method in class that initializes the camera
bool initCamera(int index)
{
SmartCameraList cameras(m_system->GetCameras());
const auto cameras_count = cameras.GetSize();
if (cameras_count < 1) { return false; }
if (index >= (int)cameras_count) { return false; }
m_camera = cameras[index];
if (!m_camera) { return false; }
if (m_camera->IsInitialized()) { return false; } // passes
m_camera->DeInit(); // does nothing
m_camera->Init();
if (!m_camera->IsInitialized()) { return false; } // passes
// Default properties
try {
m_camera->UserSetSelector.SetValue(UserSetSelector_Default);
m_camera->UserSetDefault.SetValue(UserSetDefault_Default);
m_camera->UserSetLoad.Execute(); //< thrown here
m_camera->BalanceWhiteAuto.SetValue(BalanceWhiteAuto_Continuous);
m_camera->SensorShutterMode.SetValue(SensorShutterMode_Global);
} catch (Spinnaker::Exception e) {
std::cout << e.GetFullErrorMessage() << '\n';
return false;
}
return true;
}
// m_system->ReleaseInstance() is called when the application finishes using the camera
如您所见,相机已正确初始化,但似乎还有其他东西在握着相机。
我已经在官方论坛中查看过,寻找与GenICam
相关的更普通的问题,而没有任何事情。
在使用相机之前,有什么方法可以重置相机吗?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)