Please provide complete information as applicable to your setup.
**• Hardware Platform: Jetson NX
**• DeepStream Version 6.0.0
**• JetPack Version (valid for Jetson only) 4.6
**• TensorRT Version 8.0.1.6
• NVIDIA GPU Driver Version (valid for GPU only)
**• Issue Type( questions, new requirements, bugs) question
the pipline like this:
I want to get the stream with the specified source_id and convert it to CV:: mat
GstCaps *caps1 = gst_caps_from_string("video/x-raw(memory:NVMM), format=RGBA");
GstElement *filter1 = gst_element_factory_make("capsfilter", "filter1");
g_object_set(G_OBJECT(filter1), "caps", caps1, NULL);
probe :
static GstPadProbeReturn filter_src_pad_buffer_probe (GstPad * pad, GstPadProbeInfo * info, gpointer u_data)
{
GstBuffer *buf = (GstBuffer *) info->data;
NvDsObjectMeta *obj_meta = NULL;
NvDsMetaList *l_frame = NULL;
NvDsMetaList *l_obj = NULL;
NvDsDisplayMeta *display_meta = NULL;
NvDsBatchMeta *batch_meta = gst_buffer_get_nvds_batch_meta (buf);
int current_device = -1;
cudaGetDevice(¤t_device);
struct cudaDeviceProp prop;
cudaGetDeviceProperties(&prop, current_device);
GstMapInfo in_map_info;
NvBufSurface * surface = NULL;
memset (&in_map_info, 0, sizeof (in_map_info));
if (!gst_buffer_map (buf, &in_map_info, GST_MAP_READ))
{
g_print ("Error: Failed to map gst buffer\n");
}
surface = (NvBufSurface *) in_map_info.data;
cv::cuda::GpuMat gpuMat;
gpuMat = cv::cuda::GpuMat(1080, 1920, CV_8UC4, (void*)surface->surfaceList[0].dataPtr);
cv::Mat cpuMat
gpuMat.download(cpuMat);
for (l_frame = batch_meta->frame_meta_list; l_frame != NULL; l_frame = l_frame->next)
{
NvDsFrameMeta *frame_meta = (NvDsFrameMeta *) (l_frame->data);
gint s_id = frame_meta->source_id;
// g_print("source_id: %d, batch_id=%d, frame_num=%d, pad_index=%d \n", s_id, frame_meta->batch_id, frame_meta->frame_num, frame_meta->pad_index);
for (l_obj = frame_meta->obj_meta_list; l_obj != NULL; l_obj = l_obj->next)
{
......
}
An error occurred while running:
In cb_newpad
In cb_newpad
terminate called after throwing an instance of 'cv::Exception'
what(): OpenCV(4.5.5) /home/nvidia/workspace/opencv/opencv4.5.5/opencv-4.5.5/modules/core/src/cuda/gpu_mat.cu:249: error: (-217:Gpu API call) invalid argument in function 'download'
Aborted (core dumped)
My question:
(1) How can I solve this problem
(2) Is there a more suitable scheme: get full frame 2 cv::Mat and get crop image (by detector)2cv::Mat
