本示例將介紹如何通過定序器在圖像中將感興趣區域(ROI)移動到預定位置,以便采集移動物體的重要細節。定序器的每一步操作都通過外部信號觸發。這樣可以將配置參數進行封裝,用戶僅傳輸和處理當前圖像分析任務所需的數據。
如需了解有關定序器用途的更多詳細信息,請參閱下方的應用說明,其中詳細介紹了定序器的工作原理和功能。
如圖所示為所述序列產生的圖像效果。通過在圖像中移動感興趣區域,可直接在相機內對藥瓶圖像進行虛擬剪裁。
// STOP ACQUISITION AND LOAD DEFAULT PARAMETERS
pDevice->GetRemoteNode("AcquisitionStop")->Execute();
pDevice->GetRemoteNode("UserSetSelector")->SetString("Default");
pDevice->GetRemoteNode("UserSetLoad")->Execute();
// CONFIGURING GPIO “Line0” AS THE TRIGGER INPUT
pDevice->GetRemoteNode("TriggerMode")->SetString("On");
pDevice->GetRemoteNode("TriggerSource")->SetString("Line0");
pDevice->GetRemoteNode("TriggerActivation")->SetString("RisingEdge");
pDevice->GetRemoteNode("TriggerDelay")->SetDouble(0.0);
pDevice->GetRemoteNode("LineSelector")->SetString("Line0");
pDevice->GetRemoteNode("LineInverter")->SetBool(false);
pDevice->GetRemoteNode("LineDebouncerHighTimeAbs")->SetDouble(1.0);
pDevice->GetRemoteNode("LineDebouncerLowTimeAbs")->SetDouble(1.0);
// SWITCH TO SEQUENCER CONFIG MODE
pDevice->GetRemoteNode("SequencerConfigurationMode")->SetString("On");
// SET 0 (FIRST STEP OF THE SEQUENCE)
pDevice->GetRemoteNode("SequencerSetSelector")->SetInt(0);
pDevice->GetRemoteNode("SequencerSetLoad")->Execute();
pDevice->GetRemoteNode("TriggerMode")->SetString("On");
// ROI AT TOP LEFT (VGA)
pDevice->GetRemoteNode("OffsetX")->SetInt(0);
pDevice->GetRemoteNode("OffsetY")->SetInt(0);
pDevice->GetRemoteNode("Width")->SetInt(320);
pDevice->GetRemoteNode("Height")->SetInt(240);
pDevice->GetRemoteNode("OffsetX")->SetInt(0);
pDevice->GetRemoteNode("OffsetY")->SetInt(0);
pDevice->GetRemoteNode("SequencerPathSelector")->SetInt(0);
pDevice->GetRemoteNode("SequencerTriggerSource")->SetString("ExposureActive");
pDevice->GetRemoteNode("SequencerTriggerActivation")->SetString("RisingEdge");
pDevice->GetRemoteNode("SequencerSetNext")->SetInt(1);
pDevice->GetRemoteNode("SequencerSetSave")->Execute();
// SET 1 (SECOND STEP OF THE SEQUENCE)
pDevice->GetRemoteNode("SequencerSetSelector")->SetInt(1);
pDevice->GetRemoteNode("SequencerSetLoad")->Execute();
pDevice->GetRemoteNode("TriggerMode")->SetString("On");
// ROI AT CENTER (VGA)
pDevice->GetRemoteNode("OffsetX")->SetInt(0);
pDevice->GetRemoteNode("OffsetY")->SetInt(0);
pDevice->GetRemoteNode("Width")->SetInt(320);
pDevice->GetRemoteNode("Height")->SetInt(240);
pDevice->GetRemoteNode("OffsetX")->SetInt(160);
pDevice->GetRemoteNode("OffsetY")->SetInt(120);
pDevice->GetRemoteNode("SequencerPathSelector")->SetInt(0);
pDevice->GetRemoteNode("SequencerTriggerSource")->SetString("ExposureActive");
pDevice->GetRemoteNode("SequencerTriggerActivation")->SetString("RisingEdge");
pDevice->GetRemoteNode("SequencerSetNext")->SetInt(2);
pDevice->GetRemoteNode("SequencerSetSave")->Execute();
// SET 2 (THIRD STEP OF THE SEQUENCE)
pDevice->GetRemoteNode("SequencerSetSelector")->SetInt(2);
pDevice->GetRemoteNode("SequencerSetLoad")->Execute();
pDevice->GetRemoteNode("TriggerMode")->SetString("On");
// ROI AT BOTTOM RIGHT (VGA)
pDevice->GetRemoteNode("OffsetX")->SetInt(0);
pDevice->GetRemoteNode("OffsetY")->SetInt(0);
pDevice->GetRemoteNode("Width")->SetInt(320);
pDevice->GetRemoteNode("Height")->SetInt(240);
pDevice->GetRemoteNode("OffsetX")->SetInt(320);
pDevice->GetRemoteNode("OffsetY")->SetInt(240);
pDevice->GetRemoteNode("SequencerPathSelector")->SetInt(0);
pDevice->GetRemoteNode("SequencerTriggerSource")->SetString("ExposureActive");
pDevice->GetRemoteNode("SequencerTriggerActivation")->SetString("RisingEdge");
pDevice->GetRemoteNode("SequencerSetNext")->SetInt(0);
pDevice->GetRemoteNode("SequencerSetSave")->Execute();
pDevice->GetRemoteNode("SequencerSetStart")->SetInt(0);
// SEQUENCER CONFIG END
pDevice->GetRemoteNode("SequencerConfigurationMode")->SetString("Off");
// START CAMERA SEQUENCER
pDevice->GetRemoteNode("SequencerMode")->SetString("On");
pDataStream->StartAcquisitionContinuous();
pDevice->GetRemoteNode("AcquisitionStart")->Execute();
// WAIT FOR TRIGGERS TO CAPTURE IMAGES WITH CHANGING ROI’S
// STOP CAMERA SEQUENCER
pDevice->GetRemoteNode("AcquisitionStop")->Execute();
pDataStream->StopAcquisition();
pDevice->GetRemoteNode("SequencerMode")->SetString("Off");
// STOP ACQUISITION AND LOAD DEFAULT PARAMETERS
mDevice.RemoteNodeList["AcquisitionStop"].Execute();
mDevice.RemoteNodeList["UserSetSelector"].Value = "Default";
mDevice.RemoteNodeList["UserSetLoad"].Execute();
// CONFIGURING GPIO “Line0” AS THE TRIGGER INPUT
mDevice.RemoteNodeList["TriggerMode"].Value = "On";
mDevice.RemoteNodeList["TriggerSource"].Value = "Line0";
mDevice.RemoteNodeList["TriggerActivation"].Value = "RisingEdge";
mDevice.RemoteNodeList["TriggerDelay"].Value = (double)0.0;
mDevice.RemoteNodeList["LineSelector"].Value = "Line0";
mDevice.RemoteNodeList["LineInverter"].Value = false;
mDevice.RemoteNodeList["LineDebouncerHighTimeAbs"].Value = (double)1.0;
mDevice.RemoteNodeList["LineDebouncerLowTimeAbs"].Value = (double)1.0;
// SWITCH TO SEQUENCER CONFIG MODE
mDevice.RemoteNodeList["SequencerConfigurationMode"].Value = "On";
// SET 0 (FIRST STEP OF THE SEQUENCE)
mDevice.RemoteNodeList["SequencerSetSelector"].Value = (long)0;
mDevice.RemoteNodeList["SequencerSetLoad"].Execute();
mDevice.RemoteNodeList["TriggerMode"].Value = "On";
// ROI AT TOP LEFT (VGA)
mDevice.RemoteNodeList["OffsetX"].Value = (long)0;
mDevice.RemoteNodeList["OffsetY"].Value = (long)0;
mDevice.RemoteNodeList["Width"].Value = (long)320;
mDevice.RemoteNodeList["Height"].Value = (long)240;
mDevice.RemoteNodeList["OffsetX"].Value = (long)0;
mDevice.RemoteNodeList["OffsetY"].Value = (long)0;
mDevice.RemoteNodeList["SequencerPathSelector"].Value = (long)0;
mDevice.RemoteNodeList["SequencerTriggerSource"].Value = "ExposureActive";
mDevice.RemoteNodeList["SequencerTriggerActivation"].Value = "RisingEdge";
mDevice.RemoteNodeList["SequencerSetNext"].Value = (long)1;
mDevice.RemoteNodeList["SequencerSetSave"].Execute();
// SET 1 (SECOND STEP OF THE SEQUENCE)
mDevice.RemoteNodeList["SequencerSetSelector"].Value = (long)1;
mDevice.RemoteNodeList["SequencerSetLoad"].Execute();
mDevice.RemoteNodeList["TriggerMode"].Value = "On";
// ROI AT CENTER (VGA)
mDevice.RemoteNodeList["OffsetX"].Value = (long)0;
mDevice.RemoteNodeList["OffsetY"].Value = (long)0;
mDevice.RemoteNodeList["Width"].Value = (long)320;
mDevice.RemoteNodeList["Height"].Value = (long)240;
mDevice.RemoteNodeList["OffsetX"].Value = (long)160;
mDevice.RemoteNodeList["OffsetY"].Value = (long)120;
mDevice.RemoteNodeList["SequencerPathSelector"].Value = (long)0;
mDevice.RemoteNodeList["SequencerTriggerSource"].Value = "ExposureActive";
mDevice.RemoteNodeList["SequencerTriggerActivation"].Value = "RisingEdge";
mDevice.RemoteNodeList["SequencerSetNext"].Value = (long)2;
mDevice.RemoteNodeList["SequencerSetSave"].Execute();
// SET 2 (THIRD STEP OF THE SEQUENCE)
mDevice.RemoteNodeList["SequencerSetSelector"].Value = (long)2;
mDevice.RemoteNodeList["SequencerSetLoad"].Execute();
mDevice.RemoteNodeList["TriggerMode"].Value = "On";
// ROI AT BOTTOM RIGHT (VGA)
mDevice.RemoteNodeList["OffsetX"].Value = (long)0;
mDevice.RemoteNodeList["OffsetY"].Value = (long)0;
mDevice.RemoteNodeList["Width"].Value = (long)320;
mDevice.RemoteNodeList["Height"].Value = (long)240;
mDevice.RemoteNodeList["OffsetX"].Value = (long)320;
mDevice.RemoteNodeList["OffsetY"].Value = (long)240;
mDevice.RemoteNodeList["SequencerPathSelector"].Value = (long)0;
mDevice.RemoteNodeList["SequencerTriggerSource"].Value = "ExposureActive";
mDevice.RemoteNodeList["SequencerTriggerActivation"].Value = "RisingEdge";
mDevice.RemoteNodeList["SequencerSetNext"].Value = (long)0;
mDevice.RemoteNodeList["SequencerSetSave"].Execute();
mDevice.RemoteNodeList["SequencerSetStart"].Value = (long)0;
// SEQUENCER CONFIG END
mDevice.RemoteNodeList["SequencerConfigurationMode"].Value = "Off";
// START CAMERA SEQUENCER
mDevice.RemoteNodeList["SequencerMode"].Value = "On";
mDataStream.StartAcquisition();
mDevice.RemoteNodeList["AcquisitionStart"].Execute();
// WAIT FOR TRIGGERS TO CAPTURE IMAGES WITH CHANGING ROI’S
// STOP CAMERA SEQUENCER
mDevice.RemoteNodeList["AcquisitionStop"].Execute();
mDataStream.StopAcquisition();
mDevice.RemoteNodeList["SequencerMode"].Value = "Off";
利用VCXG相機定序器移動感興趣區域