# AMB82 MINI Cut image with face coordinates

**URL:** https://forum.amebaiot.com/t/amb82-mini-cut-image-with-face-coordinates/2246
**Category:** AI
**Tags:** rtl8735b, evb-amb82
**Created:** [September 15, 2023, 12:20am UTC](https://forum.amebaiot.com/t/amb82-mini-cut-image-with-face-coordinates/2246 "2023-09-15T00:20:07Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![kzezel](https://avatars.discourse-cdn.com/v4/letter/k/e47774/32.png) [@kzezel](https://forum.amebaiot.com/u/kzezel)
#### Post date: [September 15, 2023, 12:20am UTC](https://forum.amebaiot.com/t/amb82-mini-cut-image-with-face-coordinates/2246/1 "2023-09-15T00:20:07Z")

</div>

Hi,

I’m using AMB82 MINI and I need to crop the image with the face coordinates to send to my cloud endpoint. I want to send only the face photo, instead of sending the entire photo to reduce internet bandwidth. Is there any example that can help me?

Regards,  
Kevin

---

<div class="post-metadata">

### Author: ![Pammy](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.amebaiot.com/pammy/32/936_2.png) [@Pammy](https://forum.amebaiot.com/u/Pammy)
#### Post date: [September 18, 2023, 1:43am UTC](https://forum.amebaiot.com/t/amb82-mini-cut-image-with-face-coordinates/2246/2 "2023-09-18T01:43:17Z")

</div>

Hi @kzezel, may I understand that you would like run face detection, and when a face is detected, you would like to take a snapshot of the cropped face using face coordinates and send the cropped photo to the cloud endpoint?

---

<div class="post-metadata">

### Author: ![kzezel](https://avatars.discourse-cdn.com/v4/letter/k/e47774/32.png) [@kzezel](https://forum.amebaiot.com/u/kzezel)
#### Post date: [September 18, 2023, 2:26am UTC](https://forum.amebaiot.com/t/amb82-mini-cut-image-with-face-coordinates/2246/3 "2023-09-18T02:26:50Z")

</div>

Yes! Crop all faces in a snapshot

---

<div class="post-metadata">

### Author: ![kzezel](https://avatars.discourse-cdn.com/v4/letter/k/e47774/32.png) [@kzezel](https://forum.amebaiot.com/u/kzezel)
#### Post date: [September 18, 2023, 2:32am UTC](https://forum.amebaiot.com/t/amb82-mini-cut-image-with-face-coordinates/2246/4 "2023-09-18T02:32:03Z")

</div>

If there is any way to access the RGB that is used by scrfd inference, with the coordinates I can create a code to crop the photo easily. I was looking at the documentation and I only found ways to extract a snapshot to jpeg and not to a raw format from the camera sensor.

---

<div class="post-metadata">

### Author: ![Pammy](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.amebaiot.com/pammy/32/936_2.png) [@Pammy](https://forum.amebaiot.com/u/Pammy)
#### Post date: [September 19, 2023, 2:29am UTC](https://forum.amebaiot.com/t/amb82-mini-cut-image-with-face-coordinates/2246/5 "2023-09-19T02:29:54Z")

</div>

Hi @kzezel,

You can consider taking one of the examples in open-source Standard SDK as a reference ([https://github.com/ambiot/ambpro2\_sdk/blob/main/project/realtek\_amebapro2\_v0\_example/src/mmfv2\_video\_example/mmf2\_video\_example\_vipnn\_rtsp\_init.c](https://github.com/ambiot/ambpro2_sdk/blob/main/project/realtek_amebapro2_v0_example/src/mmfv2_video_example/mmf2_video_example_vipnn_rtsp_init.c)), this is an object detection demo, but this method should work for face detection also.

There’s an example on how to do cropping and resizing of your original video.  
 ![image](https://us1.discourse-cdn.com/flex016/uploads/ameba/original/2X/6/61d3b34ef71dd780ecfff211c12c285104fff5f9.png)

You can set use\_roi parameter to 1 and your video will be cropped according to your ROI parameter settings. If use\_roi parameter is set to 1, original video will be crop/resize using the area defined by four parameters (xmin, ymin, xmax, ymax). But based on current Arduino SDK API, the image that you cropped will be scaled according to the resolution of the video.

If you would like cropping function based on face coordinates to be added into the Arduino SDK, you may submit a feature request on GitHub ([GitHub - ambiot/ambpro2\_arduino](https://github.com/ambiot/ambpro2_arduino)) and we will discuss internally to see if it is feasible to add it into the Arduino SDK. However, it will take some time for us to add it in.

Thank you, hope it helps!

---

<div class="post-metadata">

### Author: ![kzezel](https://avatars.discourse-cdn.com/v4/letter/k/e47774/32.png) [@kzezel](https://forum.amebaiot.com/u/kzezel)
#### Post date: [September 19, 2023, 2:47am UTC](https://forum.amebaiot.com/t/amb82-mini-cut-image-with-face-coordinates/2246/6 "2023-09-19T02:47:58Z")

</div>

Thank you. I will make the request.
