How to push the image to another plugins in pipeline and display cropped object on the screen using custom plugin

• Jetson Xavier
• Deepstream 6.0
• JetPack 4.6
• TensorRT 8.0.1
• NVIDIA GPU Driver 32.6.1
• All config files used in your app

Hello, i’m trying solve my issue: How to crop detected object using deepstream and deliver it to segmentation

But using custom plugin. And I’ve got a few questions about them

  1. Were can I find guides of systemised info about writing plugins for gstreamer/deepstream
  2. I need to preproccess the image for nvinfer using meta-info that i got. I used dsexample for the first plugin.
    I found out that an image located in NvBufSurface , because we load data from dsexample->inter_buf to dsexample->cvmat. In function blur_objects instead of bluring i cropped only one object at frame (cropped object was located in in_mat). So that’s the question: how can I push the image to another plugins in pipeline and display cropped object on the screen(Well it’ the main question)

Well that is how blur_objects is looks like right now:

blur_objects (GstDsExample * dsexample, gint idx,
    NvOSD_RectParams * crop_rect_params, cv::Mat in_mat)
{
  cv::Rect crop_rect;
  
  if ((crop_rect_params->width == 0) || (crop_rect_params->height == 0)) {
    GST_ELEMENT_ERROR (dsexample, STREAM, FAILED,
        ("%s:crop_rect_params dimensions are zero",__func__), (NULL));
    return GST_FLOW_ERROR;
  }

/* rectangle for cropped objects */
  crop_rect = cv::Rect (crop_rect_params->left, crop_rect_params->top,
  crop_rect_params->width, crop_rect_params->height);
/* apply gaussian blur to the detected objects */
if(crop_rect_params->width > 40){
  in_mat = in_mat(crop_rect);
  cv::resize(in_mat, in_mat, cv::Size(640, 640), 0, 0, cv::INTER_CUBIC);

  memcpy(dsexample->inter_buf->surfaceList[0].mappedAddr.addr[0], out_mat.ptr(), 640 * 640 * RGB_BYTES_PER_PIXEL); //That is my assumptions how pushingdata to  the next plugin
}
  //GaussianBlur(in_mat(crop_rect), in_mat(crop_rect), cv::Size(15,15), 4);
  return GST_FLOW_OK;

For gstreamer plugin development, please refer to gstreamer community. https://gstreamer.freedesktop.org/

nvvideoconvert plugin supports crop. Gst-nvvideoconvert — DeepStream 6.0.1 Release documentation

Hi, thank you for you answer. Main reason why am I ask this I want to know how can I get image do something like crop/paint something/erase with opencv library and push it to the next element of pipeline.

So how can I crop image only using custom plugin?

Could you please say, to modify the image that displays on screen I need to change a GstBuffer? Or I need to change another variable?
For a long time I trying to understand how can i simply crop the detected object.

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