-
Notifications
You must be signed in to change notification settings - Fork 1
/
gstdsobjectsmask.h
117 lines (96 loc) · 3.91 KB
/
gstdsobjectsmask.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/**
* Copyright (c) 2022-2023, seieric
* Forked from https://github.com/seieric/gst-dsobjectsmosaic.
* This software is based on DeepStream DsExample Plugin by NVIDIA.
*
* Copyright (c) 2017-2021, NVIDIA CORPORATION. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#ifndef __GST_DSOM_H__
#define __GST_DSOM_H__
#include <gst/base/gstbasetransform.h>
#include <gst/video/video.h>
/* Open CV headers */
#pragma GCC diagnostic push
#if __GNUC__ >= 8
#pragma GCC diagnostic ignored "-Wclass-memaccess"
#endif
#include "opencv2/cudaimgproc.hpp"
#include "opencv2/cudaarithm.hpp"
#include "opencv2/core/cuda.hpp"
#pragma GCC diagnostic pop
#include <cuda.h>
#include <cuda_runtime.h>
#include <cudaEGL.h>
#include <set>
#include "nvbufsurface.h"
#include "gst-nvquery.h"
#include "gstnvdsmeta.h"
#include "nvds_mask_utils.h"
/* Package and library details required for plugin_init */
#define PACKAGE "dsobjectsmask"
#define VERSION "1.0"
#define LICENSE "Proprietary"
#define DESCRIPTION "objects blurring plugin integrated with DeepStream on Jetson (not on dGPU)"
#define BINARY_PACKAGE "blurring objects detected by NVIDIA nvinfer plugin"
#define URL "https://github.com/seieric/gst-dsobjectsmask"
G_BEGIN_DECLS
/* Standard boilerplate stuff */
typedef struct _GstDsObjectsMask GstDsObjectsMask;
typedef struct _GstDsObjectsMaskClass GstDsObjectsMaskClass;
/* Standard boilerplate stuff */
#define GST_TYPE_DSOM (gst_dsom_get_type())
#define GST_DSOM(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DSOM,GstDsObjectsMask))
#define GST_DSOM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_DSOM,GstDsObjectsMaskClass))
#define GST_DSOM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GST_TYPE_DSOM, GstDsObjectsMaskClass))
#define GST_IS_DSOM(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DSOM))
#define GST_IS_DSOM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DSOM))
#define GST_DSOM_CAST(obj) ((GstDsObjectsMask *)(obj))
struct _GstDsObjectsMask
{
GstBaseTransform base_trans;
// Unique ID of the element. The labels generated by the element will be
// updated at index `unique_id` of attr_info array in NvDsObjectParams.
guint unique_id;
// Frame number of the current input buffer
guint64 frame_num;
// CUDA Stream used for allocating the CUDA task
cudaStream_t cuda_stream;
// Input video info (resolution, color format, framerate, etc)
GstVideoInfo video_info;
// Flag which defince igpu/dgpu
guint is_integrated;
// Amount of objects processed in single call to algorithm
guint batch_size;
// GPU ID on which we expect to execute the task
guint gpu_id;
// minimum confidence of objects to be blurred
gdouble min_confidence;
// class ids for which blur is applied
std::set<uint> *class_ids;
};
// Boiler plate stuff
struct _GstDsObjectsMaskClass
{
GstBaseTransformClass parent_class;
};
GType gst_dsom_get_type (void);
G_END_DECLS
#endif /* __GST_DSOM_H__ */