Lossless process - video capturing and analyzing in Matlab

1. Where did you get the camera module(s)?

2. Model number of the product(s).
Arducam IMX219 Auto Focus IR Sensitive (NoIR) Camera Module, drop-in replacement for Raspberry Pi V2 and Jetson Nano Camera
Arducam Raspberry Pi Noir Camera Module, 8MP IMX219 RPi-CAM-V2

3. What hardware/platform were you working on?
Raspberry pi 4, 2GB

4. Instructions you have followed. (link/manual/etc.)
Installed all required drivers and Picamera2. All preview and recordings are working.

5. Problems you were having.
Picamera2 enable to record video either in h264, mjpeg, or raw bayer. The first two I can open and convert to a format that Matlab can work with - the results are always lossy, and since I look for a pixel size movement - I do not want to take this chance.

8. What help do you need?
I can not open the raw bayer, and do not find any relevant example, what do you suggest?

I found “picam2.capture_buffer()”, which solves my problem, in one of the examples.