I want to crop an image in OpenCV and then pass it to DeepStream.
I want to do real-time processing in this way.
First, connect a USB camera to the Jetson Nano.
USB camera → OpenCV → Partial Trimming → DeepStream → Object Detection & Trimming
How do I pass my OpenCV image processing to DeepStream?
Hi,
Could you try this topic first?
There is an example in dsexample plugin but cpu version. I’ve followed the example and I got gpumat to create but got an error while trying to do any operation on it.
gpu_mat = cv::cuda::GpuMat(height, width, CV_8UC4, mapped_ptr, buf_params.pitch[0]);
cv::cuda::cvtColor(gpu_mat, gpu_bgr, CV_RGBA2BGR);
error: (-217:Gpu API call) unspecified launch failure in function ‘call’
Thanks.
How do I get the mapped_ptr, buf_params.pitch[0] passed to this function from the DeepStream SDK Python Binding?
cv::cuda::GpuMat(height, width, CV_8UC4, mapped_ptr, buf_params.pitch[0]);
Hi,
It should look like this:
cv::cuda::GpuMat d_mat(dsexample->processing_height, dsexample->processing_width, CV_8UC4, eglFrame.frame.pPitch[0]);
Please find the corresponding in our python binding.
Thanks.
The data that corresponds to eglFrame.frame.pPitch[0] is not included in DeepStrem’s metadata, is it?
Hi,
You can check this comment for the detail:
Hi,
Please apply below code to get_converted_mat() in gstdsexample.cpp
#include <cudaEGL.h>
#include <opencv2/cudafilters.hpp>
#ifdef __aarch64__
// To use the converted buffer in CUDA, create an EGLImage and then use
// CUDA-EGL interop APIs
if (USE_EGLIMAGE) {
if (NvBufSurfaceMapEglImage (dsexample->inter_buf, 0) !=0 ) {
goto error;
}
// dsexample->inter_buf->surfaceList[0].mappedAddr.eglImage
// Use interop APIs cuGraphicsEGLRegisterImage and
// cuGraphicsR…
To access the image buffer, it’s required to register with EGL first.
Thanks.