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?
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?
Yes! Crop all faces in a snapshot
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.
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), 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.
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) 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!
Thank you. I will make the request.