基础概念
组件
Percipio深度相机作为一款高度集成的智能设备,其内部包含多种关键组件,包括:左右两个单色图像传感器用于捕捉深度信息;激光投射器辅助深度测量;彩色图像传感器提供高清晰度的彩色图像;惯性测量单元(IMU)用于精确的空间姿态数据。这些硬件模块统称为 “组件”(Component)。
此外,Percipio深度相机系统中还引入了虚拟组件的概念,例如深度图像传感器模拟器或直方图处理单元,它们虽然没有实体形式,但从数据访问和功能调用的角度看,用户能够像操作物理器件那样无缝对接并进行相应参数设置与功能调控。
作为一个整体设备,Percipio深度相机具备一系列核心属性及配置选项,包括但不限于工作模式设定、连接状态维持、网络配置管理(包括数据重传机制)、以及与光学系统相关的外部参数校准等。为了方便用户对这些属性进行统一管理和访问,我们将整个相机系统设计为一个抽象的“设备组件”(Device Component),确保用户能高效地控制和优化相机的各项性能。
相机包含的全体组件定义如下:
typedef enum TY_DEVICE_COMPONENT_LIST
{
TY_COMPONENT_DEVICE = 0x80000000, ///< Abstract component stands for whole device, always enabled
TY_COMPONENT_DEPTH_CAM = 0x00010000, ///< Depth camera
TY_COMPONENT_IR_CAM_LEFT = 0x00040000, ///< Left IR camera
TY_COMPONENT_IR_CAM_RIGHT = 0x00080000, ///< Right IR camera
TY_COMPONENT_RGB_CAM_LEFT = 0x00100000, ///< Left RGB camera
TY_COMPONENT_RGB_CAM_RIGHT = 0x00200000, ///< Right RGB camera
TY_COMPONENT_LASER = 0x00400000, ///< Laser
TY_COMPONENT_IMU = 0x00800000, ///< Inertial Measurement Unit
TY_COMPONENT_BRIGHT_HISTO = 0x01000000, ///< virtual component for brightness histogram of ir
TY_COMPONENT_STORAGE = 0x02000000, ///< virtual component for device storage
TY_COMPONENT_RGB_CAM = TY_COMPONENT_RGB_CAM_LEFT ///< Some device has only one RGB camera, map it to left
}TY_DEVICE_COMPONENT_LIST;
其中,
TY_COMPONENT_DEVICE 代表独立深度相机实体,以下简称 深度相机。通过该组件可以控制相机的工作模式、内部 Sensor 曝光同步模式、光学外参等属性。
TY_COMPONENT_DEPTH_CAM 代表深度图像传感器组件。
TY_COMPONENT_IR_CAM_LEFT 代表左单色图像传感器组件。
TY_COMPONENT_IR_CAM_RIGHT 代表右单色图像传感器组件。
TY_COMPONENT_RGB_CAM_LEFT 代表左彩色图像传感器组件。若深度相机仅有一个彩色图像传感器组件,TY_COMPONENT_RGB_CAM 默认代表 TY_COMPONENT_RGB_CAM_LEFT。
TY_COMPONENT_RGB_CAM_RIGHT 代表右彩色图像传感器组件。
属性
在 SDK 开发框架中,深度相机及其各个组成部件都具有丰富的功能参数,这些参数在软件层面被称作“属性”或“特性”(features)。针对每个属性的具体特点,SDK 设计了不同类型的数据结构来封装它们,例如使用 int 类型表示整数值属性、bool 类型表示布尔属性、struct 结构体存储复杂数据属性,以及 enum 枚举类型来定义有限集合的属性选项。
开发者通过一套统一命名风格的 API 接口与深度相机的组件属性进行交互。例如,使用 TYGetInt 和 TYSetInt 来获取或设置整数类型的属性值,TYGetStruct 和 TYSetStruct 则用于读取或更新结构化数据类型的属性。
此外,深度相机中各组件的属性间可能存在联动效应。也就是说,在调整某个组件的一项属性时,系统会自动触发关联机制,使得另一组件内的相同或相关属性也随之更新,这种关联机制在SDK中被称为“绑定”(binding)。你可以通过查询 SDK 提供的属性信息,了解到具体的绑定关系,以便在配置和操作相机时实现跨组件的一致性和协同性。
备注
需要注意的是,不同型号和不同版本的深度相机可能支持不同的组件组合和属性设置,因此在实际应用中需根据具体设备的规格和能力来适配和调用相应的属性与功能。
通过以下方式,可查询深度相机支持的组件和属性:
通过 API 可查询深度相机支持的组件和属性。
通过 SDK 示例程序 DumpAllFeatures 可列出当前操作相机的所有组件和支持的属性信息。
通过 SDK 示例程序 DumpAllFeatures -d,可以生成 fetch_config.xml 文件,在该文件中可以查看深度相机支持的组件和属性。
通过 Percipio Viewer 软件生成 fetch_config.xml 文件。将软件和新建的 fetch_config.xml 文件放置于同一目录层级,之后打开软件选择相机,在此文件中可以查看该深度相机支持的组件和属性。
以 PS800-E1 为例,该相机包含的组件、支持的属性以及属性与组件的隶属关系,请参考下方 fetch_config.xml 文件内的配置描述:
1<?xml version="1.0" ?>
2<config version="1">
3<comprotocol>1.0</comprotocol>
4<component id="0x80000000" addr="0x01000000" name="device">
5<feature id="0x5f00" name="SN" rw="1">207000145056</feature>
6<feature id="0x5f01" name="vendor" rw="1">Percipio</feature>
7<feature id="0x5f02" name="model" rw="1">PS800-E1</feature>
8<feature id="0x5f08" name="user defined name" rw="1">Percipio</feature>
9<feature id="0x1202" addr="0x204" name="frame per trigger" rw="3">1</feature>
10<feature id="0x7523" addr="0x208" name="struct trigger mode" rw="3"/>
11<feature id="0x7525" addr="0x218" name="struct trigger mode ex" rw="3"/>
12<feature id="0x1010" absaddr="0x64c" name="persistent IP" rw="3"/>
13<feature id="0x1011" absaddr="0x65c" name="persistent netmask" rw="3"/>
14<feature id="0x1012" absaddr="0x66c" name="persistent gateway" rw="3"/>
15<feature id="0x1014" addr="0x400020" name="packet delay" rw="3" min="0" max="10000" inc="1"/>
16<feature id="0x1017" addr="0x40002c" name="packet size" rw="3" min="100" max="1500" inc="1"/>
17<feature id="0x1016" addr="0x400024" name="ntp server ip" rw="3"/>
18<feature id="0x4207" addr="0x214" name="trigger out io" rw="2" writableAtRun="1"/>
19<feature id="0x4203" name="keep alive onoff" rw="3"/>
20<feature id="0x1204" name="keep alive timeout" rw="3" min="2000" inc="1" max="30000"/>
21<feature id="0x1206" addr="0x210" name="trigger delay us" rw="3" min="0" max="1300000" inc="1"/>
22<feature id="0x1208" addr="0x21C" name="trigger duration us" rw="3" min="1" max="1300000" inc="1"/>
23<feature id="0x3209" addr="0x220" name="stream async" rw="3">
24<entry name="async off" value="0"/>
25<entry name="async depth" value="1"/>
26<entry name="async rgb" value="2"/>
27<entry name="async depth rgb" value="3"/>
28<entry name="async all" value="255"/>
29</feature>
30<feature id="0x3201" addr="0x200" name="trig pol" rw="3">
31<entry name="falling edge" value="0"/>
32<entry name="rising edge" value="1"/>
33</feature>
34<feature id="0x1210" addr="0x228" name="capture time us" rw="1" volatile="1"/>
35<feature id="0x3211" addr="0x22c" name="sync type" rw="3" volatile="1">
36<entry name="sync type none" value="0"/>
37<entry name="sync type host" value="1"/>
38<entry name="sync type ntp" value="2"/>
39<entry name="sync type ptp slave" value="3"/>
40<entry name="sync type can" value="4"/>
41<entry name="sync type ptp master" value="5"/>
42</feature>
43<feature id="0x4212" addr="0x230" name="sync ready" rw="1" volatile="1"/>
44<feature id="0x7216" addr="0x268" name="struct DI0 workmode" rw="3" volatile="1"/>
45<feature id="0x4213" addr="0x23c" name="flash light enable" rw="3" volatile="1" writableAtRun="1"/>
46<feature id="0x1214" addr="0x240" name="flash light intensity" rw="3" min="0" max="63" inc="1" volatile="1" writableAtRun="1"/>
47<intpf>AWQAUAA=</intpf>
48 <feature id="0x5f03" name="hardware version" rw="1" hide="0">1.3.0</feature>
49 <feature id="0x5f04" name="firmware version" rw="1" hide="0">3.13.77</feature>
50 <build>
51 <hash>model:AP03B04-019PS80X_X_X_F107_XXL15_DVP_DF64;rtl:R0.2.6_0_g26e2cbc085;kernel:R3.13.77-0-gc484756878;tycam:R3.6.49-86ae766a;gevcam:R3.13.77-0-gd613cccf</hash>
52 </build>
53<config_version>r3.16.0-eb81650707b95226ef8526ea1282c0d3d398638d
54Wed May 8 10:01:47 UTC 2024</config_version>
55<tech_model>PS801-GTIS3-46-CBS-MT4-V3</tech_model>
56<generated_time>2024-05-11T164623</generated_time>
57<calibration_time>2024-05-11T164128</calibration_time>
58</component>
59<component id="0x00010000" addr="0x02000000" name="depth">
60<feature id="0x210a" addr="0x63c" name="scale unit" rw="3" hide="0" min="0.0125" max="8.0" writableAtRun="1">0.25</feature>
61<feature id="0x1003" name="intrinsic width" rw="1" hide="1">1280</feature>
62<feature id="0x1004" name="intrinsic height" rw="1" hide="1">960</feature>
63<feature id="0x7000" name="depth intrinsic" rw="1" hide="0">1073.2040217906153 0.0 613.8592872619629 0.0 1073.2040217906153 468.30674934387207 0.0 0.0 1.0</feature>
64<feature id="0x1104" addr="0x10" name="image width" rw="1" hide="0"/>
65<feature id="0x1105" addr="0x14" name="image height" rw="1" hide="0"/>
66<feature id="0x3109" addr="0x18" name="image mode" rw="3" hide="0">
67<entry value="0x202801e0" name="DEPTH16_640x480"/>
68<entry value="0x205003c0" name="DEPTH16_1280x960"/>
69<entry value="0x201400f0" name="DEPTH16_320x240"/>
70</feature>
71<feature id="0x1610" addr="0x600" name="image number" rw="3" hide="1" min="1" max="20">18</feature>
72<feature id="0x1611" addr="0x604" name="disparity num" rw="3" hide="1" min="1" max="320" writableAtRun="1">256</feature>
73<feature id="0x1612" addr="0x608" name="disparity offset" rw="3" hide="1" min="-1280" max="1280" writableAtRun="1">-64</feature>
74<feature id="0x1613" addr="0x60c" name="match window height" rw="3" hide="1" min="1" inc="2" max="21" writableAtRun="1">5</feature>
75<feature id="0x1614" addr="0x610" name="semi global param p1" rw="3" hide="1" min="0" max="10000" writableAtRun="1" available="1">100</feature>
76<feature id="0x161f" addr="0x640" name="semi global param p1 scale" rw="3" hide="1" min="0" max="25" writableAtRun="1" available="1">15</feature>
77<feature id="0x1615" addr="0x614" name="semi global param p2" rw="3" hide="1" min="0" max="10000" writableAtRun="1">400</feature>
78<feature id="0x1616" addr="0x618" name="uniqueness factor param" rw="3" hide="1" min="0" max="511" writableAtRun="1">10</feature>
79<feature id="0x1617" addr="0x61c" name="uniqueness min absolute diff" rw="3" hide="1" min="0" max="10000" writableAtRun="1">400</feature>
80<feature id="0x4619" addr="0x624" name="enable half window size" rw="3" hide="1" writableAtRun="1">true</feature>
81<feature id="0x161a" addr="0x628" name="match window width" rw="3" hide="1" min="1" inc="2" max="9" writableAtRun="1">5</feature>
82<feature id="0x461b" addr="0x62C" name="enable median filter" rw="3" hide="1" writableAtRun="1">1</feature>
83<feature id="0x461c" addr="0x630" name="enable LRC" rw="3" hide="1" writableAtRun="1">true</feature>
84<feature id="0x161d" addr="0x634" name="max LRC diff" rw="3" hide="1" min="1" max="4095" writableAtRun="1">8</feature>
85<feature id="0x161e" addr="0x638" name="median filter thresh" rw="3" hide="1" min="1" max="511" writableAtRun="1">100</feature>
86</component>
87<component id="0x00040000" addr="0x03000000" name="leftir">
88<feature id="0x3109" addr="0x18" name="image mode" rw="1">
89<entry value="0x105003c0" name="mono8 1280x960"/>
90</feature>
91<feature id="0x1104" addr="0x10" name="image width" rw="1">1280</feature>
92<feature id="0x1105" addr="0x14" name="image height" rw="1">960</feature>
93<feature id="0x1003" name="intrinsic width" rw="1">1280</feature>
94<feature id="0x1004" name="intrinsic height" rw="1">960</feature>
95<feature id="0x7000" name="intrinsic" rw="1">1100.6952721670125 0.0 630.1894430853371 0.0 1101.3994335710292 479.94054380837383 0.0 0.0 1.0</feature>
96<feature id="0x7006" name="distortion" rw="1">-0.40568760677884036 0.21042712656286902 -0.00019515899074187 -0.001014770123605808 0.2514029784195565 -0.13803577788511526 -0.0021543035461411074 0.40575126361969927 0.0014486106860389625 0.00031136534592681386 0.00018303776328585516 -0.00010687999542134591</feature>
97<feature id="0x7008" name="rectified intrinsic" rw="1">1073.2040217906153 0.0 613.8592872619629 0.0 1073.2040217906153 468.30674934387207 0.0 0.0 1.0</feature>
98<feature id="0x4510" addr="0x324" name="undistort" rw="3"/>
99<feature id="0x1301" addr="0x304" name="exposure time" rw="3" min="3" max="990" inc="1" writableAtRun="1"/>
100<feature id="0x1303" addr="0x310" name="gain" rw="3" min="0" max="255" inc="1" writableAtRun="1"/>
101<feature id="0x1524" addr="0x328" name="analog gain" rw="3" min="0" max="3" inc="1" writableAtRun="1"/>
102<feature id="0x4525" addr="0x32C" name="hdr" rw="3" inc="1" max="1" min="0" writableAtRun="1"/>
103<feature id="0x6526" addr="0x330" name="hdr parameter" rw="3" inc="1" size="32" valid_size="8" unit_size="4" writableAtRun="1" volatile="1"/>
104</component>
105<component id="0x00080000" addr="0x04000000" name="rightir">
106<feature id="0x3109" addr="0x18" name="image mode" rw="1">
107<entry value="0x105003c0" name="mono8 1280x960"/>
108</feature>
109<feature id="0x1104" addr="0x10" name="image width" rw="1">1280</feature>
110<feature id="0x1105" addr="0x14" name="image height" rw="1">960</feature>
111<feature id="0x1003" name="intrinsic width" rw="1">1280</feature>
112<feature id="0x1004" name="intrinsic height" rw="1">960</feature>
113<feature id="0x7000" name="intrinsic" rw="1">1101.286729469945 0.0 657.9652417779816 0.0 1101.6891788579726 453.9644541816893 0.0 0.0 1.0</feature>
114<feature id="0x7006" name="distortion" rw="1">-0.4001293840720483 0.30006544510814087 0.0003408942664569808 -0.00013428158371473053 0.23584441523499375 -0.1322465918263015 0.09217446099981051 0.40314358975469083 -6.538770538611225e-05 7.631802025443891e-05 -0.0001639147125260009 -0.0004867629549698752</feature>
115<feature id="0x7008" name="rectified intrinsic" rw="1">1073.2040217906153 0.0 677.8592872619629 0.0 1073.2040217906153 468.30674934387207 0.0 0.0 1.0</feature>
116<feature id="0x7001" name="rightIR to leftIR extrinsic" rw="1"> 0.9978037442200134 0.0008293631421208591 0.06623443347157719 -62.18972420855701 -0.0005915417247800224 0.9999933084904514 -0.0036101319517471667 -0.16155123069578964 -0.06623698437361213 0.003563022747566014 0.9977975580096348 2.245453365804675 0.0 0.0 0.0 1.0</feature>
117<feature bind="0x00044510"/>
118<feature id="0x1301" addr="0x304" name="exposure time" rw="3" min="3" max="990" inc="1" writableAtRun="1"/>
119<feature id="0x1303" addr="0x310" name="gain" rw="3" min="0" max="255" inc="1" writableAtRun="1"/>
120<feature id="0x1524" addr="0x328" name="analog gain" rw="3" min="0" max="3" inc="1" writableAtRun="1"/>
121<feature id="0x4525" addr="0x32C" name="hdr" rw="3" inc="1" max="1" min="0" writableAtRun="1"/>
122<feature id="0x6526" addr="0x330" name="hdr parameter" rw="3" inc="1" size="32" valid_size="8" unit_size="4" writableAtRun="1" volatile="1"/>
123</component>
124<component id="0x00100000" addr="0x05000000" name="rgb">
125<feature id="0x3109" addr="0x18" name="RgbImageMode" rw="3">
126<entry value="0x22a00780" name="yuyv 2560x1920"/>
127<entry value="0x227805a0" name="yuyv 1920x1440"/>
128<entry value="0x225003c0" name="yuyv 1280x960"/>
129<entry value="0x222801e0" name="yuyv 640x480"/>
130<entry value="0x63a00780" name="CSI BAYER12GR_2560x1920"/>
131</feature>
132<feature id="0x7305" addr="0x224" name="struct aec roi" rw="3" writableAtRun="1" volatile="1">
133<pIsAvailable>RgbROIEnabled</pIsAvailable>
134<pInvalidator>RgbImageMode</pInvalidator>
135</feature>
136<feature id="0x4300" addr="0x300" name="RgbAutoExpo" rw="3" writableAtRun="1">
137<pIsAvailable>ImageFormatIsYUV</pIsAvailable>
138<pInvalidator>RgbImageMode</pInvalidator>
139</feature>
140<feature addr="0x304" id="0x1301" inc="1" max="66600" min="0" name="exposure time" rw="3" writableAtRun="1">
141<pInvalidator>RgbImageMode</pInvalidator>
142<pInvalidator>RgbAutoExpo</pInvalidator>
143</feature>
144<feature id="0x4304" addr="0x314" name="RgbAWB" rw="3" writableAtRun="1">
145<pIsAvailable>ImageFormatIsYUV</pIsAvailable>
146<pInvalidator>RgbImageMode</pInvalidator>
147</feature>
148<feature addr="0x328" id="0x1524" inc="1" max="65535" min="1" name="analog gain" rw="3" writableAtRun="1">
149<pInvalidator>RgbImageMode</pInvalidator>
150<pInvalidator>RgbAutoExpo</pInvalidator>
151</feature>
152<feature addr="0x33c" id="0x1527" inc="1" max="4000" min="0" name="AETargetLuminance" rw="3" writableAtRun="1"/>
153<feature id="0x1104" addr="0x10" name="image width" rw="1" volatile="1"/>
154<feature id="0x1105" addr="0x14" name="image height" rw="1" volatile="1"/>
155<feature id="0x1003" name="intrinsic width" rw="1">2560</feature>
156<feature id="0x1004" name="intrinsic height" rw="1">1920</feature>
157<feature id="0x7000" name="rgb intrinsic" rw="1"> 1857.8589693648898 0.0 1311.9875231225446 0.0 1857.7812589358623 953.4581716026898 0.0 0.0 1.0</feature>
158<feature id="0x7001" name="rgb to leftIR extrinsic" rw="1"> 0.9998986173098701 0.006081967493844025 0.012874966920891712 -24.17065302515567 -0.0060614876841755365 0.9999803020151664 -0.0016290944451758582 -0.08810333058056606 -0.01288462140944854 0.0015508878297733945 0.9999157870931303 0.22397376356503673 0.0 0.0 0.0 1.0</feature>
159<feature id="0x7006" name="distortion" rw="1">0.29818175991645024 0.49299137206492255 -0.0008816478247179522 0.002398260351185693 0.23875401677661895 0.5587777613981387 0.4733394438485627 0.3932771946963275 -0.004899836600984737 0.0011023165487669096 0.0021098742163715143 -0.0006600235068870943</feature>
160</component>
161<component id="0x00400000" addr="0x07000000" name="laser">
162<feature id="0x1500" addr="0x500" name="power" rw="3" min="0" max="100" inc="1" writableAtRun="1">50</feature>
163<feature id="0x4501" addr="0x504" name="auto ctrl" rw="3"/>
164</component>
165<component id="0x01000000" addr="0x08000000" name="histogram">
166 </component>
167<component id="0x02000000" addr="0x09000000" name="storage">
168<feature id="0x600a" addr="0x100000" name="custom block" rw="3" volatile="1" size="4096"/>
169<feature id="0x600b" addr="0x200000" name="isp block" rw="3" volatile="1" size="65536"/>
170</component>
171<constraint id="0x00000001">
172<rules id="0x0001" msg="image_num x match_h out of range">
173<script>
174 FunctionCheck(a,b)
175 {
176 if (1) {
177 return ((a + 1) >> 1) * b <= 48;
178 } else {
179 return a * b <= 48;
180 }
181 }
182 </script>
183<parameter id="0x00011610" rw="1" hide="1">a</parameter>
184<parameter id="0x00011613" rw="1" hide="1">b</parameter>
185</rules>
186</constraint>
187<IntSwissKnife Name="ImageFormatIsYUV">
188<pVariable id="0x00103109">IMG_MODE</pVariable>
189<Formula>(IMG_MODE & 0xff000000) == 0x22000000</Formula>
190</IntSwissKnife>
191<IntSwissKnife Name="RgbROIEnabled">
192<pVariable id="0x00104300">AEC</pVariable>
193<pVariable id="0x00103109">IMG_MODE</pVariable>
194<Formula>((IMG_MODE & 0xff000000) == 0x22000000) && AEC</Formula>
195</IntSwissKnife>
196</config>
重要
fetch_config.xml 文件说明:
<component></component>一对组件标签内介绍了该组件支持的属性。
例如:
<component id="0x80000000" addr="0x01000000" name="device"> …… </component>
这对 <component></component> 组件标签内介绍了 device 组件支持的属性。
<feature></feature>一对属性标签内介绍了该属性的名称、读写权限、最大值、最小值、设值步长、设置方式,部分属性枚举了可设置值。
id:属性的唯一标识。前三位表示该属性的数据类型,0x1 表示 INT 型,0x2 表示 FlOAT 型,0x3 表示 ENUM 型,0x4 表示 BOOL 型,0x5 表示 STRING 型,0x6 表示 BYTEARRAY 型,0x7 表示 STRUCT 型。后三位表示属性的 ID。
name:属性名称。
rw:读写权限。rw=1 表示只读,rw=3 表示可读写。
min:该属性最小值。
max:该属性最大值。
inc:设值步长。inc=2 表示设置数值以 2 递增。
writableAtRun:设置方式。writableAtRun=1 表示该属性在相机采图过程中可设置,没有此说明的属性则必须在相机采图前设置。
<constraint></constraint>一对限制标签内介绍了参数设置的限制。
例如:
<constraint id="0x00000001"> <rules id="0x0001" msg="image_num x match_h out of range"> <script> FunctionCheck(a,b) { if (1) { return ((a + 1) >> 1) * b <= 48; } else { return a * b <= 48; } } </script> <parameter id="0x00011610" rw="1" hide="1">a</parameter> <parameter id="0x00011613" rw="1" hide="1">b</parameter> </rules> </constraint>
这对 <constraint></constraint> 标签介绍了 a、b 参数的设置要求。
请先根据 <parameter></parameter> 标签的 id 属性来定位 a 和 b 对应的具体参数,parameter id 是 component id|feature id 的结果。
再根据 <script></script> 标签内的 if 条件句,确认该相机适用于哪一条限制条件。此处是 if (1),则为第一个限制条件,即 [(a + 1) / 2] * b < 48。
<IntSwissKnife></IntSwissKnife>一对标签内定义数学公式和逻辑判断。
<IntSwissKnife Name="ImageFormatIsYUV"> <pVariable id="0x00103109">IMG_MODE</pVariable> <Formula>(IMG_MODE & 0xff000000) == 0x22000000</Formula> </IntSwissKnife> <IntSwissKnife Name="RgbROIEnabled"> <pVariable id="0x00104300">AEC</pVariable> <pVariable id="0x00103109">IMG_MODE</pVariable> <Formula>((IMG_MODE & 0xff000000) == 0x22000000) && AEC</Formula> </IntSwissKnife>
第一对 <IntSwissKnife></IntSwissKnife> 标签介绍了通过逻辑条件
(IMG_MODE & 0xff000000) == 0x22000000
判断 IMG_MODE 是 YUYV 格式。第二对 <IntSwissKnife></IntSwissKnife> 标签介绍了 AEC ROI 启用的两个条件。1. IMG_MODE 是 YUYV 格式。2. AEC 功能是启用状态。
不同的属性的数据值分为整型(INT)、布尔型(BOOL)、浮点型(FLOAT)、枚举型(ENUM)、结构体型(STRUCT)和字节数组型(BYTEARRAY),具体内容请参考属性定义:
typedef enum TY_FEATURE_ID_LIST :uint32_t
{
TY_STRUCT_CAM_INTRINSIC = 0x0000 | TY_FEATURE_STRUCT, ///< see TY_CAMERA_INTRINSIC
TY_STRUCT_EXTRINSIC_TO_DEPTH = 0x0001 | TY_FEATURE_STRUCT, ///< extrinsic between depth cam and current component , see TY_CAMERA_EXTRINSIC
TY_STRUCT_EXTRINSIC_TO_IR_LEFT = 0x0002 | TY_FEATURE_STRUCT, ///< extrinsic between left IR and current compoent, see TY_CAMERA_EXTRINSIC
TY_STRUCT_CAM_DISTORTION = 0x0006 | TY_FEATURE_STRUCT, ///< see TY_CAMERA_DISTORTION
TY_STRUCT_CAM_CALIB_DATA = 0x0007 | TY_FEATURE_STRUCT, ///< see TY_CAMERA_CALIB_INFO
TY_BYTEARRAY_CUSTOM_BLOCK = 0x000A | TY_FEATURE_BYTEARRAY, ///< used for reading/writing custom block
TY_BYTEARRAY_ISP_BLOCK = 0x000B | TY_FEATURE_BYTEARRAY, ///< used for reading/writing fpn block
TY_INT_PERSISTENT_IP = 0x0010 | TY_FEATURE_INT,
TY_INT_PERSISTENT_SUBMASK = 0x0011 | TY_FEATURE_INT,
TY_INT_PERSISTENT_GATEWAY = 0x0012 | TY_FEATURE_INT,
TY_BOOL_GVSP_RESEND = 0x0013 | TY_FEATURE_BOOL,
TY_INT_PACKET_DELAY = 0x0014 | TY_FEATURE_INT, ///< microseconds
TY_INT_ACCEPTABLE_PERCENT = 0x0015 | TY_FEATURE_INT,
TY_INT_NTP_SERVER_IP = 0x0016 | TY_FEATURE_INT, ///< Ntp server IP
TY_INT_PACKET_SIZE = 0x0017 | TY_FEATURE_INT,
TY_STRUCT_CAM_STATISTICS = 0x00ff | TY_FEATURE_STRUCT, ///< statistical information, see TY_CAMERA_STATISTICS
TY_INT_WIDTH_MAX = 0x0100 | TY_FEATURE_INT,
TY_INT_HEIGHT_MAX = 0x0101 | TY_FEATURE_INT,
TY_INT_OFFSET_X = 0x0102 | TY_FEATURE_INT,
TY_INT_OFFSET_Y = 0x0103 | TY_FEATURE_INT,
TY_INT_WIDTH = 0x0104 | TY_FEATURE_INT, ///< Image width
TY_INT_HEIGHT = 0x0105 | TY_FEATURE_INT, ///< Image height
TY_ENUM_IMAGE_MODE = 0x0109 | TY_FEATURE_ENUM, ///< Resolution-PixelFromat mode, see TY_IMAGE_MODE_LIST
//@brief scale unit
//depth image is uint16 pixel format with default millimeter unit ,for some device can output Sub-millimeter accuracy data
//the acutal depth (mm)= PixelValue * ScaleUnit
TY_FLOAT_SCALE_UNIT = 0x010a | TY_FEATURE_FLOAT,
TY_ENUM_TRIGGER_POL = 0x0201 | TY_FEATURE_ENUM, ///< Trigger POL, see TY_TRIGGER_POL_LIST
TY_INT_FRAME_PER_TRIGGER = 0x0202 | TY_FEATURE_INT, ///< Number of frames captured per trigger
TY_STRUCT_TRIGGER_PARAM = 0x0523 | TY_FEATURE_STRUCT, ///< param of trigger, see TY_TRIGGER_PARAM
TY_STRUCT_TRIGGER_PARAM_EX = 0x0525 | TY_FEATURE_STRUCT, ///< param of trigger, see TY_TRIGGER_PARAM_EX
TY_STRUCT_TRIGGER_TIMER_LIST = 0x0526 | TY_FEATURE_STRUCT, ///< param of trigger mode 20, see TY_TRIGGER_TIMER_LIST
TY_STRUCT_TRIGGER_TIMER_PERIOD = 0x0527 | TY_FEATURE_STRUCT, ///< param of trigger mode 21, see TY_TRIGGER_TIMER_PERIOD
TY_BOOL_KEEP_ALIVE_ONOFF = 0x0203 | TY_FEATURE_BOOL, ///< Keep Alive switch
TY_INT_KEEP_ALIVE_TIMEOUT = 0x0204 | TY_FEATURE_INT, ///< Keep Alive timeout
TY_BOOL_CMOS_SYNC = 0x0205 | TY_FEATURE_BOOL, ///< Cmos sync switch
TY_INT_TRIGGER_DELAY_US = 0x0206 | TY_FEATURE_INT, ///< Trigger delay time, in microseconds
TY_BOOL_TRIGGER_OUT_IO = 0x0207 | TY_FEATURE_BOOL, ///< Trigger out IO
TY_INT_TRIGGER_DURATION_US = 0x0208 | TY_FEATURE_INT, ///< Trigger duration time, in microseconds
TY_ENUM_STREAM_ASYNC = 0x0209 | TY_FEATURE_ENUM, ///< stream async switch, see TY_STREAM_ASYNC_MODE
TY_INT_CAPTURE_TIME_US = 0x0210 | TY_FEATURE_INT, ///< capture time in multi-ir
TY_ENUM_TIME_SYNC_TYPE = 0x0211 | TY_FEATURE_ENUM, ///< see TY_TIME_SYNC_TYPE
TY_BOOL_TIME_SYNC_READY = 0x0212 | TY_FEATURE_BOOL,
TY_BOOL_FLASHLIGHT = 0x0213 | TY_FEATURE_BOOL,
TY_INT_FLASHLIGHT_INTENSITY = 0x0214 | TY_FEATURE_INT,
TY_BOOL_AUTO_EXPOSURE = 0x0300 | TY_FEATURE_BOOL, ///< Auto exposure switch
TY_INT_EXPOSURE_TIME = 0x0301 | TY_FEATURE_INT, ///< Exposure time in percentage
TY_BOOL_AUTO_GAIN = 0x0302 | TY_FEATURE_BOOL, ///< Auto gain switch
TY_INT_GAIN = 0x0303 | TY_FEATURE_INT, ///< Sensor Gain
TY_BOOL_AUTO_AWB = 0x0304 | TY_FEATURE_BOOL, ///< Auto white balance
TY_STRUCT_AEC_ROI = 0x0305 | TY_FEATURE_STRUCT, ///< region of aec statistics, see TY_AEC_ROI_PARAM
TY_INT_LASER_POWER = 0x0500 | TY_FEATURE_INT, ///< Laser power level
TY_BOOL_LASER_AUTO_CTRL = 0x0501 | TY_FEATURE_BOOL, ///< Laser auto ctrl
TY_BOOL_UNDISTORTION = 0x0510 | TY_FEATURE_BOOL, ///< Output undistorted image
TY_BOOL_BRIGHTNESS_HISTOGRAM = 0x0511 | TY_FEATURE_BOOL, ///< Output bright histogram
TY_BOOL_DEPTH_POSTPROC = 0x0512 | TY_FEATURE_BOOL, ///< Do depth image postproc
TY_INT_R_GAIN = 0x0520 | TY_FEATURE_INT, ///< Gain of R channel
TY_INT_G_GAIN = 0x0521 | TY_FEATURE_INT, ///< Gain of G channel
TY_INT_B_GAIN = 0x0522 | TY_FEATURE_INT, ///< Gain of B channel
TY_INT_ANALOG_GAIN = 0x0524 | TY_FEATURE_INT, ///< Analog gain
TY_BOOL_HDR = 0x0525 | TY_FEATURE_BOOL,
TY_BYTEARRAY_HDR_PARAMETER = 0x0526 | TY_FEATURE_BYTEARRAY,
TY_BOOL_IMU_DATA_ONOFF = 0x0600 | TY_FEATURE_BOOL, ///< IMU Data Onoff
TY_STRUCT_IMU_ACC_BIAS = 0x0601 | TY_FEATURE_STRUCT, ///< IMU acc bias matrix, see TY_ACC_BIAS
TY_STRUCT_IMU_ACC_MISALIGNMENT = 0x0602 | TY_FEATURE_STRUCT, ///< IMU acc misalignment matrix, see TY_ACC_MISALIGNMENT
TY_STRUCT_IMU_ACC_SCALE = 0x0603 | TY_FEATURE_STRUCT, ///< IMU acc scale matrix, see TY_ACC_SCALE
TY_STRUCT_IMU_GYRO_BIAS = 0x0604 | TY_FEATURE_STRUCT, ///< IMU gyro bias matrix, see TY_GYRO_BIAS
TY_STRUCT_IMU_GYRO_MISALIGNMENT = 0x0605 | TY_FEATURE_STRUCT, ///< IMU gyro misalignment matrix, see TY_GYRO_MISALIGNMENT
TY_STRUCT_IMU_GYRO_SCALE = 0x0606 | TY_FEATURE_STRUCT, ///< IMU gyro scale matrix, see TY_GYRO_SCALE
TY_STRUCT_IMU_CAM_TO_IMU = 0x0607 | TY_FEATURE_STRUCT, ///< IMU camera to imu matrix, see TY_CAMERA_TO_IMU
TY_ENUM_IMU_FPS = 0x0608 | TY_FEATURE_ENUM, ///< IMU fps, see TY_IMU_FPS_LIST
TY_ENUM_DEPTH_QUALITY = 0x0900 | TY_FEATURE_ENUM, ///< the quality of generated depth, see TY_DEPTH_QUALITY
TY_INT_FILTER_THRESHOLD = 0x0901 | TY_FEATURE_INT, ///< the threshold of the noise filter, 0 for disabled
TY_INT_TOF_CHANNEL = 0x0902 | TY_FEATURE_INT, ///< the frequency channel of tof
}TY_FEATURE_ID_LIST;
属性的数据结构示例:
depth、leftir / rightir、rgb 组件支持的分辨率如下:
typedef enum TY_RESOLUTION_MODE_LIST { TY_RESOLUTION_MODE_160x100 = (160<<12)+100, ///< 0x000a0078 TY_RESOLUTION_MODE_160x120 = (160<<12)+120, ///< 0x000a0078 TY_RESOLUTION_MODE_240x320 = (240<<12)+320, ///< 0x000f0140 TY_RESOLUTION_MODE_320x180 = (320<<12)+180, ///< 0x001400b4 TY_RESOLUTION_MODE_320x200 = (320<<12)+200, ///< 0x001400c8 TY_RESOLUTION_MODE_320x240 = (320<<12)+240, ///< 0x001400f0 TY_RESOLUTION_MODE_480x640 = (480<<12)+640, ///< 0x001e0280 TY_RESOLUTION_MODE_640x360 = (640<<12)+360, ///< 0x00280168 TY_RESOLUTION_MODE_640x400 = (640<<12)+400, ///< 0x00280190 TY_RESOLUTION_MODE_640x480 = (640<<12)+480, ///< 0x002801e0 TY_RESOLUTION_MODE_960x1280 = (960<<12)+1280, ///< 0x003c0500 TY_RESOLUTION_MODE_1280x720 = (1280<<12)+720, ///< 0x005002d0 TY_RESOLUTION_MODE_1280x800 = (1280<<12)+800, ///< 0x00500320 TY_RESOLUTION_MODE_1280x960 = (1280<<12)+960, ///< 0x005003c0 TY_RESOLUTION_MODE_1920x1080 = (1920<<12)+1080, ///< 0x00780438 TY_RESOLUTION_MODE_2592x1944 = (2592<<12)+1944, ///< 0x00a20798 }TY_RESOLUTION_MODE_LIST;
depth、leftir / rightir、rgb 组件支持的图像格式如下:
typedef enum TY_PIXEL_FORMAT_LIST{ TY_PIXEL_FORMAT_UNDEFINED = 0, TY_PIXEL_FORMAT_MONO = (TY_PIXEL_8BIT | (0x0 << 24)), ///< 0x10000000 TY_PIXEL_FORMAT_BAYER8GB = (TY_PIXEL_8BIT | (0x1 << 24)), ///< 0x11000000 TY_PIXEL_FORMAT_BAYER8BG = (TY_PIXEL_8BIT | (0x2 << 24)), ///< 0x12000000 TY_PIXEL_FORMAT_BAYER8GR = (TY_PIXEL_8BIT | (0x3 << 24)), ///< 0x13000000 TY_PIXEL_FORMAT_BAYER8RG = (TY_PIXEL_8BIT | (0x4 << 24)), ///< 0x14000000 TY_PIXEL_FORMAT_DEPTH16 = (TY_PIXEL_16BIT | (0x0 << 24)), ///< 0x20000000 TY_PIXEL_FORMAT_YVYU = (TY_PIXEL_16BIT | (0x1 << 24)), ///< 0x21000000, yvyu422 TY_PIXEL_FORMAT_YUYV = (TY_PIXEL_16BIT | (0x2 << 24)), ///< 0x22000000, yuyv422 TY_PIXEL_FORMAT_MONO16 = (TY_PIXEL_16BIT | (0x3 << 24)), ///< 0x23000000, TY_PIXEL_FORMAT_RGB = (TY_PIXEL_24BIT | (0x0 << 24)), ///< 0x30000000 TY_PIXEL_FORMAT_BGR = (TY_PIXEL_24BIT | (0x1 << 24)), ///< 0x31000000 TY_PIXEL_FORMAT_JPEG = (TY_PIXEL_24BIT | (0x2 << 24)), ///< 0x32000000 TY_PIXEL_FORMAT_MJPG = (TY_PIXEL_24BIT | (0x3 << 24)), ///< 0x33000000 }TY_PIXEL_FORMAT_LIST;
备注
通过 TYSetEnum() 接口函数可同时设置图像格式和分辨率。
例如:设置图像格式为 TY_PIXEL_FORMAT_YUYV,宽为 640,高为 480。
ASSERT_OK(TYSetEnum(hDevice, TY_COMPONENT_RGB_CAM_LEFT, TY_ENUM_IMAGE_MODE, TYImageMode2(TY_PIXEL_FORMAT_YUYV, 640, 480)));
SDK 示例程序 DumpAllFeatures 可列出当前相机组件所支持的全部图像格式和分辨率。
常用光学参数数据结构如下,可使用 TYGetStruct() 接口函数读取:
typedef struct TY_VECT_3F { float x; float y; float z; }TY_VECT_3F; /// a 3x3 matrix /// |.|.|.| /// | --|---|---| /// | fx| 0| cx| /// | 0| fy| cy| /// | 0| 0| 1| typedef struct TY_CAMERA_INTRINSIC { float data[3*3]; }TY_CAMERA_INTRINSIC; /// a 4x4 matrix /// |.|.|.|.| /// |---|----|----|---| /// |r11| r12| r13| t1| /// |r21| r22| r23| t2| /// |r31| r32| r33| t3| /// | 0 | 0| 0| 1| typedef struct TY_CAMERA_EXTRINSIC { float data[4*4]; }TY_CAMERA_EXTRINSIC; ///camera distortion parameters typedef struct TY_CAMERA_DISTORTION { float data[12];///<Definition is compatible with opencv3.0+ :k1,k2,p1,p2,k3,k4,k5,k6,s1,s2,s3,s4 }TY_CAMERA_DISTORTION; ///camera 's cailbration data ///@see TYGetStruct typedef struct TY_CAMERA_CALIB_INFO { int32_t intrinsicWidth; int32_t intrinsicHeight; TY_CAMERA_INTRINSIC intrinsic; // TY_STRUCT_CAM_INTRINSIC TY_CAMERA_EXTRINSIC extrinsic; // TY_STRUCT_EXTRINSIC_TO_LEFT_IR TY_CAMERA_DISTORTION distortion; // TY_STRUCT_CAM_DISTORTION }TY_CAMERA_CALIB_INFO;