Please provide complete information as applicable to your setup.
• Hardware Platform (Jetson / GPU) GPU A4000 • DeepStream Version 6.3 • TensorRT Version 8.5.3-1+cuda11.8 • NVIDIA GPU Driver Version (valid for GPU only) 560.35.05 • Issue Type( questions, new requirements) • Requirement details( This is for new requirement. Including the module name-for which plugin or for which sample application, the function description) nvds_obj_encode.h
Hi,
I’m working on a DeepStream C++ pipeline (Ubuntu 22.04, NVIDIA A4000), and I’ve hit a roadblock trying to retain cropped image buffers in memory after a line-crossing event.
I’m using the NvDsAnalytics plugin to detect line crossings. Inside the analytics probe, I’m currently calling:
This works perfectly for saving cropped images to disk using NvDsObjEncUsrArgs.
What I now need is to hold the cropped image buffer in memory (e.g., for further inference or streaming) without saving it to disk. I tried accessing NvDsObjEncOutParams, but it fails the metadata check:
if (usrMeta->base_meta.meta_type == NVDS_CROP_IMAGE_META) { ... }
This is expected since the analytics probe doesn’t generate this type — NVDS_CROP_IMAGE_META is only attached in the PGIE probe.—
How can I access or retain the cropped image buffer in memory (e.g., as cv::Mat) after a line-cross event in the analytics probe, without duplicating logic in the PGIE probe?
Any suggestions on how to get access to that crop buffer, or trigger encoding manually from the analytics probe?
please refer to /opt/nvidia/deepstream/deepstream/sources/apps/sample_apps/deepstream-image-meta-test/, if frameData.attachUsrMeta is set to true, you can get the NVDS_CROP_IMAGE_META user meta from obj_meta.
Sorry for the late reply, Is this still an DeepStream issue to support? Thanks! can you get NVDS_CROP_IMAGE_META user meta after frameData.attachUsrMeta is set to true? please refer to osd_sink_pad_buffer_probe for how to access NVDS_CROP_IMAGE_META user meta, which includes the cropped image buffers.
When I use osd_sink_pad_buffer_probe, I access NVDS_CROP_IMAGE_META, but I want to access NVDS_CROP_IMAGE_META in nvdsanalytics_src_pad_buffer_probe from nvdsanalytics pad, not osd pad.Please check my code
In nvdsanalytics_src_pad_buffer_probe, you can call nvds_obj_enc_process and nvds_obj_enc_finish when iterating over NvDFrameMeta, then you can iterate over NvDFrameMeta again to get NVDS_CROP_IMAGE_META user meta in nvdsanalytics_src_pad_buffer_probe. You don’t need to get NVDS_CROP_IMAGE_META user meta in osd_sink_pad_buffer_probe.
my use case is when lines are crossed, then save the image and load the image buffer, so I want both operations to require saving the image and buffering the image to send the secondary inference script without any delay. Below I am trying this, but not all images are saved when lines are crossed.
please refer to my last comment. you can iterate over NvDFrameMeta twice. save crop buffer at the first time. get crop buffer at the second time. Here are some codes.
nvdsanalytics_src_pad_buffer_probe{
for (NvDsMetaList *l_obj = frame_meta->obj_meta_list; l_obj != NULL; l_obj = l_obj->next) {
…
// Check for line crossing
nvds_obj_enc_process
…