Perception Tool Kit (PTK) API Guide
create_pc.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright (c) 2020 Texas Instruments Incorporated
4  *
5  * All rights reserved not granted herein.
6  *
7  * Limited License.
8  *
9  * Texas Instruments Incorporated grants a world-wide, royalty-free, non-exclusive
10  * license under copyrights and patents it now or hereafter owns or controls to make,
11  * have made, use, import, offer to sell and sell ("Utilize") this software subject to the
12  * terms herein. With respect to the foregoing patent license, such license is granted
13  * solely to the extent that any such patent is necessary to Utilize the software alone.
14  * The patent license shall not apply to any combinations which include this software,
15  * other than combinations with devices manufactured by or for TI ("TI Devices").
16  * No hardware patent is licensed hereunder.
17  *
18  * Redistributions must preserve existing copyright notices and reproduce this license
19  * (including the above copyright notice and the disclaimer and (if applicable) source
20  * code license limitations below) in the documentation and/or other materials provided
21  * with the distribution
22  *
23  * Redistribution and use in binary form, without modification, are permitted provided
24  * that the following conditions are met:
25  *
26  * * No reverse engineering, decompilation, or disassembly of this software is
27  * permitted with respect to any software provided in binary form.
28  *
29  * * any redistribution and use are licensed by TI for use only with TI Devices.
30  *
31  * * Nothing shall obligate TI to provide you with source code for the software
32  * licensed and provided to you in object code.
33  *
34  * If software source code is provided to you, modification and redistribution of the
35  * source code are permitted provided that the following conditions are met:
36  *
37  * * any redistribution and use of the source code, including any resulting derivative
38  * works, are licensed by TI for use only with TI Devices.
39  *
40  * * any redistribution and use of any object code compiled from the source code
41  * and any resulting derivative works, are licensed by TI for use only with TI Devices.
42  *
43  * Neither the name of Texas Instruments Incorporated nor the names of its suppliers
44  *
45  * may be used to endorse or promote products derived from this software without
46  * specific prior written permission.
47  *
48  * DISCLAIMER.
49  *
50  * THIS SOFTWARE IS PROVIDED BY TI AND TI'S LICENSORS "AS IS" AND ANY EXPRESS
51  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
52  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
53  * IN NO EVENT SHALL TI AND TI'S LICENSORS BE LIABLE FOR ANY DIRECT, INDIRECT,
54  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
55  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
56  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
57  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
58  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
59  * OF THE POSSIBILITY OF SUCH DAMAGE.
60  *
61  */
62 #ifndef _CREATE_PC_H
63 #define _CREATE_PC_H
64 
65 #ifdef __cplusplus
66 extern "C" {
67 #endif
68 
69 #include <perception/perception.h>
72 #include <perception/base/matrix.h>
73 
75 #define NUM_FRAC_BITS 4
76 
87 typedef struct
88 {
90  int16_t width;
91 
93  int16_t height;
94 
96  int16_t tensorWidth;
97 
99  int16_t tensorHeight;
100 
102  int16_t dsWidth;
103 
105  int16_t dsHeight;
106 
108  int16_t dsFactor;
109 
111  uint8_t confidenceTh;
112 
114 
115 
120 typedef struct
121 {
123  int32_t camHeight;
124 
126  float camRoll;
127 
129  float camPitch;
130 
132  float camYaw;
133 
135  float sinPitch;
136 
138  float cosPitch;
139 
141  int32_t baseline;
142 
144  float dcx;
145 
147  float dcy;
148 
150  float f;
151 
154 
157 
159 
160 
165 typedef struct
166 {
169 
172 
174 
179 typedef struct
180 {
183 
185  int16_t * disparity;
186 
188  float * dsDisparity;
189 
191  uint8_t * dsSSMap;
192 
194 
205 
230  PTK_Api_MemoryReq * memReq);
231 
247  const PTK_Api_MemoryRsp * memRsp);
248 
260 int32_t PTK_Alg_StereoOG_CreatePCGetMem(PTK_Alg_StereoOG_CreatePCObj * cntxt, uint8_t *memPtr);
261 
274  int16_t * disparity,
275  uint8_t * ssmap,
276  PTK_PointCloud * pc);
277 
288  int16_t * disparity,
289  float * dsDisparity);
290 
301  uint8_t * ssmap,
302  uint8_t * dsSSMap);
303 
304 
316  float * dsDisparity,
317  uint8_t * dsSSMap,
318  PTK_PointCloud * pc);
319 
320 
331 int8_t PTK_Alg_StereoOG_classToPC(uint8_t classId);
332 
343 int8_t PTK_Alg_StereoOG_classToDetect(uint8_t classId);
344 
345 
346 
347 #ifdef __cplusplus
348 }
349 #endif
350 
351 #endif // #ifndef _CREATE_PC_H
int32_t PTK_Alg_StereoOG_CreatePCGetMem(PTK_Alg_StereoOG_CreatePCObj *cntxt, uint8_t *memPtr)
Get memory size.
int32_t camHeight
Definition: create_pc.h:123
int8_t PTK_Alg_StereoOG_classToDetect(uint8_t classId)
Check if a particular class of object should be detected.
float * dsDisparity
Definition: create_pc.h:188
int16_t height
Definition: create_pc.h:93
void PTK_Alg_StereoOG_createPC(PTK_Alg_StereoOG_CreatePCObj *cntxt, int16_t *disparity, uint8_t *ssmap, PTK_PointCloud *pc)
Root function to creaet point clouds from disparity map and semantic segmantation map...
Definition of a 3x3 matrix.
Definition: matrix.h:119
int16_t dsHeight
Definition: create_pc.h:105
int32_t PTK_Alg_StereoOG_triangulate(PTK_Alg_StereoOG_CreatePCAllParams *params, float *dsDisparity, uint8_t *dsSSMap, PTK_PointCloud *pc)
Triangulate points using downsampled disparity and semantic segmentation to create point cloud...
int16_t tensorHeight
Definition: create_pc.h:99
PTK_Alg_StereoOG_CreatePCAllParams params
Definition: create_pc.h:182
float dcx
Definition: create_pc.h:144
void * PTK_AlgHandle
Algorithm Handle.
Definition: alg_common.h:79
PTK_Alg_StereoOG_CreatePCCamParams camParams
Definition: create_pc.h:171
Definition: pointCloud.h:129
int16_t dsWidth
Definition: create_pc.h:102
PTK_3D_Matrix invK
Definition: create_pc.h:156
Stereo PC creation process - PC creation context.
Definition: create_pc.h:179
float camPitch
Definition: create_pc.h:129
void PTK_Alg_StereoOG_CreatePCSetParams(PTK_Alg_StereoOG_CreatePCAllParams *params, PTK_Alg_StereoOG_CreatePCObj *cntxt)
Initialize PC creation parameters.
int32_t PTK_Alg_StereoOG_CreatePCConfig(PTK_Alg_StereoOG_CreatePCAllParams *params, PTK_Api_MemoryReq *memReq)
Computes the memory requirements based on the given algorithm configuration parameters.
void PTK_Alg_StereoOG_downsampleSSMap(PTK_Alg_StereoOG_CreatePCConfigParams *config, uint8_t *ssmap, uint8_t *dsSSMap)
Downsample input semantic segmentation map.
int16_t width
Definition: create_pc.h:90
int32_t baseline
Definition: create_pc.h:141
float camRoll
Definition: create_pc.h:126
Declarations for PTK_Matrix struct+functions.
PTK_3D_Matrix K
Definition: create_pc.h:153
PTK_AlgHandle PTK_Alg_StereoOG_CreatePCInit(PTK_Alg_StereoOG_CreatePCAllParams *params, const PTK_Api_MemoryRsp *memRsp)
Initializes the library based on the given algorithm configuration parameters and allocated memory bl...
float camYaw
Definition: create_pc.h:132
API memory allocation response.
Definition: api_memory_if.h:158
void PTK_Alg_StereoOG_downsampleDisparity(PTK_Alg_StereoOG_CreatePCConfigParams *config, int16_t *disparity, float *dsDisparity)
Downsample input disparity map.
int16_t dsFactor
Definition: create_pc.h:108
PTK_Alg_StereoOG_CreatePCConfigParams cfgParams
Definition: create_pc.h:168
API memory allocation request.
Definition: api_memory_if.h:125
Stereo PC creation process - config Parameters.
Definition: create_pc.h:87
uint8_t * dsSSMap
Definition: create_pc.h:191
float cosPitch
Definition: create_pc.h:138
int16_t * disparity
Definition: create_pc.h:185
float sinPitch
Definition: create_pc.h:135
int8_t PTK_Alg_StereoOG_classToPC(uint8_t classId)
Check if the point with a particular class should be triangulated.
Stereo PC creation process - All algorithm parameters.
Definition: create_pc.h:165
float f
Definition: create_pc.h:150
Stereo PC creation process - camera Parameters.
Definition: create_pc.h:120
float dcy
Definition: create_pc.h:147
uint8_t confidenceTh
Definition: create_pc.h:111
int16_t tensorWidth
Definition: create_pc.h:96