When using deepstream_lpr_app for license plate recognition, how to take a screenshot of the vehicle with the detection frame?

Please provide complete information as applicable to your setup.

**• Hardware Platform (Jetson NX)
**• DeepStream Version 5.1
• JetPack Version (valid for Jetson only)
• TensorRT Version
• NVIDIA GPU Driver Version (valid for GPU only)
**• Issue Type( new requirements)
**• When using deepstream_lpr_app for license plate recognition, how to take a screenshot of the vehicle with the detection frame? We can use deepstream and opencv to take a screenshot of the target vehicle, but the resolution is low.

Seems the object is small. so the resolution is low.

Yes, the smaller the target, the smaller the resolution.Thanks very much for helping. Actually what I want to ask is how to take a screenshot of the target with bounding box.

BBox will be draw onto video after nvdsosd.

https://docs.nvidia.com/metropolis/deepstream/dev-guide/text/DS_plugin_gst-nvdsosd.html

@kesong Hello, I read the description you posted about nvdsosd, and I also put the probe after calling nvdsosd. Then I refer to How to save the complete frame with bounding boxes in deepstream-image-meta-test? u=user85575 and Deepstream save image with bounding box - #8 by Mike these two posts. And encapsulated a function with osd_sink_pad_buffer_probe in the deepstream_image_meta_test example, but no screenshots appeared after running. Below is the program I wrote, please help me.

int write_frame2(GstBuffer *buf, char *picture)
{
	NvDsMetaList * l_frame = NULL;
	NvDsBatchMeta *batch_meta = gst_buffer_get_nvds_batch_meta (buf);
	NvDsObjectMeta *obj_meta = NULL;
	NvDsMetaList * l_obj = NULL;
	
	for (l_frame = batch_meta->frame_meta_list; l_frame != NULL; l_frame = l_frame->next) {
		NvDsFrameMeta *frame_meta = (NvDsFrameMeta *) (l_frame->data);
		if (!frame_meta) {
			continue;
		}
		for (l_obj = frame_meta->obj_meta_list; l_obj != NULL; l_obj = l_obj->next) {
			obj_meta = (NvDsObjectMeta *) (l_obj->data);
			if (!obj_meta) {
				continue;
			}
			
			/* For Demonstration Purposes we are writing metadata to jpeg images of
			 * only vehicles for the first 100 frames only.
			 * The files generated have a 'OSD' prefix. */
			  NvDsUserMetaList *usrMetaList = obj_meta->obj_user_meta_list;
			  FILE *file;
			  printf("1111111111111111111\n");
			  while (usrMetaList != NULL) {
			  	printf("000000000000000\n");
				NvDsUserMeta *usrMetaData = (NvDsUserMeta *) usrMetaList->data;
				if (usrMetaData->base_meta.meta_type == NVDS_CROP_IMAGE_META) {
				  NvDsObjEncOutParams *enc_jpeg_image =
					  (NvDsObjEncOutParams *) usrMetaData->user_meta_data;
				  /* Write to File */
				  file = fopen (picture, "wb");
				  fwrite (enc_jpeg_image->outBuffer, sizeof (uint8_t),
					  enc_jpeg_image->outLen, file);
				  fclose (file);
				  usrMetaList = NULL;
				} else {
				  usrMetaList = usrMetaList->next;
				}
			  }
			
		}
	}
	
	return 0;

}

Call function command:
write_frame2(buf, "tmp/test.jpg");
Through debugging, it is found that the variable usrMetaList is always NULL, so the picture cannot be saved.Please help me.

There is no update from you for a period, assuming this is not an issue any more.
Hence we are closing this topic. If need further support, please open a new one.
Thanks

Can you check if you encoder the pic in nvds_obj_enc_process() in the deepstream_image_meta_test?

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