# When using deepstream\_lpr\_app for license plate recognition, how to take a screenshot of the vehicle with the detection frame?

**URL:** <https://forums.developer.nvidia.com/t/when-using-deepstream-lpr-app-for-license-plate-recognition-how-to-take-a-screenshot-of-the-vehicle-with-the-detection-frame/197421>\
**Category:** DeepStream SDK\
**Created:** [December 8, 2021, 2:19am UTC](https://forums.developer.nvidia.com/t/when-using-deepstream-lpr-app-for-license-plate-recognition-how-to-take-a-screenshot-of-the-vehicle-with-the-detection-frame/197421 "2021-12-08T02:19:04Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![user85575](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@user85575](https://forums.developer.nvidia.com/u/user85575)\
**Post date:** [December 8, 2021, 2:19am UTC](https://forums.developer.nvidia.com/t/when-using-deepstream-lpr-app-for-license-plate-recognition-how-to-take-a-screenshot-of-the-vehicle-with-the-detection-frame/197421/1 "2021-12-08T02:19:04Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![kesong](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/kesong/32/101255_2.png) [@kesong](https://forums.developer.nvidia.com/u/kesong)\
**Post date:** [December 8, 2021, 11:50am UTC](https://forums.developer.nvidia.com/t/when-using-deepstream-lpr-app-for-license-plate-recognition-how-to-take-a-screenshot-of-the-vehicle-with-the-detection-frame/197421/3 "2021-12-08T11:50:23Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![user85575](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@user85575](https://forums.developer.nvidia.com/u/user85575)\
**Post date:** [December 9, 2021, 2:25am UTC](https://forums.developer.nvidia.com/t/when-using-deepstream-lpr-app-for-license-plate-recognition-how-to-take-a-screenshot-of-the-vehicle-with-the-detection-frame/197421/4 "2021-12-09T02:25:26Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![kesong](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/kesong/32/101255_2.png) [@kesong](https://forums.developer.nvidia.com/u/kesong)\
**Post date:** [December 9, 2021, 11:31am UTC](https://forums.developer.nvidia.com/t/when-using-deepstream-lpr-app-for-license-plate-recognition-how-to-take-a-screenshot-of-the-vehicle-with-the-detection-frame/197421/5 "2021-12-09T11:31:32Z")

</div>

BBox will be draw onto video after nvdsosd.

[https://docs.nvidia.com/metropolis/deepstream/dev-guide/text/DS\_plugin\_gst-nvdsosd.html](https://docs.nvidia.com/metropolis/deepstream/dev-guide/text/DS_plugin_gst-nvdsosd.html)

---

<div class="post-metadata">

**Author:** ![user85575](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@user85575](https://forums.developer.nvidia.com/u/user85575)\
**Post date:** [December 14, 2021, 3:34am UTC](https://forums.developer.nvidia.com/t/when-using-deepstream-lpr-app-for-license-plate-recognition-how-to-take-a-screenshot-of-the-vehicle-with-the-detection-frame/197421/6 "2021-12-14T03:34:03Z")

</div>

@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](https://forums.developer.nvidia.com/t/how-to-save-the-complete-frame-with-bounding-boxes-in-deepstream-image-meta-test/148042)? u=user85575 and [Deepstream save image with bounding box - #8 by Mike](https://forums.developer.nvidia.com/t/deepstream-save-image-with-bounding-box/123717/8) 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.

```auto
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.

---

<div class="post-metadata">

**Author:** ![kesong](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/kesong/32/101255_2.png) [@kesong](https://forums.developer.nvidia.com/u/kesong)\
**Post date:** [December 27, 2021, 9:04am UTC](https://forums.developer.nvidia.com/t/when-using-deepstream-lpr-app-for-license-plate-recognition-how-to-take-a-screenshot-of-the-vehicle-with-the-detection-frame/197421/7 "2021-12-27T09:04:00Z")

</div>

**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?

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/system/32/68080_2.png) [@system](https://forums.developer.nvidia.com/u/system)\
**Post date:** [January 25, 2022, 2:08am UTC](https://forums.developer.nvidia.com/t/when-using-deepstream-lpr-app-for-license-plate-recognition-how-to-take-a-screenshot-of-the-vehicle-with-the-detection-frame/197421/9 "2022-01-25T02:08:14Z")

</div>

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