How to convert NvBufSurface to jpeg?

Please provide complete information as applicable to your setup.

• Hardware Platform (Jetson / GPU)
• DeepStream Version
deepstream 6.1 triton(docker)


I want to convert NvBufSurface to jpeg

I know that “nvds_obj_enc_process” can convert, but I want another way ex)libturbo-jpeg, libjpeg

so could you tell me how to convert NvBufSurface to jpeg?

this is code

  GstMapInfo inmap = GST_MAP_INFO_INIT;
  if (!gst_buffer_map(buf, &inmap, GST_MAP_READ)) {
      std::cerr << "input buffer mapinfo failed\n";
  NvBufSurface *ip_surf = (NvBufSurface *);

please refer to Dump jpeg in deepstream5.0
Before you dump data from NvBufSurface, you need to check memType, format and layout first. Different memType, format and layout, the dump method is different. DeepStream SDK FAQ - Intelligent Video Analytics / DeepStream SDK - NVIDIA Developer Forums 5

here is a sample: DeepStream SDK FAQ - #18 by bcao

thank you I will check

Is this still an issue to support? Thanks


I am solving the problem with opencv through the link you sent me, but there is a compilation error

I installed opencv4.2 and set the makefile like this

ifeq ($(CUDA_VER),)
  $(error "CUDA_VER is not set")


APP:= deepstream-test5-app

TARGET_DEVICE = $(shell gcc -dumpmachine | cut -f1 -d -)



ifeq ($(TARGET_DEVICE),aarch64)

SRCS:= deepstream_test5_app_main.c deepstream_utc.cpp image_meta_consumer.cpp capture_time_rules.cpp
SRCS+= ../deepstream-app/deepstream_app.c ../deepstream-app/deepstream_app_config_parser.c
SRCS+= $(wildcard ../../apps-common/src/*.c)

INCS:= $(wildcard *.h)

PKGS:= gstreamer-1.0 gstreamer-video-1.0 x11 json-glib-1.0
PKGS+= opencv4

OBJS:= $(patsubst %.c,%.o, $(patsubst %.cpp,%.o, $(SRCS)))

CFLAGS+= -I../../apps-common/includes \
		 -I../../../includes \
		 -I /usr/local/include/librdkafka \
		 -I../deepstream-app/ -DDS_VERSION_MINOR=0 -DDS_VERSION_MAJOR=5 \
		 -I /usr/local/cuda-$(CUDA_VER)/include \
		 -I /opencv2

LIBS:= -L/usr/local/cuda-$(CUDA_VER)/lib64/ -lcudart

LIBS+= -L$(LIB_INSTALL_DIR) -lnvdsgst_meta -lnvds_meta -lrdkafka -lnvdsgst_helper -lnvdsgst_smartrecord -lnvds_batch_jpegenc -lnvds_utils -lnvds_msgbroker -lm \
       -lcuda -lgstrtspserver-1.0 -lpthread -ldl -Wl,-rpath,$(LIB_INSTALL_DIR)

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

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

all: $(APP)

%.o: %.c $(INCS) Makefile
	$(CC) -c -o $@ $(CFLAGS) $<

%.o: %.cpp $(INCS) Makefile
	$(CXX) -c -o $@ $(CFLAGS) $<

$(APP): $(OBJS) Makefile
	$(CXX) -o $(APP) $(OBJS) $(LIBS)

install: $(APP)
	cp -rv $(APP) $(APP_INSTALL_DIR)

	rm -rf $(OBJS) $(APP)

include is here

#include "opencv2/opencv_modules.hpp"

using namespace cv;

using namespace std;

and error message is here

error: 'cv' is not a namespace-name

please refer to deepstream sample deepstream-mrcnn-app, it will use opencv.

thank you for reply!

Is this still an issue to support? Thanks

thank you I resolved

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