跳转到内容

Line Pitch#

相机的 Line Pitch 功能使您可以增加每像素线路传输的字节数。为了增加线路间距,相机会将向每条线路添加“0”字节。

如果您想让图像数据对齐固定大小的位组,例如,对齐 4 字节(32 位)或 8 字节(64 位)字,此功能十分有用。数据对齐可以提高性能。

该功能的使用#

运作原理#

像素数据从传感器逐行读取。对于每个图像行,相机都会传输特定数量的字节,具体取决于图像 ROI 宽度和所使用的像素格式

Line Pitch 功能使您可以增加每行传输的字节数。为了增加线路间距,相机会将“0”字节添加到每条线路。这使您可以将图像数据对齐到 4 字节或 8 字节字。

示例:如果将图像 ROI 设置为 250 像素的宽度,并将像素格式设置为 Mono 8,则每行传输的像素数据量为 250 字节(250 像素 x 8 位深度 = 250 字节)。

此数据不能对齐 4 字节或 8 字节字,因为 250 不是 4 或 8 的倍数。要将图像数据对齐 4 字节字,必须将行距从 250 字节增加到至少 252 字节(252 是高于 250 的第一个 4 的倍数)。要将图像数据对齐 8 字节字,必须将行距增加到至少 256 字节。

信息

如果启用了数据块,则调整线路间距不会影响块数据。“0”将仅添加到图像数据,而不会添加到块数据。

确定线路间距#

To determine the current line pitch, get the value of the LinePitch parameter.

This always returns the current line pitch in bytes, regardless of the LinePitchEnable parameter setting.

设置线路间距,将图像数据对齐至 4 字节字#

要将图像数据对齐 4 字节字:

  1. 像素格式设置为压缩 12 位像素格式(例如 Mono 12p 或 Bayer 12p)以外的任何格式。
  2. Set the LinePitchEnable parameter to true.

如果当前行距不是 4 的倍数,则将自动设置为 4 的下一个倍数。图像数据现在会对齐 4 字节字(32 位字)。

设置线路间距,将图像数据对齐到任何字长#

设置行距并将图像数据对齐任意字长:

  1. 像素格式设置为压缩 12 位像素格式(例如 Mono 12p 或 Bayer 12p)以外的任何格式。
  2. Set the LinePitchEnable parameter to true.
    If the current line pitch is not a multiple of four, the line pitch is automatically set to the next multiple of four.
  3. Get the value of the LinePitch parameter.
    This returns the minimum possible value for the line pitch adjustment.
  4. Set the LinePitch parameter to the desired value.
    For a 4-byte, 8-byte, 16-byte, etc. word alignment, set the parameter value to the next multiple of 4, 8, 16, etc., starting at the minimum possible value determined in step 2. Example: If the value determined in step 2 is 252 and you want to align the image data to 8-byte words, set the LinePitch parameter to 256 (= the next multiple of 8).

示例代码#

// Enable the line pitch feature
camera.LinePitchEnable.SetValue(true);
// Get the current line pitch
int64_t i = camera.LinePitch.GetValue();
// Set the Line Pitch parameter value to the next multiple of 8
camera.LinePitch.SetValue(((i+7)/8)*8);

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

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