SFNC —— 图像格式控制(三)(上)

简介: SFNC —— 图像格式控制(三)

4、图像格式控制(Image Format Control)

    本章介绍了如何影响和确定图像的大小和格式。它还提供了获取和显示图像数据所需的信息。它假定该设备具有生成单个矩形图像的数据源。该图像可以使用一个或多个感兴趣区域(ROI)完全或部分流出设备。

图 4-1:图像大小和定义一个感兴趣的区域


   该传感器提供 传感器宽度(SensorWidth) ✖️ 传感器高度(SensorHeight) 的像素。


   使用绑定水平(BinningHorizontal)和/或绑定垂直(BinningVertical)或水平减小(DecimationHorizontal)和/或垂直减小(DecimationVertical)的图像被缩小到 宽度最大值(WidthMax) ✖️ 高度最大值(HeightMax) 像素。


   此外,ReverseX 和 ReverseY 功能可以分别沿 X 轴或 Y 轴翻转图像。翻转是在应用感兴趣的区域之前完成的。


   在缩小的图像中,用户可以使用 OffsetX、OffsetY、宽度(Width)和高度(Height)来设置感兴趣的区域。由设备生成的结果图像具有 宽度 ✖️ 高度 像素。OffsetX 和 OffsetY 是针对具有坐标(0,0)的图像的左上角给出的(见图 4-1)。如果该设备支持多个感兴趣的区域,则可以使用区域选择器(RegionSelector)、区域模式(RegionMode)和区域目的地(RegionDestination)特征来分别选择和控制每个区域。所有度量都以像素给出。因此,如果像素格式(PixelFormat)更改,值也不应该改变。对于单色相机,每个像素对应一个灰度值。用于原始模式下的彩色相机(拜耳彩色相机等)每个像素对应于颜色掩模中的一个像素。对于 RGB 模式下的彩色相机,每个像素对应一个 RGB 三联体。对于在 YUV 模式下的彩色相机,每个像素对应一个 Y 值和相关的颜色信息。


   特征高度(Height)是指以直线表示图像的高度。一条直线内的像素都是连续的。然而,这些线可能不是连续的,例如,为了产生一个 DWORD 对齐。LinePitch 给出了分隔两条连续行的开始像素的字节数。


   图像中的每个像素都具有由像素格式(PixelFormat)特征定义的格式。本文档只提供了可能的像素格式的子集。可能的标准像素格式及其布局的完整列表可以在单独的 “GenICam Pixel Format Naming Convention (PFNC)” 规范中找到(参见 EMVA 网站上的 GenICam 下载页面 )。这个网页还给出了当前标准化的像素格式的列表及其唯一的标识符值(参见 “GenICam像素格式值” 和 “PFNC的参考头文件” 文档)。


   因为像素格式(PixelFormat)特征包含了用户指定的信息和设备提供的信息的混合,所以它适合于描述整个像素设置,但在必须设置或查询个别设置时可能不太实用。因此,第二组特征是由像素格式(PixelFormat)的各个组件组成。这些功能包括像素大小(PixelSize)、像素颜色过滤器(PixelColorFilter)、最小像素动态范围(PixelDynamicRangeMin)和最大像素动态范围(PixelDynamicRangeMax)。


   即使像素格式(PixelFormat)可能允许,例如每像素 16 位,真实图像数据可能只提供一定范围的值(例如每像素 12 位,因为相机仅配备了 12 位模拟到数字转换器)。在这种情况下,最小像素动态范围(PixelDynamicRangeMin)和最大像素动态范围(PixelDynamicRangeMax)指定了图像中像素值的下限和上限。一般来说,最小像素动态范围(PixelDynamicRangeMin)应该为零,最大像素动态范围(PixelDynamicRangeMax)应该为 2 的幂(【0,2DataDepth - 1】)。在这个范围内不应该有丢失的代码。

1. 图像格式控制(Image Format Control)

图像格式控制功能。

  <Category NameSpace="Standard" Name="ImageFormatControl">
    <ToolTip>Category for image format control features.</ToolTip>
    <Description>Category for image format control features.</Description>
    <DisplayName>Image Format Control</DisplayName>
    <Visibility>Beginner</Visibility>
    <ImposedAccessMode>RO</ImposedAccessMode>
    <!--<pFeature>SensorWidth</pFeature>
    <pFeature>SensorHeight</pFeature>-->
    <pFeature>SensorTaps</pFeature>
    <pFeature>SensorDigitizationTaps</pFeature>
    <pFeature>WidthMax</pFeature>
    <pFeature>HeightMax</pFeature>
    <pFeature>RegionSelector</pFeature>
    <pFeature>RegionMode</pFeature>
    <pFeature>RegionDestination</pFeature>
    <pFeature>Width</pFeature>
    <pFeature>Height</pFeature>
    <pFeature>OffsetX</pFeature>
    <pFeature>OffsetY</pFeature>
    <pFeature>LinePitch</pFeature>
    <pFeature>ReverseX</pFeature>
    <pFeature>ReverseY</pFeature>
    <pFeature>ReverseScanDirection</pFeature>
    <pFeature>PixelFormat</pFeature>
    <pFeature>SelectBitRegion</pFeature>
    <pFeature>PixelSize</pFeature>
    <pFeature>ImageCompressionMode</pFeature>
    <pFeature>ImageCompressionQuality</pFeature>
    <pFeature>HBAbnormalMonitor</pFeature>
    <pFeature>HBVersion</pFeature>
    <pFeature>TestPatternGeneratorSelector</pFeature>
    <pFeature>TestPattern</pFeature>
    <pFeature>BinningSelector</pFeature>
    <pFeature>BinningHorizontal</pFeature>
    <pFeature>BinningVertical</pFeature>
    <pFeature>DecimationHorizontal</pFeature>
    <pFeature>DecimationVertical</pFeature>
    <pFeature>PixelDynamicRangeMin</pFeature>
    <pFeature>PixelDynamicRangeMax</pFeature>
    <pFeature>Deinterlacing</pFeature>
    <pFeature>FrameSpecInfoSelector</pFeature>
    <pFeature>FrameSpecInfo</pFeature>
  </Category>

2. 传感器宽度(SensorWidth)

    <Integer NameSpace="Standard" Name="SensorWidth">
      <ToolTip>Effective width of the sensor in pixels.</ToolTip>
      <Description>Effective width of the sensor in pixels.</Description>
      <DisplayName>Sensor Width</DisplayName>
      <Visibility>Expert</Visibility>
      <pValue>SensorWidth_Reg</pValue>
    </Integer>

    <IntReg Name="SensorWidth_Reg">
      <pAddress>SensorWidth_RegAddr</pAddress>
      <Length>4</Length>
      <AccessMode>RO</AccessMode>
      <pPort>Device</pPort>
      <Sign>Unsigned</Sign>
      <Endianess>BigEndian</Endianess>
    </IntReg>

      <Integer Name="SensorWidth_RegAddr">
        <Value>0x00030300</Value>
      </Integer>

3. 传感器高度(SensorHeight)

    <Integer NameSpace="Standard" Name="SensorHeight">
      <ToolTip>Effective height of the sensor in pixels.</ToolTip>
      <Description>Effective height of the sensor in pixels.</Description>
      <DisplayName>Sensor Height</DisplayName>
      <Visibility>Expert</Visibility>
      <pValue>SensorHeight_Reg</pValue>
    </Integer>

    <IntReg Name="SensorHeight_Reg">
      <pAddress>SensorHeight_RegAddr</pAddress>
      <Length>4</Length>
      <AccessMode>RO</AccessMode>
      <pPort>Device</pPort>
      <Sign>Unsigned</Sign>
      <Endianess>BigEndian</Endianess>
    </IntReg>

      <Integer Name="SensorHeight_RegAddr">
        <Value>0x00030304</Value>
      </Integer>

5. 最大宽度(WidthMax)

    图像的最大宽度(以像素为单位)。该尺寸是在水平装箱( horizontal binning)、抽取(decimation)或任何其他函数改变图像的水平尺寸后计算的。

    WidthMax 不考虑当前感兴趣的区域(Width 或 OffsetX)。其值必须大于 0 且小于或等于传感器宽度(SensorWidth)(除非存在过采样特征)。

7. 区域选择器(RegionSelector)

    选择要控制的感兴趣的区域。区域选择器功能允许能够从图像中提取多个区域的设备,以独立地配置这些单个区域的特征。

    RegionX 通常用于配置传感器的区域提取特征。区域可以重叠,也可以用于以不同的像素格式或数据压缩类型提供同一区域的数据。

  例如,要提供一个传感器区域的 RGB 未压缩强度和 YUV JPEG 压缩强度:

RegionSelector = Region0          // Select Region 0
RegionMode[Region0] = On          // Instance 0 (default ON)
ComponentSelector = Intensity         // Select Intensity
ComponentEnable[Region0][Intensity] = true  // Enable instance 0 streaming (default).
PixelFormat[Region0][Intensity] = RGB8    // RGB 24 bit per pixel.
ImageCompressionMode[Region0][Intensity] = Off // Instance 0 Uncompressed.

RegionSelector = Region1          // Select Region 1
RegionMode[Region1] = On          // Instance 1
ComponentSelector = Intensity         // Select Intensity
Component [Intensity] = true        // Enable instance 1 streaming.
PixelFormat[Region1][Intensity] = YUV422_8  // YUV 16 bit per pixel.
ImageCompressionMode[Region1][Intensity] = JPEG // Instance 1 Compressed

   其他处理模块输出区域可用于配置处理模块输出的大小和特征(参见例如的 “3D设备数据输出控制” 章节)。这些处理模块输出区域应该采用处理模块本身的名称,后面跟着它们的索引(如 Scan3dExtractionX )。


   请注意,如果设备支持多个感兴趣的区域,则区域选择器(RegionSelector)可以添加到各种功能中,如宽度、高度、……来指定所选区域的特征。为了简化标准文本和特性描述(参见上面的示例),可选的区域选择器没有显式地传播到它可能选择的 SFNC 的所有特性。


可能的值是:


区域0(Region0):选定的特性将控制区域 0。

区域1(Region1):选定的特性将控制区域 1。

区域2(Region2):选定的特性将控制区域 2。

Scan3dExtraction0(扫描3d提取0):选定的特性将控制 Scan3dExtraction0 输出区域。

Scan3dExtraction1:选定的特性将控制 Scan3dExtraction1 输出区域。

Scan3dExtraction2:选定的特性将控制 Scan3dExtraction2 输出区域。

所有(All):选定的功能将同时控制所有区域。

8. 区域模式(RegionMode)

控制所选的感兴趣区域是否处于活动状态和流媒体状态。可能的值是:

  • 关闭:禁用区域的使用。
  • 开启:启用区域的使用。

9. 区域目的地(RegionDestination)

控制选定区域的目的地。可能的值是:

  • Stream0:该区域的目标是数据流 0。
  • Stream1:该区域的目的地是数据流 1。
  • Stream2:该区域的目的地是数据流 2。
    <Enumeration NameSpace="Standard" Name="RegionDestination">
      <ToolTip>Control the destination of the selected region.</ToolTip>
      <Description>Control the destination of the selected region.</Description>
      <DisplayName>Region Destination</DisplayName>
      <Visibility>Guru</Visibility>
      <pIsLocked>TLParamsLocked</pIsLocked>
      <ImposedAccessMode>RW</ImposedAccessMode>
      <Streamable>Yes</Streamable>
      <EnumEntry NameSpace="Standard" Name="Stream0">
        <ToolTip>The destination of the region is the data stream 0.</ToolTip>
        <Description>The destination of the region is the data stream 0.</Description>
        <DisplayName>Stream 0</DisplayName>
        <pIsImplemented>stream0_Inq</pIsImplemented>
        <Value>0</Value>
      </EnumEntry>
      <EnumEntry NameSpace="Standard" Name="Stream1">
        <ToolTip>The destination of the region is the data stream 1.</ToolTip>
        <Description>The destination of the region is the data stream 1.</Description>
        <DisplayName>Stream 1</DisplayName>
        <pIsImplemented>stream1_Inq</pIsImplemented>
        <Value>1</Value>
      </EnumEntry>
      <EnumEntry NameSpace="Standard" Name="Stream2">
        <ToolTip>The destination of the region is the data stream 2.</ToolTip>
        <Description>The destination of the region is the data stream 2.</Description>
        <DisplayName>Stream 2</DisplayName>
        <pIsImplemented>stream2_Inq</pIsImplemented>
        <Value>2</Value>
      </EnumEntry>
      <pValue>RegionDestination_Reg</pValue>
    </Enumeration>

    <IntSwissKnife Name="stream0_Inq">
      <pVariable Name="INDEX">GevStreamChanIndexMax_Int</pVariable>
      <Formula>INDEX = 0</Formula>
    </IntSwissKnife>
    <IntSwissKnife Name="stream1_Inq">
      <pVariable Name="INDEX">GevStreamChanIndexMax_Int</pVariable>
      <Formula>INDEX > 0</Formula>
    </IntSwissKnife>
    <IntSwissKnife Name="stream2_Inq">
      <pVariable Name="INDEX">GevStreamChanIndexMax_Int</pVariable>
      <Formula>INDEX > 1</Formula>
    </IntSwissKnife>

    <IntReg NameSpace="Custom" Name="RegionDestination_Reg">
      <pAddress>RegionDestination_RegAddr</pAddress>
      <pAddress>RegionSelectorAddressOffset</pAddress>
      <Length>4</Length>
      <AccessMode>RW</AccessMode>
      <pPort>Device</pPort>
      <pInvalidator>UserSetLoad_Reg</pInvalidator>
      <Sign>Unsigned</Sign>
      <Endianess>BigEndian</Endianess>
    </IntReg>    

      <Integer Name="RegionDestination_RegAddr">
        <Value>0x00030320</Value>
      </Integer>
      ...

18. 宽度(Width)

    由设备提供的图像的宽度(以像素为单位)。

    这反映了当前感兴趣的区域。该特性的最大值考虑了水平装箱(horizontal binning)、抽取(decimation)或任何其他改变图像最大水平尺寸的功能,通常等于 WidthMax - OffsetX 。

    这一特性对于大多数传输层的发射机和收发器通常是必须具备的。

19. 高度(Height)

20. 水平偏移(OffsetX)

从原点到感兴趣区域的水平偏移量(以像素为单位)。

    <Integer NameSpace="Standard" Name="OffsetX">
      <ToolTip>Horizontal offset from the origin to the AOI (in pixels).</ToolTip>
      <Description>Horizontal offset from the origin to the AOI (in pixels).</Description>
      <DisplayName>Offset X</DisplayName>
      <Visibility>Beginner</Visibility>
      <ImposedAccessMode>RW</ImposedAccessMode>
      <Streamable>Yes</Streamable>
      <pValue>OffsetX_Reg</pValue>
      <Min>0</Min>
      <pMax>OffsetXMax_Int</pMax>
      <pInc>OffsetXInc_Int</pInc>
      <Representation>Linear</Representation>
    </Integer>

    <IntReg NameSpace="Custom" Name="OffsetX_Reg">
      <pAddress>OffsetX_RegAddr</pAddress>
      <pAddress>RegionSelectorAddressOffset</pAddress>
      <Length>4</Length>
      <AccessMode>RW</AccessMode>
      <pPort>Device</pPort>
      <pInvalidator>UserSetLoad_Reg</pInvalidator>
      <pInvalidator>BinningHorizontal_Val</pInvalidator>
      <pInvalidator>BinningVertical_Val</pInvalidator>
      <pInvalidator>DecimationHorizontal_Val</pInvalidator>
      <pInvalidator>DecimationVertical_Val</pInvalidator>
      <Sign>Unsigned</Sign>
      <Endianess>BigEndian</Endianess>
    </IntReg>

21. 垂直偏移(OffsetY)

24. 绑定选择器(BinningSelector)

选择由绑定水平和绑定垂直功能控制的绑定引擎。可能的值是:

  • 传感器(Sensor):选定的功能将控制传感器的装箱。
  • 区域0(Region0):选定的特性将控制区域0的装箱。
  • 区域1(Region1):选定的特性将控制区域1的装箱。
  • 区域2(Region2):选定的特性将控制区域2的装箱。

25. 绑定水平模式(BinningHorizontalMode)

设置在使用水平绑定时用来将水平光敏单元组合在一起的模式。可能的值是:

  • Sum:将添加来自组合细胞的响应,从而增加灵敏度。
  • 平均值(Average):对组合单元的响应将取平均值,导致信噪比增加。

26. 绑定水平(BinningHorizontal)

    要结合在一起的水平光敏细胞的数量。这就降低了图像的水平分辨率(宽度)。

    值为1表示照相机没有执行水平装箱。

27. 绑定垂直模式(BinningVerticalMode)

28. 绑定垂直(BinningVertical)

29. DecimationHorizontalMode

30. DecimationHorizontal

31. DecimationVerticalMode

32. DecimationVertical

33. 沿 X 轴翻转(ReverseX)

    水平翻转由设备发送的图像。感兴趣的区域在翻转后被应用。

    <Boolean NameSpace="Standard" Name="ReverseX">
      <ToolTip>Flip horizontally the image sent by the device.</ToolTip>
      <Description>Flip horizontally the image sent by the device. The AOI is applied after the flip.</Description>
      <DisplayName>Reverse X</DisplayName>
      <Visibility>Beginner</Visibility>
      <pIsImplemented>ReverseXInq_Reg</pIsImplemented>
      <ImposedAccessMode>RW</ImposedAccessMode>
      <Streamable>Yes</Streamable>
      <pValue>ReverseX_Reg</pValue>
    </Boolean>

    <IntReg NameSpace="Custom" Name="ReverseX_Reg">
      <pAddress>ReverseX_RegAddr</pAddress>
      <pAddress>RegionSelectorAddressOffset</pAddress>
      <Length>4</Length>
      <AccessMode>RW</AccessMode>
      <pPort>Device</pPort>
      <pInvalidator>UserSetLoad_Reg</pInvalidator>
      <Sign>Unsigned</Sign>
      <Endianess>BigEndian</Endianess>
    </IntReg>
    ...

34. 沿 Y 轴翻转(ReverseY)

SFNC —— 图像格式控制(三)(下):https://developer.aliyun.com/article/1598523

目录
相关文章
|
4月前
用*号输出字母C的图案
用*号输出字母C的图案。
35 2
|
4月前
|
存储 C语言
文字的输入输出
文字的输入输出
22 1
|
4月前
输出字母沙漏
输出字母沙漏
|
4月前
|
C语言
c语言编程练习题:7-3 输出带框文字
本题要求编写程序,输出指定的带框文字。
88 0
|
4月前
|
机器学习/深度学习 编译器 C语言
【C语言】数据输出的域宽控制(如何在输出数据时控制0占位)(如何输出前导0)(保留几位小数)(乘法口诀表打印不齐)等问题
【C语言】数据输出的域宽控制(如何在输出数据时控制0占位)(如何输出前导0)(保留几位小数)(乘法口诀表打印不齐)等问题
65 0
|
11月前
|
C++ 计算机视觉 Python
OpenCV-图像字符化
OpenCV-图像字符化
|
21天前
|
编解码 算法 BI
SFNC —— 图像格式控制(三)(下)
SFNC —— 图像格式控制(三)
28 3
|
4月前
【图片公式识别】图片公式转Word与LaTeX文档:智能识别与转换
【图片公式识别】图片公式转Word与LaTeX文档:智能识别与转换
176 4
|
JSON 数据格式
分割生成的24位深的彩图转换为8位深的彩图
分割生成的24位深的彩图转换为8位深的彩图
|
9月前
QT-使用QLinearGradient生成比色卡,将QVector转换成伪彩图
QT-使用QLinearGradient生成比色卡,将QVector转换成伪彩图
89 0