跳转到内容

配置 CXP-12 接口卡#

本主题为您介绍如何使用 pylon API、pylon Viewer 或 gpioTool 配置 Basler CXP-12 接口卡。

信息

This topic covers basic use cases. For in-depth information about the software features of the interface card, see the acquisition applets PDF documentation.

在以下情况下配置接口卡特别有用:

Limitation

In all applets, buffers larger than 4 GB can't be allocated. Even if the applet allows a larger buffer size, you can't allocate buffers larger than 4 GB due to limitations in the driver and firmware.

You can calculate the buffer size as follows:

Buffer size = image height * image width * (pixel width / 8).

For RGB images: buffer size = (image height * image width * (pixel width / 8)) * 3 .

Available Area Scan Applets and Default Applets#

根据接口卡型号,以下小程序可用且设置为默认值:

小程序名称 Available For Interface Card Default Applet On Interface Card
Acq_SingleCXP12Area 1C、2C、4C 1C
Acq_DualCXP12Area 2C、4C 2C
Acq_TripleCXP12Area 4C -
Acq_QuadCXP12Area 4C 4C

Available Line Scan Applets#

Depending on the interface card model, the following applets are available. Note that the default applet (i.e., the applet that is loaded by default) is always an area scan applet. Thus, if you want to use a line scan applet, you must load it first as described in Changing the Applet.

小程序名称 Available For Interface Card
Acq_SingleCXP12Line 1C、2C、4C
Acq_DualCXP12Line 2C、4C
Acq_TripleCXP12Line 4C
Acq_QuadCXP12Line 4C

文档#

The following sections provide links to the acquisition applets documentation:

CXP-12 Interface Card 1C#

GenTL Fglib
Acq_SingleCXP12x1Area PDF Acq_SingleCXP12x1Area PDF
Acq_SingleCXP12Line PDF Acq_SingleCXP12Line PDF
Frame Grabber Test Applet PDF Frame Grabber Test Applet PDF

CXP-12 接口卡 2C#

GenTL Fglib
Acq_SingleCXP12Area PDF Acq_SingleCXP12Area PDF
Acq_DualCXP12Area PDF Acq_DualCXP12Area PDF
Acq_SingleCXP12Line PDF Acq_SingleCXP12Line PDF
Acq_DualCXP12Line PDF Acq_DualCXP12Line PDF
Frame Grabber Test Applet PDF Frame Grabber Test Applet PDF

CXP-12 接口卡 4C#

GenTL Fglib
Acq_SingleCXP12Area PDF Acq_SingleCXP12Area PDF
Acq_DualCXP12Area PDF Acq_DualCXP12Area PDF
Acq_TripleCXP12Area PDF Acq_TripleCXP12Area PDF
Acq_QuadCXP12Area PDF Acq_QuadCXP12Area PDF
Acq_SingleCXP12Line PDF Acq_SingleCXP12Line PDF
Acq_DualCXP12Line PDF Acq_DualCXP12Line PDF
Acq_TripleCXP12Line PDF Acq_TripleCXP12Line PDF
Acq_QuadCXP12line PDF Acq_QuadCXP12line PDF
FrameGrabberTest Frame Grabber Test Applet PDF

选择正确的小程序#

如果您仅使用单通道 (1-CXP) 相机,则默认小程序始终对您可用,您无需进行更改。

但是,如果您使用的是多通道(例如,2-CXP 或 4-CXP)相机,则您必须选择适合您相机设置的合适小程序。否则,相机将无法正常工作或相机性能可能会明显降低。

具体哪个小程序是正确的,取决于相机数量、每台相机的通道数量,以及所需的 ROI 步长。

ROI 步长取决于图像预处理的并行度,因此随相机和图像采集卡而变化。

CXP-12 Interface Card 1C#

Area Scan Applets for the CXP-12 Interface Card 1C#

单通道相机数量 双通道相机数量 四通道相机数量 小程序 ROI 步长 [像素] 拓扑
1 Acq_SingleCXP12x1Area x: 4
y: 1
一台相机,一个通道

Line Scan Applets for the CXP-12 Interface Card 1C#

单通道相机数量 双通道相机数量 四通道相机数量 小程序 ROI 步长 [像素] 拓扑
1 Acq_SingleCXP12Line x: 4
y: 1
一台相机,一个通道

CXP-12 接口卡 2C#

Area Scan Applets for the CXP-12 Interface Card 2C#

单通道相机数量 双通道相机数量 四通道相机数量 小程序 ROI 步长 [像素] 拓扑
1 Acq_DualCXP12Area x: 8
y: 1
一台相机,一个通道
2 Acq_DualCXP12Area x: 8
y: 1
两台相机,每台一个通道
1 Acq_SingleCXP12Area x: 16
y: 1
一台相机,两个通道

Line Scan Applets for the CXP-12 Interface Card 2C#

单通道相机数量 双通道相机数量 四通道相机数量 小程序 ROI 步长 [像素] 拓扑
1 Acq_DualCXP12Line x: 8
y: 1
一台相机,一个通道
2 Acq_DualCXP12Line x: 8
y: 1
两台相机,每台一个通道
1 Acq_SingleCXP12Line x: 16
y: 1
一台相机,两个通道

CXP-12 接口卡 4C#

Area Scan Applets for the CXP-12 Interface Card 4C#

单通道相机数量 双通道相机数量 四通道相机数量 小程序 ROI 步长 [像素] 拓扑
1 Acq_QuadCXP12Area x: 8
y: 1
一台相机,一个通道
2 Acq_QuadCXP12Area x: 8
y: 1
两台相机,每台一个通道
3 Acq_QuadCXP12Area x: 8
y: 1
三台相机,每台一个通道
4 Acq_QuadCXP12Area x: 8
y: 1
四台相机,每台一个通道
1 Acq_DualCXP12Area x: 16
y: 1
一台相机,两个通道
2 Acq_DualCXP12Area x: 16
y: 1
两台相机,每台两个通道
1 Acq_SingleCXP12Area x: 32
y: 1
一台相机,四个通道
1 1 Acq_TripleCXP12Area x: 8
y: 1
一台相机一个通道以及一台相机两个通道
2 1 Acq_TripleCXP12Area x: 8
y: 1
两台相机一个通道以及一台相机两个通道

Line Scan Applets for the CXP-12 Interface Card 4C#

单通道相机数量 双通道相机数量 四通道相机数量 小程序 ROI 步长 [像素] 拓扑
1 Acq_QuadCXP12Line x: 8
y: 1
一台相机,一个通道
2 Acq_QuadCXP12Line x: 8
y: 1
两台相机,每台一个通道
3 Acq_QuadCXP12Line x: 8
y: 1
三台相机,每台一个通道
4 Acq_QuadCXP12Line x: 8
y: 1
四台相机,每台一个通道
1 Acq_DualCXP12Line x: 16
y: 1
一台相机,两个通道
2 Acq_DualCXP12Line x: 16
y: 1
两台相机,每台两个通道
1 Acq_SingleCXP12Line x: 32
y: 1
一台相机,四个通道
1 1 Acq_TripleCXP12Line x: 8
y: 1
一台相机一个通道以及一台相机两个通道
2 1 Acq_TripleCXP12Line x: 8
y: 1
两台相机一个通道以及一台相机两个通道

更改小程序#

接口卡上运行的小程序定义其功能。对于某些相机设置,您可能必须更改默认小程序。ace

To change the applet used by the interface card, set the InterfaceApplet parameter to the name of the applet to be loaded, e.g., Acq_DualCXP12Area.

使用接口卡触发 Basler boost CXP-12 相机#

信息

仅当您特别想通过接口卡触发相机时,此部分才有意义。一般是通过相机的 I/O 连接器触发相机。有关更多信息,请参见触发图像采集

硬件触发(外部)#

启用外部触发后,您可以将触发输入信号发送到接口卡,然后接口卡将这些信号转发到 Basler boost 相机。

要配置接口卡以进行外部硬件触发,请执行以下操作:

  1. Set the AreaTriggerMode parameter to External.
  2. Set the TriggerInSource parameter to the desired "Front GPI" input line.
    For example, if you want to use GPI0 (pin 11 and 12 on the interface card) for external triggering, set the parameter to FrontGpiTriggerSource0.
  3. Set the TriggerCameraOutSelect parameter to the corresponding "Bypass" option.
    For example, if you selected FrontGpiTriggerSource0, set the TriggerCameraOutSelect parameter to BypassFrontGpi0.
  4. Set the TriggerState parameter to Active.
  5. 如有必要,按如下所述配置触发信号。

All trigger signals will be forwarded to the camera's source signals CxpTrigger0 and CxpTrigger1. The signals can be used for various purposes. The most common use case is image acquisition. See the example below.

硬件触发(内部)#

启用内部触发后,接口卡将在内部以指定频率生成触发信号。所有外部触发信号将被忽略。

要配置接口卡以进行内部硬件触发,请执行以下操作:

  1. Set the AreaTriggerMode parameter to Generator.
  2. Set the TriggerOutputFrequency parameter to the desired trigger output frequency. For example, if you set the parameter to 8, the interface card will generate 8 trigger signals per second.
  3. Set the TriggerCameraOutSelect parameter to the desired output line, e.g., PulseGenerator0.
  4. Set the TriggerState parameter to Active.

现在,无论何时开始图像采集,接口卡都会以指定的频率生成触发信号。

All trigger signals will be forwarded to the camera's source signals CxpTrigger0 and CxpTrigger1. The signals can be used for various purposes. The most common use case is image acquisition. See the example below.

示例:使用触发信号进行图像采集#

要使用接口卡生成的外部内部触发信号来采集图像,请执行以下操作:

  1. On the camera, set the TriggerSelector parameter to FrameStart.
  2. Set the TriggerMode parameter to On.
  3. Set the ExposureMode parameter to Timed.
  4. Set the TriggerSource parameter to CxpTrigger0 or CxpTrigger1.

现在,相机将在接口每次接收或生成触发信号时收集图像。

信息

You can use the trigger signals as the source for any Basler boost camera feature that can be controlled by a signal source. For example, setting the CounterTriggerSource parameter to CxpTrigger0 allows you to control the Counter feature using the interface card.

在接口卡上执行去马赛克处理#

使用 CXP-12 Interface Card 1C,您可以在接口卡上执行去马赛克处理。这样可以减少相机和主机上的计算负载。

为此:

  1. Start the pylon Viewer and open a connection to the interface card and the camera.
  2. Use the feature tree to make the following settings:
    • On the camera, set the Pixel Format option to a Bayer pixel format, e.g., Bayer RG 12.
    • Navigate to Device Transport Layer and disable the Automatic Format Control option.
      This allows you to set the output format independently of the pixel format used by the camera.
    • On the interface card, set the OutputFormat option to the corresponding RGB pixel format.
      The bit depth must be three times the bit depth of the Bayer pixel format. For example, Bayer RG 12 (camera) = Color 36 bit (interface card).

现在,接口卡将对相机的原始图像数据执行去马赛克处理并输出 RGB 图像数据。

信息

确保在上面的步骤 3 中设置了正确的 RGB pixel format。否则,将无法正确采集图像。

使用相机上不可用的输出格式#

Basler boost 相机可以输出多种 pixel format 的图像数据,例如 Bayer RG 8 或 RBG 8。有关更多信息,请参见 pixel format 主题。

如果相机上未提供所需的 pixel format,并且您还希望避免在主机上进行图像转换,则可以使用接口卡提供的一种 pixel format。

接口卡提供以下格式:

Gray8bit Gray10bit Gray12bit Gray16bit
Color24bit Color30bit Color36bit Color48bit
Bayergr8 Bayergr10 Bayergr12 Bayergr16
Bayerrg8 Bayerrg10 Bayerrg12 Bayerrg16
Bayergb8 Bayergb10 Bayergb12 Bayergb16
Bayerbg8 Bayerbg10 Bayerbg12 Bayerbg16

要使用相机上不可用的输出格式,请执行以下操作:

  1. On the camera, set the PixelFormat parameter to the desired camera pixel format, e.g., Mono12.
  2. On the interface card, set the AutomaticFormatControl parameter to false.
    This allows you to set the output format independently of the pixel format used by the camera.
  3. On the interface card, set the Format parameter to the desired output format, e.g., Gray16bit.

使用上面的示例值,接口卡将基于 12 位相机图像数据输出 16 位图像数据。如下所示插入填充位(零)。

16 位图像数据基于 12 位相机图像数据

Configuring the Trigger Signals Using the gpioTool#

使用 gpioTool 命令行工具,可以配置接口卡接收或发送的触发信号的物理属性:

  • 可以将输入线路配置为接收单端或差分信号。
  • 可以将输入线路配置为在上拉或下拉模式下工作。
  • 可以指定是否应将输出信号反相。

gpioTool 包含在 pylon Camera Software Suite 中。

要启动该工具,请执行以下操作:

  1. 打开命令提示符窗口 (Windows) 或“终端”窗口 (Linux)。
  2. 更改至 pylon 安装的 bin 目录:

    • Windows(64 位):%programfiles%\Basler\pylon x\Runtime\x64\pylonCXP\bin
    • Windows(32 位):%programfiles%\Basler\pylon x\Runtime\Win32\pylonCXP\bin
    • Linux:/opt/pylon/lib/pylonCXP/bin
  3. 使用如下所述的选项启动 gpioTool。

选项#

可以使用如下选项:

gpioTool -b [board_index]
         -g
         -v
         -s [bank]:[settings]
         -h

-b [board_index]
Specify which CXP-12 Interface Card in your system you want to address. This parameter is mandatory for all options except -h.
The value range of [board_index] is the index numbers of all CXP-12 Interface Card boards installed in your system. If you only have one CXP-12 Interface Card in your system, set [board_index] to 0.

-b [board_index] -g
Show the current GPIO bank settings of the CXP-12 Interface Card specified.

-b [board_index] -v
Show the current GPIO bank settings with verbose output.

-b [board_index] -s [bank]:[settings]
Configure the GPIO bank on the CXP-12 Interface Card specified.
[bank] specifies the index number of the GPIO bank. On the CXP Interface Card 1C, exactly one GPIO bank (the front GPIO) is available. Therefore, always set [bank] to 0.
[settings] configures the settings. See below.

-h
Show help.

设置#

For the [settings] part in -b [board_index] -s [bank]:[settings], the following settings are available:

设置 结果
[signal] se 将输入线路配置为接收单端信号。
[signal] ds 将输入线路配置为接收差分信号。
[pull-up-down] pu 将输入线路配置为在上拉模式下工作。a
[pull-up-down] pd 将输入线路配置为在下拉模式下工作。a
[inversion] ni 禁用输出线路的反转。
[inversion] in 启用输出线路的反转。

  1. 在大多数应用程序中,您需要配置此模式。接口卡激活一个 10 kΩ 的上拉电阻,以接收来自 NPN 晶体管(集电极开路、漏极开路)的信号。

  2. 接口卡会激活一个 10 kΩ 的下拉电阻,以接收来自 PNP 晶体管(发射极开路、开源)的信号。

You must enter the settings in the following format: [signal],[pull-up-down],[inversion]. Example: ds,pu,ni

Alternatively, you can set [settings] to default. This resets the configuration of a GPIO bank.

示例#

gpioTool -b 0 -s 0:ds,pu,ni

此命令按以下方式配置接口卡:

  • -b 0: Configure the GPIOs on board 0.
  • -s: Start the actual configuration.
  • 0:: Configure GPIO bank 0 (front GPIO).
  • ds,pu,ni: Configure the front GPIO to receive differential signals (ds), to work in pull-up mode (pu), and to send the outgoing signals not inverted (ni).

重置配置#

To reset a board and GPIO bank to the default settings, start the gpioTool with [settings] set to default:

gpioTool -b [board_index] -s [bank]:default

Example: gpioTool -b 0 -s 0:default

示例代码#

// Select the Acq_SingleCXP12Area applet
camera.GetTLParams().InterfaceApplet.SetValue(Acq_SingleCXP12Area);
// Configure the interface card for external triggering
camera.GetTLParams().AreaTriggerMode.SetValue(AreaTriggerMode_External);
camera.GetTLParams().TriggerInSource.SetValue(TriggerInSource_FrontGpiTriggerSource0);
camera.GetTLParams().TriggerCameraOutSelect.SetValue(TriggerCameraOutSelect_BypassFrontGpi0);
camera.GetTLParams().TriggerState.SetValue(TriggerState_Active);
// Configure the interface card for internal triggering
camera.GetTLParams().AreaTriggerMode.SetValue(AreaTriggerMode_Generator);
camera.GetTLParams().TriggerOutputFrequency.SetValue(8);
camera.GetTLParams().TriggerCameraOutSelect.SetValue(TriggerCameraOutSelect_PulseGenerator0);
camera.GetTLParams().TriggerState.SetValue(TriggerState_Active);
// Use the external or internal trigger signals for image acquisition
camera.TriggerSelector.SetValue(TriggerSelector_FrameStart);
camera.TriggerMode.SetValue(TriggerMode_On);
camera.ExposureMode.SetValue(ExposureMode_Timed);
camera.TriggerSource.SetValue(TriggerSource_CxpTrigger0);
// Perform debayering on the interface card (Bayer RG 12 --> RGB 36 bit)
camera.PixelFormat.SetValue(PixelFormat_BayerRG12);
camera.GetTLParams().AutomaticFormatControl.SetValue(false);
camera.GetTLParams().Format.SetValue(Format_Color36bit);
// Configure the interface card to output 16-bit mono image data based on
// 12-bit mono image data from the camera
camera.PixelFormat.SetValue(PixelFormat_Mono12);
camera.GetTLParams().AutomaticFormatControl.SetValue(false);
camera.GetTLParams().Format.SetValue(Format_Gray16bit);

此示例代码仅适用于 C++ 语言。

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