init
This commit is contained in:
commit
1a8e32d6d3
67
Makefile
Executable file
67
Makefile
Executable file
|
@ -0,0 +1,67 @@
|
|||
################################################################################
|
||||
# Copyright (c) 2017-2021, NVIDIA CORPORATION. All rights reserved.
|
||||
#
|
||||
# NVIDIA Corporation and its licensors retain all intellectual property
|
||||
# and proprietary rights in and to this software, related documentation
|
||||
# and any modifications thereto. Any use, reproduction, disclosure or
|
||||
# distribution of this software and related documentation without an express
|
||||
# license agreement from NVIDIA Corporation is strictly prohibited.
|
||||
#################################################################################
|
||||
|
||||
CUDA_VER?=
|
||||
ifeq ($(CUDA_VER),)
|
||||
$(error "CUDA_VER is not set")
|
||||
endif
|
||||
|
||||
CXX:= g++
|
||||
SRCS:= gstnvdsosd.c
|
||||
|
||||
INCS:= gstnvdsosd.h
|
||||
INCS+=httplib.h
|
||||
INCS+=json.hpp
|
||||
|
||||
LIB:=libnvdsgst_osd.so
|
||||
|
||||
TARGET_DEVICE = $(shell gcc -dumpmachine | cut -f1 -d -)
|
||||
|
||||
NVDS_VERSION:=6.0
|
||||
|
||||
GST_INSTALL_DIR?=/opt/nvidia/deepstream/deepstream-$(NVDS_VERSION)/lib/gst-plugins/
|
||||
LIB_INSTALL_DIR?=/opt/nvidia/deepstream/deepstream-$(NVDS_VERSION)/lib/
|
||||
|
||||
CFLAGS+= -fPIC -DDS_VERSION=\"6.0.1\" \
|
||||
-I../../includes \
|
||||
-I/usr/local/cuda-$(CUDA_VER)/include \
|
||||
-I ./
|
||||
|
||||
ifeq ($(TARGET_DEVICE),aarch64)
|
||||
CFLAGS+= -DPLATFORM_TEGRA
|
||||
endif
|
||||
|
||||
LIBS := -shared -Wl,-no-undefined \
|
||||
-L/usr/local/cuda-$(CUDA_VER)/lib64/ -lcudart
|
||||
|
||||
LIBS+= -L$(LIB_INSTALL_DIR) -lnvdsgst_helper -lnvdsgst_meta -lnvds_meta \
|
||||
-lnvds_osd -lnvbufsurface -lnvbufsurftransform -ldl -lpthread \
|
||||
-Wl,-rpath,$(LIB_INSTALL_DIR)
|
||||
|
||||
OBJS:= $(SRCS:.c=.o)
|
||||
|
||||
PKGS:= gstreamer-1.0 gstreamer-base-1.0 gstreamer-video-1.0
|
||||
CFLAGS+= $(shell pkg-config --cflags $(PKGS))
|
||||
LIBS+= $(shell pkg-config --libs $(PKGS))
|
||||
|
||||
all: $(LIB)
|
||||
|
||||
%.o: %.c $(INCS) Makefile
|
||||
@echo $(CFLAGS)
|
||||
$(CXX) -c -o $@ $(CFLAGS) $<
|
||||
|
||||
$(LIB): $(OBJS) $(DEP) Makefile
|
||||
$(CXX) -o $@ $(OBJS) $(LIBS)
|
||||
|
||||
install: $(LIB)
|
||||
cp -rv $(LIB) $(GST_INSTALL_DIR)
|
||||
|
||||
clean:
|
||||
rm -rf $(OBJS) $(LIB)
|
29
README
Executable file
29
README
Executable file
|
@ -0,0 +1,29 @@
|
|||
################################################################################
|
||||
# Copyright (c) 2020-2021, NVIDIA CORPORATION. All rights reserved.
|
||||
#
|
||||
# NVIDIA Corporation and its licensors retain all intellectual property
|
||||
# and proprietary rights in and to this software, related documentation
|
||||
# and any modifications thereto. Any use, reproduction, disclosure or
|
||||
# distribution of this software and related documentation without an express
|
||||
# license agreement from NVIDIA Corporation is strictly prohibited.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
Refer to the DeepStream SDK documentation for a description of the "nvdsosd"
|
||||
plugin and API.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
Pre-requisites:
|
||||
- GStreamer-1.0 Development package
|
||||
- GStreamer-1.0 Base Plugins Development package
|
||||
- CUDA Runtime 10.0+
|
||||
|
||||
Install gstreamer developement packages using:
|
||||
sudo apt-get install libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
Compiling and installing the plugin:
|
||||
Export or set in Makefile the appropriate CUDA_VER
|
||||
Run make and sudo make install
|
||||
|
||||
NOTE: To compile the sources, run make with "sudo" or root permission.
|
1206
gstnvdsosd.c
Executable file
1206
gstnvdsosd.c
Executable file
File diff suppressed because it is too large
Load Diff
151
gstnvdsosd.h
Executable file
151
gstnvdsosd.h
Executable file
|
@ -0,0 +1,151 @@
|
|||
/**
|
||||
* Copyright (c) 2016-2020, NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* NVIDIA Corporation and its licensors retain all intellectual property
|
||||
* and proprietary rights in and to this software, related documentation
|
||||
* and any modifications thereto. Any use, reproduction, disclosure or
|
||||
* distribution of this software and related documentation without an express
|
||||
* license agreement from NVIDIA Corporation is strictly prohibited.
|
||||
*
|
||||
* version: 0.1
|
||||
*/
|
||||
|
||||
#ifndef __GST_NVDSOSD_H__
|
||||
#define __GST_NVDSOSD_H__
|
||||
|
||||
#include <gst/gst.h>
|
||||
#include <gst/video/video.h>
|
||||
#include <gst/video/gstvideofilter.h>
|
||||
#include <stdlib.h>
|
||||
#include "nvll_osd_api.h"
|
||||
#include "gstnvdsmeta.h"
|
||||
|
||||
#define MAX_BG_CLR 20
|
||||
|
||||
G_BEGIN_DECLS
|
||||
/* Standard GStreamer boilerplate */
|
||||
#define GST_TYPE_NVDSOSD \
|
||||
(gst_nvds_osd_get_type())
|
||||
#define GST_NVDSOSD(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_NVDSOSD,GstNvDsOsd))
|
||||
#define GST_NVDSOSD_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_NVDSOSD,GstNvDsOsdClass))
|
||||
#define GST_IS_NVDSOSD(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_NVDSOSD))
|
||||
#define GST_IS_NVDSOSD_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_NVDSOSD))
|
||||
/* Version number of package */
|
||||
#define VERSION "1.8.2"
|
||||
#define PACKAGE_DESCRIPTION "Gstreamer plugin to draw rectangles and text"
|
||||
/* Define under which licence the package has been released */
|
||||
#define PACKAGE_LICENSE "Proprietary"
|
||||
#define PACKAGE_NAME "GStreamer nvosd Plugin"
|
||||
/* Define to the home page for this package. */
|
||||
#define PACKAGE_URL "http://nvidia.com/"
|
||||
#define GST_CAPS_FEATURE_MEMORY_NVMM "memory:NVMM"
|
||||
typedef struct _GstNvDsOsd GstNvDsOsd;
|
||||
typedef struct _GstNvDsOsdClass GstNvDsOsdClass;
|
||||
|
||||
/**
|
||||
* GstNvDsOsd element structure.
|
||||
*/
|
||||
struct _GstNvDsOsd
|
||||
{
|
||||
/** Should be the first member when extending from GstBaseTransform. */
|
||||
GstBaseTransform parent_instance;
|
||||
|
||||
/* Width of buffer. */
|
||||
gint width;
|
||||
/* Height of buffer. */
|
||||
gint height;
|
||||
|
||||
/** Pointer to the nvdsosd context. */
|
||||
void *nvdsosd_context;
|
||||
/** Enum indicating how the objects are drawn,
|
||||
i.e., CPU, GPU or VIC (for Jetson only). */
|
||||
NvOSD_Mode nvdsosd_mode;
|
||||
|
||||
/** Boolean value indicating whether clock is enabled. */
|
||||
gboolean show_clock;
|
||||
/** Structure containing text params for clock. */
|
||||
NvOSD_TextParams clock_text_params;
|
||||
|
||||
/** List of strings to be drawn. */
|
||||
NvOSD_TextParams *text_params;
|
||||
/** List of rectangles to be drawn. */
|
||||
NvOSD_RectParams *rect_params;
|
||||
/** List of rectangles for segment masks to be drawn. */
|
||||
NvOSD_RectParams *mask_rect_params;
|
||||
/** List of segment masks to be drawn. */
|
||||
NvOSD_MaskParams *mask_params;
|
||||
/** List of lines to be drawn. */
|
||||
NvOSD_LineParams *line_params;
|
||||
/** List of arrows to be drawn. */
|
||||
NvOSD_ArrowParams *arrow_params;
|
||||
/** List of circles to be drawn. */
|
||||
NvOSD_CircleParams *circle_params;
|
||||
|
||||
/** Number of rectangles to be drawn for a frame. */
|
||||
guint num_rect;
|
||||
/** Number of segment masks to be drawn for a frame. */
|
||||
guint num_segments;
|
||||
/** Number of strings to be drawn for a frame. */
|
||||
guint num_strings;
|
||||
/** Number of lines to be drawn for a frame. */
|
||||
guint num_lines;
|
||||
/** Number of arrows to be drawn for a frame. */
|
||||
guint num_arrows;
|
||||
/** Number of circles to be drawn for a frame. */
|
||||
guint num_circles;
|
||||
|
||||
/** Structure containing details of rectangles to be drawn for a frame. */
|
||||
NvOSD_FrameRectParams *frame_rect_params;
|
||||
/** Structure containing details of segment masks to be drawn for a frame. */
|
||||
NvOSD_FrameSegmentMaskParams *frame_mask_params;
|
||||
/** Structure containing details of text to be overlayed for a frame. */
|
||||
NvOSD_FrameTextParams *frame_text_params;
|
||||
/** Structure containing details of lines to be drawn for a frame. */
|
||||
NvOSD_FrameLineParams *frame_line_params;
|
||||
/** Structure containing details of arrows to be drawn for a frame. */
|
||||
NvOSD_FrameArrowParams *frame_arrow_params;
|
||||
/** Structure containing details of circles to be drawn for a frame. */
|
||||
NvOSD_FrameCircleParams *frame_circle_params;
|
||||
|
||||
/** Font of the text to be displayed. */
|
||||
gchar *font;
|
||||
/** Color of the clock, if enabled. */
|
||||
guint clock_color;
|
||||
/** Font size of the clock, if enabled. */
|
||||
guint clock_font_size;
|
||||
/** Border width of object. */
|
||||
guint border_width;
|
||||
/** Integer indicating the frame number. */
|
||||
guint frame_num;
|
||||
/** Boolean indicating whether text is to be drawn. */
|
||||
gboolean draw_text;
|
||||
/** Boolean indicating whether bounding is to be drawn. */
|
||||
gboolean draw_bbox;
|
||||
/** Boolean indicating whether instance mask is to be drawn. */
|
||||
gboolean draw_mask;
|
||||
/**Array containing color info for blending */
|
||||
NvOSD_Color_info color_info[MAX_BG_CLR];
|
||||
/** Boolean indicating whether hw-blend-color-attr is set. */
|
||||
gboolean hw_blend;
|
||||
/** Integer indicating number of detected classes. */
|
||||
int num_class_entries;
|
||||
/** Integer indicating gpu id to be used. */
|
||||
guint gpu_id;
|
||||
/** Pointer to the converted buffer. */
|
||||
void *conv_buf;
|
||||
};
|
||||
|
||||
/* GStreamer boilerplate. */
|
||||
struct _GstNvDsOsdClass
|
||||
{
|
||||
GstBaseTransformClass parent_class;
|
||||
};
|
||||
|
||||
GType gst_nvds_osd_get_type (void);
|
||||
|
||||
G_END_DECLS
|
||||
#endif /* __GST_NVDSOSD_H__ */
|
Loading…
Reference in New Issue
Block a user