VPI - Vision Programming Interface

4.0 Release

Types.h
Go to the documentation of this file.
1 /*
2  * Copyright 2019-2024 NVIDIA Corporation. All rights reserved.
3  *
4  * NOTICE TO LICENSEE:
5  *
6  * This source code and/or documentation ("Licensed Deliverables") are
7  * subject to NVIDIA intellectual property rights under U.S. and
8  * international Copyright laws.
9  *
10  * These Licensed Deliverables contained herein is PROPRIETARY and
11  * CONFIDENTIAL to NVIDIA and is being provided under the terms and
12  * conditions of a form of NVIDIA software license agreement by and
13  * between NVIDIA and Licensee ("License Agreement") or electronically
14  * accepted by Licensee. Notwithstanding any terms or conditions to
15  * the contrary in the License Agreement, reproduction or disclosure
16  * of the Licensed Deliverables to any third party without the express
17  * written consent of NVIDIA is prohibited.
18  *
19  * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
20  * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
21  * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
22  * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
23  * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
24  * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
25  * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
26  * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
27  * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
28  * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
29  * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
30  * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
31  * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
32  * OF THESE LICENSED DELIVERABLES.
33  *
34  * U.S. Government End Users. These Licensed Deliverables are a
35  * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
36  * 1995), consisting of "commercial computer software" and "commercial
37  * computer software documentation" as such terms are used in 48
38  * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
39  * only as a commercial end item. Consistent with 48 C.F.R.12.212 and
40  * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
41  * U.S. Government End Users acquire the Licensed Deliverables with
42  * only those rights set forth herein.
43  *
44  * Any use of the Licensed Deliverables in individual and commercial
45  * software must include, in the user documentation and internal
46  * comments to the code, the above Disclaimer and U.S. Government End
47  * Users Notice.
48  */
49 
56 #ifndef NV_VPI_TYPES_H
57 #define NV_VPI_TYPES_H
58 
59 #include "ImageFormat.h"
60 #include "Interpolation.h"
61 #include "PixelType.h"
62 #include "Status.h"
63 #include "Version.h"
64 
65 #include <stdint.h>
66 
67 #ifdef __cplusplus
68 extern "C" {
69 #endif
70 
90 typedef enum
91 {
92  VPI_BACKEND_CPU = (1ULL << 0),
93  VPI_BACKEND_CUDA = (1ULL << 1),
94  VPI_BACKEND_PVA = (1ULL << 2),
95  VPI_BACKEND_VIC = (1ULL << 3),
96  VPI_BACKEND_OFA = (1ULL << 4),
97  VPI_BACKEND_INVALID = (1ULL << 15)
99 
101 #define VPI_BACKEND_TEGRA (VPI_BACKEND_VIC | VPI_BACKEND_OFA)
102 
103 #define VPI_BACKEND_MASK ((VPI_BACKEND_INVALID << 1) - 1)
104 
106 #define VPI_BACKEND_ALL (VPI_BACKEND_CPU | VPI_BACKEND_CUDA | VPI_BACKEND_PVA | VPI_BACKEND_VIC | VPI_BACKEND_OFA)
107 
134 #define VPI_EXCLUSIVE_STREAM_ACCESS (1ULL << 16)
135 
144 #define VPI_RESTRICT_MEM_USAGE (1ULL << 17)
145 
157 #define VPI_REQUIRE_BACKENDS (1ULL << 18)
158 
165 typedef void (*VPIParallelTask)(int taskId, int threadId, void *vpiData);
166 
189 typedef void (*VPIParallelForCallback)(VPIParallelTask task, int taskCount, void *vpiData, void *userData);
190 
196 typedef struct
197 {
205 
212 
216  void *userData;
218 
224 typedef void *VPINativeThreadHandle;
225 
230 typedef struct VPIArrayImpl *VPIArray;
231 
236 typedef struct VPIContextImpl *VPIContext;
237 
242 typedef struct VPIEventImpl *VPIEvent;
243 
248 typedef struct VPIStreamImpl *VPIStream;
249 
254 typedef struct VPIImageImpl *VPIImage;
255 
260 typedef struct VPIPyramidImpl *VPIPyramid;
261 
266 typedef struct VPIPayloadImpl *VPIPayload;
267 
274 typedef enum
275 {
283 
288 typedef unsigned char VPIByte;
289 
294 typedef enum
295 {
302 
307 
311 
323 typedef struct
324 {
325  float x;
326  float y;
327  float octave;
328  float layer;
330 
337 typedef struct
338 {
339  float x;
340  float y;
342 
349 typedef struct
350 {
351  uint32_t x;
352  uint32_t y;
354 
358 typedef enum
359 {
363 
367 #define VPI_BRIEF_DESCRIPTOR_ARRAY_LENGTH 32
368 
372 #define VPI_BRIEF_DESCRIPTOR_BIT_WIDTH (VPI_BRIEF_DESCRIPTOR_ARRAY_LENGTH * 8)
373 
377 typedef struct
378 {
382 
407 typedef struct
408 {
409  float mat3[3][3];
411 
427 typedef struct
428 {
430  float width,
433 
439 typedef struct
440 {
441  float left;
442  float top;
443  float width;
444  float height;
446 
448 typedef enum
449 {
459 
466 
476 
486 
491 typedef struct
492 {
495 
502 
509 
512  uint8_t reserved1, reserved2;
515 
519 typedef struct
520 {
523 
526 
530  int32_t seqIndex;
531 
534  float filterLR;
535 
539 
543  void *userData;
545 
551 typedef struct
552 {
554  float mean[4];
555 
557  float covariance[4][4];
558 
560  int32_t pixelCount;
561 
563  float sum[4];
564 
565 } VPIStats;
566 
570 #define VPI_MAX_MATCHES_PER_DESCRIPTOR (3)
571 
577 typedef struct
578 {
581 
584 
585 } VPIMatches;
586 
591 typedef struct VPIRectangleIRec
592 {
593  int32_t x, y; /*< Rectangle origin position (x, y). */
594  int32_t width, height; /*< Rectangle size dimensions (width, height). */
595 } VPIRectangleI;
596 
601 typedef enum
602 {
605 
608 
612 
617 typedef enum
618 {
622 
633 
637 
642 #define VPI_TERMINATION_CRITERIA_ITERATIONS (1u << 0)
643 #define VPI_TERMINATION_CRITERIA_EPSILON (1u << 1)
659 typedef float VPICameraIntrinsic[2][3];
660 
672 typedef float VPICameraExtrinsic[3][4];
673 
693 typedef float VPIPerspectiveTransform[3][3];
694 
699 typedef enum
700 {
703 
706 
708 
712 typedef enum
713 {
715  VPI_FLIP_HORIZ = 1U << 0,
716 
718  VPI_FLIP_VERT = 1U << 1,
719 
724 
726 
730 typedef enum
731 {
734 
737 
740 
742 
746 typedef enum
747 {
750 
754 
759 #define VPI_STAT_PIXEL_COUNT (1U << 0)
760 
762 #define VPI_STAT_SUM (1U << 1)
763 
765 #define VPI_STAT_MEAN ((1U << 2) | VPI_STAT_SUM | VPI_STAT_PIXEL_COUNT)
766 
768 #define VPI_STAT_VARIANCE ((1U << 3) | VPI_STAT_MEAN)
769 
771 #define VPI_STAT_COVARIANCE ((1U << 4) | VPI_STAT_VARIANCE)
772 
776 typedef struct
777 {
779  uint16_t id;
781  int16_t correctedBits;
793  VPIKeypointF32 corners[4];
795 
799 typedef struct
800 {
815  float transform[3][4];
817  float error;
818 } VPIPose;
819 
820 #ifdef __cplusplus
821 }
822 #endif
823 
824 #endif /* NV_VPI_TYPES_H */
Defines types and functions to handle image formats.
Defines all interpolation types used in VPI.
Defines types and functions to handle pixel types.
Declaration of VPI status codes handling functions.
#define VPI_BRIEF_DESCRIPTOR_ARRAY_LENGTH
Length of Brief Descriptor Array.
Definition: Types.h:367
unsigned char VPIByte
Definition of a byte type.
Definition: Types.h:288
VPIGradientMethod
Different method to generate gradients.
Definition: Types.h:747
@ VPI_GRADIENT_SOBEL
Generate the gradient in x direction and y direction via sobel operator.
Definition: Types.h:749
@ VPI_GRADIENT_BLUR_PREWITT
Generate the gradient by using prewitt operator on blurred input image.
Definition: Types.h:752
#define VPI_MAX_MATCHES_PER_DESCRIPTOR
Maximum number of matches per descriptor.
Definition: Types.h:570
VPITrackingState
Object tracking state.
Definition: Types.h:449
@ VPI_TRACKING_STATE_LOST
Object isn't being tracked anymore.
Definition: Types.h:458
@ VPI_TRACKING_STATE_SHADOW_TRACKED
Object is being tracked with low confidence.
Definition: Types.h:484
@ VPI_TRACKING_STATE_TRACKED
Object is being tracked with high confidence.
Definition: Types.h:475
@ VPI_TRACKING_STATE_NEW
New object to be tracked.
Definition: Types.h:465
VPINormType
Defines the magnitude of vectors.
Definition: Types.h:731
@ VPI_NORM_L2
L2 norm.
Definition: Types.h:736
@ VPI_NORM_HAMMING
Hamming norm.
Definition: Types.h:739
@ VPI_NORM_L1
L1 norm.
Definition: Types.h:733
VPICornerScore
Defines different types of corner scores.
Definition: Types.h:359
@ VPI_CORNER_SCORE_FAST
Use FAST corner scores.
Definition: Types.h:361
@ VPI_CORNER_SCORE_HARRIS
Use Harris response corner scores.
Definition: Types.h:360
VPIFlipMode
Defines image flip directions.
Definition: Types.h:713
@ VPI_FLIP_HORIZ
Flip horizontally.
Definition: Types.h:715
@ VPI_FLIP_VERT
Flip vertically.
Definition: Types.h:718
@ VPI_FLIP_BOTH
Flip horizontally and vertically.
Definition: Types.h:723
Stores a BRIEF Descriptor.
Definition: Types.h:378
Functions and structures for handling VPI library version.
float decisionMargin
A measure of the quality of the binary decoding process: the average difference between the intensity...
Definition: Types.h:786
VPIKeypointF32 center
The center of the detection in image pixel coordinates.
Definition: Types.h:791
VPIHomographyTransform2D homography
The 3x3 homography matrix describing the projection from an "ideal" tag (with corners at (-1,...
Definition: Types.h:789
uint16_t id
The decoded ID of the tag.
Definition: Types.h:779
int16_t correctedBits
Number of bits corrected for this detection.
Definition: Types.h:781
Stores information about an AprilTag detection from AprilTag detector.
Definition: Types.h:777
struct VPIArrayImpl * VPIArray
A handle to an array.
Definition: Types.h:230
int maxThreads
The maximum number of threads used by the parallel_for implementation code.
Definition: Types.h:204
void * userData
A user defined opaque pointer passed to callback function unaltered.
Definition: Types.h:216
VPIParallelForCallback callback
A pointer to the parallel_for implementation.
Definition: Types.h:211
void(* VPIParallelTask)(int taskId, int threadId, void *vpiData)
Parallel task function pointer type.
Definition: Types.h:165
void * VPINativeThreadHandle
A handle to OS-specific thread handle.
Definition: Types.h:224
struct VPIContextImpl * VPIContext
A handle to a context.
Definition: Types.h:236
void(* VPIParallelForCallback)(VPIParallelTask task, int taskCount, void *vpiData, void *userData)
Parallel for callback function pointer type.
Definition: Types.h:189
Stores the ParallelFor configuration.
Definition: Types.h:197
VPIConversionPolicy
Policy used when converting between image types.
Definition: Types.h:295
@ VPI_CONVERSION_CLAMP
Clamps input to output's type range.
Definition: Types.h:301
@ VPI_CONVERSION_INVALID
Invalid conversion.
Definition: Types.h:309
@ VPI_CONVERSION_CAST
Casts input to the output type.
Definition: Types.h:306
VPITrackingState state
Tracking status of this bounding box.
Definition: Types.h:525
void * userData
Pointer to some unspecified user data.
Definition: Types.h:543
float filterChannelWeightsLR
Learning rate for weights of different feature channels in DCF.
Definition: Types.h:538
float filterLR
Learning rate for DCF filter in exponential moving average.
Definition: Types.h:534
VPIAxisAlignedBoundingBoxF32 bbox
Bounding box around the object being tracked.
Definition: Types.h:522
int32_t seqIndex
Index of the input sequence where the tracked object is in.
Definition: Types.h:530
Stores information about an object tracked by DCF Tracker.
Definition: Types.h:520
struct VPIEventImpl * VPIEvent
A handle to an event.
Definition: Types.h:242
struct VPIImageImpl * VPIImage
A handle to an image.
Definition: Types.h:254
int8_t templateStatus
Status of the template related to this bounding box.
Definition: Types.h:508
int8_t trackingStatus
Tracking status of this bounding box.
Definition: Types.h:501
VPIBoundingBox bbox
Bounding box being tracked.
Definition: Types.h:494
uint8_t reserved1
Reserved for future use.
Definition: Types.h:512
Stores a bounding box that is being tracked by KLT Tracker.
Definition: Types.h:492
float VPICameraExtrinsic[3][4]
Camera extrinsic matrix.
Definition: Types.h:672
float VPICameraIntrinsic[2][3]
Camera intrinsic matrix.
Definition: Types.h:659
struct VPIPayloadImpl * VPIPayload
A handle to an algorithm payload.
Definition: Types.h:266
float VPIPerspectiveTransform[3][3]
Represents a 2D perspective transform.
Definition: Types.h:693
struct VPIPyramidImpl * VPIPyramid
A handle to an image pyramid.
Definition: Types.h:260
struct VPIStreamImpl * VPIStream
A handle to a stream.
Definition: Types.h:248
VPIBackend
VPI Backend types.
Definition: Types.h:91
@ VPI_BACKEND_CUDA
CUDA backend.
Definition: Types.h:93
@ VPI_BACKEND_PVA
PVA backend.
Definition: Types.h:94
@ VPI_BACKEND_OFA
OFA backend.
Definition: Types.h:96
@ VPI_BACKEND_VIC
VIC backend.
Definition: Types.h:95
@ VPI_BACKEND_INVALID
Invalid backend.
Definition: Types.h:97
@ VPI_BACKEND_CPU
CPU backend.
Definition: Types.h:92
int32_t pixelCount
Total pixel count.
Definition: Types.h:560
float width
Bounding box width.
Definition: Types.h:430
float left
Defines the bounding box's left corner's coordinate.
Definition: Types.h:441
float top
Defines the bounding box's top corner's coordinate.
Definition: Types.h:442
float height
Bounding box height.
Definition: Types.h:444
float layer
Pyramid layer within the octave where the keypoint is located.
Definition: Types.h:328
float octave
Pyramid octave (or pyramid level) where the keypoint is located.
Definition: Types.h:327
float y
Keypoint's y coordinate.
Definition: Types.h:326
float width
Bounding box width.
Definition: Types.h:443
uint32_t y
Keypoint's y coordinate.
Definition: Types.h:352
float x
Keypoint's x coordinate.
Definition: Types.h:325
float height
Bounding box height.
Definition: Types.h:431
VPIHomographyTransform2D xform
Defines the bounding box top left corner and its homography.
Definition: Types.h:429
float x
Keypoint's x coordinate.
Definition: Types.h:339
float error
Object-space error of the pose estimation.
Definition: Types.h:817
float y
Keypoint's y coordinate.
Definition: Types.h:340
uint32_t x
Keypoint's x coordinate.
Definition: Types.h:351
VPIBorderExtension
Image border extension specify how pixel values outside of the image domain should be constructed.
Definition: Types.h:275
VPIEventState
Defines the states of the event.
Definition: Types.h:700
VPIOpticalFlowQuality
Defines the quality of the optical flow algorithm.
Definition: Types.h:602
VPILockMode
Defines the lock modes used by memory lock functions.
Definition: Types.h:618
@ VPI_BORDER_INVALID
Invalid border.
Definition: Types.h:281
@ VPI_BORDER_ZERO
All pixels outside the image are considered to be zero.
Definition: Types.h:276
@ VPI_BORDER_LIMITED
Consider image as limited to not access outside pixels.
Definition: Types.h:280
@ VPI_BORDER_CLAMP
Border pixels are repeated indefinitely.
Definition: Types.h:277
@ VPI_BORDER_MIRROR
dedcb|abcde|dcbab
Definition: Types.h:279
@ VPI_BORDER_REFLECT
edcba|abcde|edcba
Definition: Types.h:278
@ VPI_EVENT_STATE_NOT_SIGNALED
Event is not signaled yet.
Definition: Types.h:702
@ VPI_EVENT_STATE_SIGNALED
Event has been signaled.
Definition: Types.h:705
@ VPI_OPTICAL_FLOW_QUALITY_LOW
Fast but low quality optical flow implementation.
Definition: Types.h:604
@ VPI_OPTICAL_FLOW_QUALITY_HIGH
Slow but high quality optical flow implementation.
Definition: Types.h:610
@ VPI_OPTICAL_FLOW_QUALITY_MEDIUM
Speed and quality in between of VPI_OPTICAL_FLOW_QUALITY_LOW and VPI_OPTICAL_FLOW_QUALITY_HIGH.
Definition: Types.h:607
@ VPI_LOCK_WRITE
Lock memory only for writing.
Definition: Types.h:632
@ VPI_LOCK_READ_WRITE
Lock memory for reading and writing.
Definition: Types.h:635
@ VPI_LOCK_READ
Lock memory only for reading.
Definition: Types.h:621
Stores an axis-aligned 32-bit floating point 2D bounding box.
Definition: Types.h:440
Stores a generic 2D bounding box.
Definition: Types.h:428
Stores a generic 2D homography transform.
Definition: Types.h:408
Stores a float32 keypoint coordinate The coordinate is relative to the top-left corner of an image.
Definition: Types.h:338
Stores a U32 keypoint coordinate The coordinate is relative to the top-left corner of an image.
Definition: Types.h:350
Stores the matches between 2 descriptors.
Definition: Types.h:578
Estimation of a transformation from one 3D coordinate system to another with object-space error.
Definition: Types.h:800
Stores a float32 pyramidal-based keypoint coordinate The coordinate includes the (x,...
Definition: Types.h:324
Stores the geometric information of a rectangle.
Definition: Types.h:592
Stores the statistics of an image.
Definition: Types.h:552