跳转到内容

Acquisition Start and Stop (dart E)#

通过采集开始和停止命令,您可以控制图像采集。

信息

  • These commands aren't available via the pylon Viewer feature tree. Instead, AcquisitionStart and AcquisitionStop commands are generated automatically when you use the acquisition buttons on the toolbar of the pylon Viewer.
  • The pylon C++ API provides camera classes that handle these commands automatically. Basler recommends using these classes.
    For more information, see the "Grab" code samples in the C++ Programmer's Guide and Reference Documentation delivered with the Basler pylon Software Suite.

该功能的使用#

要打开图像采集,请执行 AcquisitionStart 命令。

要关闭图像采集,请执行 AcquisitionStop 命令。

执行 AcquisitionStop 命令后,将发生以下情况:

  • 如果相机当前未在采集帧,则图像采集功能会立即关闭。
  • 如果相机当前正在读出图像数据,则系统会允许读出过程完成。之后,图像采集功能会关闭。
  • 如果相机当前正在曝光一帧,则曝光会中止。相机立即停止曝光并开始读取图像数据。读取过程将允许完成。之后,图像采集关闭。

示例代码#

// Configure continuous image acquisition on the cameras
camera.AcquisitionMode.SetValue(AcquisitionMode_Continuous);
// Switch on image acquisition
camera.AcquisitionStart.Execute();
// (...)
// Switch off image acquisition
camera.AcquisitionStop.Execute();
// Switch image acquisition back on
camera.AcquisitionStart.Execute();
INodeMap& nodemap = camera.GetNodeMap();
// Configure continuous image acquisition on the cameras
CEnumParameter(nodemap, "AcquisitionMode").SetValue("Continuous");
// Switch on image acquisition
CCommandParameter(nodemap, "AcquisitionStart").Execute();
// (...)
// Switch off image acquisition
CCommandParameter(nodemap, "AcquisitionStop").Execute();
// Switch image acquisition back on
CCommandParameter(nodemap, "AcquisitionStart").Execute();
// Configure continuous image acquisition on the cameras
camera.Parameters[PLCamera.AcquisitionMode].SetValue(PLCamera.AcquisitionMode.Continuous);
// Switch on image acquisition
camera.Parameters[PLCamera.AcquisitionStart].Execute();
// (...)
// Switch off image acquisition
camera.Parameters[PLCamera.AcquisitionStop].Execute();
// Switch image acquisition back on
camera.Parameters[PLCamera.AcquisitionStart].Execute();
/* Macro to check for errors */
#define CHECK(errc) if (GENAPI_E_OK != errc) printErrorAndExit(errc)
GENAPIC_RESULT errRes = GENAPI_E_OK;  /* Return value of pylon methods */
/* Configure continuous image acquisition on the cameras */
errRes = PylonDeviceFeatureFromString(hdev, "AcquisitionMode", "Continuous");
CHECK(errRes);
/* Switch on image acquisition */
errRes = PylonDeviceExecuteCommandFeature(hdev, "AcquisitionStart");
CHECK(errRes);
/* (...) */
/* Switch off image acquisition */
errRes = PylonDeviceExecuteCommandFeature(hdev, "AcquisitionStop");
CHECK(errRes);
/* Switch image acquisition back on */
errRes = PylonDeviceExecuteCommandFeature(hdev, "AcquisitionStart");
CHECK(errRes);
# Configure continuous image acquisition on the cameras
camera.AcquisitionMode.Value = "Continuous"
# Switch on image acquisition
camera.AcquisitionStart.Execute()
# (...)
# Switch off image acquisition
camera.AcquisitionStop.Execute()
# Switch image acquisition back on
camera.AcquisitionStart.Execute()
/* Macro to check for errors */
#define CHECK(errc) if (GENAPI_E_OK != errc) printErrorAndExit(errc)
GENAPIC_RESULT errRes = GENAPI_E_OK;  /* Return value of pylon methods */
/* Configure continuous image acquisition on the cameras */
errRes = PylonDeviceFeatureFromString(hdev, "AcquisitionMode", "Continuous");
CHECK(errRes);
/* Switch on image acquisition */
errRes = PylonDeviceExecuteCommandFeature(hdev, "AcquisitionStart");
CHECK(errRes);
/* (...) */
/* Switch off image acquisition */
errRes = PylonDeviceExecuteCommandFeature(hdev, "AcquisitionStop");
CHECK(errRes);
/* Switch image acquisition back on */
errRes = PylonDeviceExecuteCommandFeature(hdev, "AcquisitionStart");
CHECK(errRes);

您还可以使用 pylon Viewer 轻松设置参数。