AMB82-mini Extract frame for custom processing from RTSP stream

Hello. I have a use case where I’m streaming video through RTSP from AMB82 to my network. I want to periodically (every 5-10s) take a frame as a bitmap array or something like this and perform my custom operations on it (simple image processing, like calculating a histogram etc). How can I get a frame from an RTSP stream example in the runtime to use it for my algorithms?

You can refer to
https://www.amebaiot.com/en/amebapro2-arduino-neuralnework-face-recognition-jpeg/

https://www.amebaiot.com/en/rtl8735b-arduino-api-videostream/