跳转到内容

Pixel Beyond#

相机的 Pixel Beyond 功能可让您降低相机输出图像的分辨率。

此功能类似于 Binning 功能,但可以更精细地调整分辨率。

有关更多信息,请参见 Basler 网站上的功能描述。

该功能的使用#

为什么使用 Pixel Beyond#

Pixel Beyond 功能类似于 Binning 功能。相机会合并相邻像素的像素值。这有效地降低了分辨率,而不会改变视野。

根据您的应用程序和图像传感器的特性,此功能可能会带来以下好处:

  • 光响应增强
  • 减少数据量
  • 提高帧速率
  • 改善信噪比 (SNR)
  • 能够模拟其他传感器的分辨率。例如,这使您无需重新设计视觉系统即可更换已停产的传感器。

而 Binning 功能仅允许您以整数级(例如使用 2x2 或 3x3 binning)降低分辨率,Pixel Beyond 功能可让您使用浮点 scaling 值来调整分辨率。Pixel Beyond 功能提供了更大的灵活性。

此外,与其他缩放算法不同,结果图像的 EMVA 数据不受篡改的影响。

配置 Pixel Beyond#

要配置 Pixel Beyond,请执行以下操作:

  1. 确保相机空闲,即未在捕获图像。
  2. 如果您的相机是彩色相机,则将像素格式设置为非拜耳色彩像素格式,即设置为可用的 RGB、BGR 或 YUV 像素格式。
  3. Set the BslScalingFactor parameter to a value between 1.0 and 2.8.

系数为 1.0 时,图像分辨率保持不变。大于 1.0 的系数会成比例地减小图像的 width 和 height:

  • Width * (1 / BslScalingFactor) = Scaled Width
  • Height * (1 / BslScalingFactor) = Scaled Height

示例:假设将 image ROI 的 width 设置为 1936,并将 scaling 系数设置为 1.75。相机输出的图像 width 为 1936 * (1/1.75) = 1106。

信息

根据相机型号的不同,数值会四舍五入。因此,有效图像大小可能与计算的图像大小不同。

计算 Scaling 系数#

图像大小#

如果要将图像缩放到特定大小并需要知道 scaling 系数,请使用以下公式:

Width / Desired Width = BslScalingFactor

由于 Scaling 总是按比例执行,因此您只需要指定 width 即可。

示例:假设 image ROI 为 1936 x 1216,并且您希望将图像缩放到 800 x600。相应的 scaling 系数是 1936/800 = 2.42。

像素大小#

如果要用特定的像素大小替换已停产的传感器并需要知道 scaling 系数,请使用以下公式:

Previous Sensor Pixel Size / Current Sensor Pixel Size = BslScalingFactor

示例:假设您要用 a2A1920-51gcPRO(3.45 µm 像素大小)的 IMX392 传感器替换像素大小为 7.4 µm 的 ICX424 传感器。相应的 scaling 系数为 7.4/3.45 = 2.14。

示例代码#

// Set scaling to 1.5, i.e., set the resolution
// to (1 / 1.5) = 66 % of the original resolution
camera.BslScalingFactor.SetValue(1.5);
// Disable scaling
camera.BslScalingFactor.SetValue(1.0);
INodeMap& nodemap = camera.GetNodeMap();
// Set scaling to 1.5, i.e., set the resolution
// to (1 / 1.5) = 66 % of the original resolution
CFloatParameter(nodemap, "BslScalingFactor").SetValue(1.5);
// Disable scaling
CFloatParameter(nodemap, "BslScalingFactor").SetValue(1.0);
// Set scaling to 1.5, i.e., set the resolution
// to (1 / 1.5) = 66 % of the original resolution
camera.Parameters[PLCamera.BslScalingFactor].SetValue(1.5);
// Disable scaling
camera.Parameters[PLCamera.BslScalingFactor].SetValue(1.0);
/* 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 */
/* Set scaling to 1.5, i.e., set the resolution */
/* to (1 / 1.5) = 66 % of the original resolution */
errRes = PylonDeviceSetFloatFeature(hdev, "BslScalingFactor", 1.5);
CHECK(errRes);
/* Disable scaling */
errRes = PylonDeviceSetFloatFeature(hdev, "BslScalingFactor", 1.0);
CHECK(errRes);
# Set scaling to 1.5, i.e., set the resolution
# to (1 / 1.5) = 66 % of the original resolution
camera.BslScalingFactor.Value = 1.5
# Disable scaling
camera.BslScalingFactor.Value = 1.0

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