NVIDIA DeepStream SDK API Reference

9.1 Release
9.1/sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2019-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3  * SPDX-License-Identifier: Apache-2.0
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
26 #ifndef __GST_NVDEWARPER_H__
27 #define __GST_NVDEWARPER_H__
28 
29 #include <gst/gst.h>
30 #include <gst/video/gstvideometa.h>
31 #include <gst/video/video.h>
32 #include <gst/base/gstbasetransform.h>
33 
34 #include <cuda.h>
35 #include <npp.h>
36 
37 #include "nv_aisle_csvparser.hpp"
38 #include "nv_spot_csvparser.hpp"
39 #include "gstnvdsmeta.h"
40 #include "nvds_dewarper_meta.h"
41 #include "nvbufsurface.h"
42 #include "nvbufsurftransform.h"
43 
44 using namespace nvaisle_csv;
45 using namespace nvspot_csv;
46 
47 #define DISTORTION_SIZE 5
48 #define FOCAL_LENGTH_SIZE 2
49 #define ROTATION_MATRIX_SIZE 9
51 G_BEGIN_DECLS
52 
57 #define GST_TYPE_NVDEWARPER \
58  (gst_nvdewarper_get_type())
59 #define GST_NVDEWARPER(obj) \
60  (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_NVDEWARPER,Gstnvdewarper))
61 #define GST_NVDEWARPER_CLASS(klass) \
62  (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_NVDEWARPER,GstnvdewarperClass))
63 #define GST_IS_NVDEWARPER(obj) \
64  (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_NVDEWARPER))
65 #define GST_IS_NVDEWARPER_CLASS(klass) \
66  (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_NVDEWARPER))
67 
77 typedef struct _NvDewarperParams
78 {
79  guint projection_type;
81  gfloat top_angle;
82  gfloat bottom_angle;
83  gfloat pitch;
84  gfloat roll;
85  gfloat yaw;
86  gfloat dewarpFocalLength[FOCAL_LENGTH_SIZE];
87  char rot_axes[4];
91  gfloat control;
93  guint dewarpWidth;
94  guint dewarpHeight;
95  guint dewarpPitch;
97  guint addressMode;
98  guchar *surface;
99  guint isValid;
102  guint id;
103  guint surface_index;
105  gdouble distortion[DISTORTION_SIZE];
106  gfloat src_x0;
107  gfloat src_y0;
108  gfloat srcFov;
109  gfloat rot_matrix[ROTATION_MATRIX_SIZE];
110  guint rot_matrix_valid;
112  gfloat dstFocalLength[FOCAL_LENGTH_SIZE];
113  gfloat dstPrincipalPoint[2];
115 
117 typedef struct _NvDewarperPriv
118 {
119  std::vector<NvDewarperParams> vecDewarpSurface;
121 
125 struct _Gstnvdewarper
126 {
127  GstBaseTransform element;
129  GstCaps *sinkcaps;
130  GstCaps *srccaps;
132  guint input_width;
133  guint input_height;
134  guint output_width;
135  guint output_height;
137  guint num_batch_buffers;
138  guint gpu_id;
140  gchar* config_file;
141  gchar* spot_calibration_file;
142  gchar* aisle_calibration_file;
144  GstBufferPool *pool;
148  gint input_feature;
151  gint output_feature;
152 
153  NvBufSurfaceMemType cuda_mem_type;
154  NvBufSurfTransform_Inter interpolation_method;
155  GstVideoFormat input_fmt;
156  GstVideoFormat output_fmt;
158  cudaStream_t stream;
160  guint frame_num;
162  guint dump_frames;
163  void *aisle_output;
164  void *spot_output;
165  void *output;
167  gboolean silent;
168  gboolean spot_calibrationfile_set;
169  gboolean aisle_calibrationfile_set;
170  AisleCSVParser *aisleCSVParser;
171  SpotCSVParser *spotCSVParser;
173  guint source_id;
174  guint num_output_buffers;
175  guint aisleCSVInit;
176  guint spotCSVInit;
177  guint num_spot_views;
178  guint num_aisle_views;
179  guint spot_surf_index[MAX_DEWARPED_VIEWS];
180  guint aisle_surf_index[MAX_DEWARPED_VIEWS];
181  guint surface_index[MAX_DEWARPED_VIEWS];
182  guint surface_type[MAX_DEWARPED_VIEWS];
184  GstBuffer * out_gst_buf;
186  NvDewarperPriv *priv;
187 };
188 
190 struct _GstnvdewarperClass
191 {
192  GstBaseTransformClass parent_class;
193 };
194 
195 GType gst_nvdewarper_get_type (void);
196 
197 G_END_DECLS
198 
199 #endif /* __GST_NVDEWARPER_H__ */
cudaStream_t
struct CUstream_st * cudaStream_t
Forward declaration of cudaStream_t.
Definition: sources/includes/nvbufsurftransform.h:35
_NvDewarperPriv
Data structure contaning dewarping parameters for all the output surfaces.
Definition: sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:117
nvaisle_csv::AisleCSVParser
Class for parsing of Aisle CSV data.
Definition: sources/includes/nv_aisle_csvparser.hpp:95
gst_nvdewarper_get_type
GType gst_nvdewarper_get_type(void)
NvDewarperPriv
struct _NvDewarperPriv NvDewarperPriv
Data structure contaning dewarping parameters for all the output surfaces.
nvaisle_csv
Definition: sources/includes/nv_aisle_csvparser.hpp:36
NvDewarperParams
struct _NvDewarperParams NvDewarperParams
Holds all the configuration parameters required for dewarping a surface.
MAX_DEWARPED_VIEWS
#define MAX_DEWARPED_VIEWS
Maximum number of dewarped surfaces per frame supported.
Definition: sources/includes/nvds_dewarper_meta.h:49
_NvDewarperParams
Holds all the configuration parameters required for dewarping a surface.
Definition: sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:77
NvBufSurfaceMemType
NvBufSurfaceMemType
Specifies memory types for NvBufSurface.
Definition: sources/includes/nvbufsurface.h:350
nvspot_csv::SpotCSVParser
Class for parsing of Spot CSV data.
Definition: sources/includes/nv_spot_csvparser.hpp:86
FOCAL_LENGTH_SIZE
#define FOCAL_LENGTH_SIZE
Focal length array size : two values for X & Y direction.
Definition: 9.1/sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:48
NvBufSurfTransform_Inter
NvBufSurfTransform_Inter
Specifies video interpolation methods.
Definition: sources/includes/nvbufsurftransform.h:85
nvspot_csv
Definition: sources/includes/nv_spot_csvparser.hpp:35
ROTATION_MATRIX_SIZE
#define ROTATION_MATRIX_SIZE
Standard rotation matrix size.
Definition: 9.1/sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:49
DISTORTION_SIZE
#define DISTORTION_SIZE
Maximum number of distortion coefficients.
Definition: 9.1/sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:47
_Gstnvdewarper
Gstnvdewarper element structure.
Definition: sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:125
GstBuffer
struct _GstBuffer GstBuffer
Definition: sources/includes/ds3d/common/idatatype.h:24
_GstnvdewarperClass
GStreamer boilerplate.
Definition: sources/gst-plugins/gst-nvdewarper/gstnvdewarper.h:190