尝试解决basler关不掉的问题

main
Jeffrey_Li 2 years ago
parent fc8f54c7d3
commit 03444ed917

@ -24,8 +24,7 @@ void CaptureThreadBasler::process(void)
{
bool last_high = false;
bool last_result = false;
try
{
CSampleConfigurationEventHandler* CfgEvent = NULL;
CfgEvent = new CSampleConfigurationEventHandler;
CfgEvent->channel_ = Local_Num;
@ -51,6 +50,8 @@ void CaptureThreadBasler::process(void)
BurstEvent.pDev__ = pDev_;
BurstEvent.pCaptureThreadBasler = this;
try
{
m_threadFunc.pDev__ = pDev_;
m_threadFunc.p_result_queue_ = p_result_queue;
m_threadFunc.p_double_queue_ = p_double_queue;
@ -89,11 +90,9 @@ void CaptureThreadBasler::process(void)
/*Set here*/
if (pDev_->TriggerSelector.TrySetValue(Basler_UniversalCameraParams::TriggerSelector_FrameBurstStart))
{
DEBUG(" TriggerSelector_FrameBurstStart\n");
pDev_->TriggerMode.SetValue(Basler_UniversalCameraParams::TriggerMode_Off);
if(pDev_->EventSelector.TrySetValue(Basler_UniversalCameraParams::EventSelector_FrameBurstStart))
{
DEBUG(" EventSelector_FrameBurstStart\n");
pDev_->EventNotification.SetValue(Basler_UniversalCameraParams::EventNotification_Off);
}
}
@ -144,18 +143,38 @@ void CaptureThreadBasler::process(void)
if (m_Timer) delete m_Timer;
pDev_->StopGrabbing();
pDev_->Close();
pDev_->GrabCameraEvents = false;
pDev_->DeregisterConfiguration(CfgEvent);
pDev_->DeregisterImageEventHandler(&ImageEvent);
#ifndef USB_BASLER_NEW_FW
pDev_->DeregisterCameraEventHandler(&BurstEvent, "EventFrameBurstStartData");
#else
pDev_->DeregisterCameraEventHandler(&BurstEvent, "EventLine1RisingEdgeData");
pDev_->DeregisterCameraEventHandler(&BurstEvent, "EventLine1FallingEdgeData");
#endif
}
catch(const Pylon::GenericException& e)
{
emit error( QString::fromStdString( e.GetDescription()) );
std::cout << e.GetSourceLine()<<e.GetDescription() << std::endl;
if (pDev_->IsCameraDeviceRemoved())
{
cout << "The camera has been removed from the computer." << endl;
}
else
{
pDev_->StopGrabbing();
pDev_->GrabCameraEvents = false;
pDev_->Close();
pDev_->DeregisterConfiguration(CfgEvent);
pDev_->DeregisterImageEventHandler(&ImageEvent);
#ifndef USB_BASLER_NEW_FW
pDev_->DeregisterCameraEventHandler(&BurstEvent, "EventFrameBurstStartData");
#else
pDev_->DeregisterCameraEventHandler(&BurstEvent, "EventLine1RisingEdgeData");
pDev_->DeregisterCameraEventHandler(&BurstEvent, "EventLine1FallingEdgeData");
#endif
}
}
}

@ -12,6 +12,13 @@
#define BaslerClassID 0x02
#define c_maxCamerasToUse (size_t)2
//5:灰色
//6:黑色
//1:红色
//2:黄色
//3:白色
//4:绿色
class BaslerCamera: public BaseCamera
{
public:

Loading…
Cancel
Save