Deepstream with Opencv

Please provide complete information as applicable to your setup.

• Hardware Platform (Jetson / GPU) GPU
• DeepStream Version 7.0
• NVIDIA GPU Driver Version (valid for GPU only) CUDA 12.2
• Issue Type( questions, new requirements, bugs) question
• How to reproduce the issue ? (This is for bugs. Including which sample app is using, the configuration files content, the command line used and other details for reproducing) deepstream-opencv-test

Dear all,

I am trying out Deepstream’s opencv test provided in the sample apps. Following the instructions provided →

Installation of required packages
apt-get install libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev
libopencv-dev

  1. Set WITH_OPENCV=1 in Makefile of gst-dsexample
  2. Compile and install the library by following instructions mentioned in gst-dsexample README.

After successful compilation of gst-dsexample and deepstream-opencv-test and running the app, it returns->

ERROR from element example-plugin: OpenCV has been deprecated, hence object blurring will not work.Enable OpenCV compilation in gst-dsexample Makefile by setting 'WITH_OPENCV:=1
Error details: gstdsexample.cpp(363): gst_dsexample_start (): /GstPipeline:deepstream-opencv-test-pipeline/GstDsExample:example-plugin
Returned, stopping playback

Sharing the Makefile for gst-dsexample used for compilation:

WITH_OPENCV=1
USE_OPTIMIZED_DSEXAMPLE?=0
CUDA_VER?=
ifeq ($(CUDA_VER),)
$(error “CUDA_VER is not set”)
endif

TARGET_DEVICE = $(shell gcc -dumpmachine | cut -f1 -d -)
CXX:= g++
ifeq ($(USE_OPTIMIZED_DSEXAMPLE),1)
SRCS:= gstdsexample_optimized.cpp
else
SRCS:= gstdsexample.cpp
endif
INCS:= $(wildcard .h)
LIB:=libnvdsgst_dsexample.so
NVDS_VERSION:=7.0
DEP:=dsexample_lib/libdsexample.a
DEP_FILES:=$(wildcard dsexample_lib/dsexample_lib.
)
DEP_FILES-=$(DEP)
CFLAGS+= -fPIC -DDS_VERSION="7.0.0"
-I /usr/local/cuda-$(CUDA_VER)/include
-I …/…/includes
GST_INSTALL_DIR?=/opt/nvidia/deepstream/deepstream-$(NVDS_VERSION)/lib/gst-plugins/

LIB_INSTALL_DIR?=/opt/nvidia/deepstream/deepstream-$(NVDS_VERSION)/lib/

LIBS := -shared -Wl,-no-undefined \

-L dsexample_lib -ldsexample \

-L/usr/local/cuda-$(CUDA_VER)/lib64/ -lcudart -ldl \

-lnppc -lnppig -lnpps -lnppicc -lnppidei \

-L$(LIB_INSTALL_DIR) -lnvdsgst_helper -lnvdsgst_meta -lnvds_meta -lnvbufsurface -lnvbufsurftransform\

-Wl,-rpath,$(LIB_INSTALL_DIR)

OBJS:= $(SRCS:.cpp=.o)

PKGS:= gstreamer-1.0 gstreamer-base-1.0 gstreamer-video-1.0

ifeq ($(WITH_OPENCV),1)

CFLAGS+= -DWITH_OPENCV \

-I /usr/include/opencv4

PKGS+= opencv4

endif

CFLAGS+=$(shell pkg-config --cflags $(PKGS))

LIBS+=$(shell pkg-config --libs $(PKGS))

all: $(LIB)

%.o: %.cpp $(INCS) Makefile

@echo $(CFLAGS)

$(CXX) -c -o $@ $(CFLAGS) $<

$(LIB): $(OBJS) $(DEP) Makefile

@echo $(CFLAGS)

$(CXX) -o $@ $(OBJS) $(LIBS)

$(DEP): $(DEP_FILES)

$(MAKE) -C dsexample_lib/

install: $(LIB)

cp -rv $(LIB) $(GST_INSTALL_DIR)

clean:

rm -rf $(OBJS) $(LIB)

I have tried a few methods to make sure “WITH_OPENCV=1” was added into the compilation, but has failed.

Any help or advice would be appreciated. Thanks in advance

cd  /opt/nvidia/deepstream/deepstream/sources/gst-plugins/gst-dsexample

sudo make WITH_OPENCV=1 CUDA_VER=12.2 install

cd /opt/nvidia/deepstream/deepstream/sources/apps/sample_apps/deepstream-opencv-test

make CUDA_VER=12.2

./deepstream-opencv-test file:///opt/nvidia/deepstream/deepstream/samples/streams/sample_720p.h264 

If the above command line has problems, try running sudo /opt/nvidia/deepstream/deepstream/install.sh

Hi Junshengy, this works!

Missed out the install flag at the back. Appreciate this!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.