sensor.IOCTL_SET_READOUT_WINDOW vs sensor.set_windowing


I own an OPENMV H7 R2 with MT9V034 global shutter camera sensor, and i’m interested to know whats the best approach to get a crop image of a given size without affecting fps.

First, in my code I’m setting a resolution of VGA and a pixformat of Grayscale. Then, I tried to use the sensor.IOCTL_SET_READOUT_WINDOW to set a crop image of size QQVGA but im just getting the same framesize i set at the beginning of my code. On the other hand, when i use the sensor.set_windowing function i do get crop image of framesize i’m specifying.

My questions are:
what’s the main difference between the windowing and the IOCTL_SET_READOUT_WINDOW function?
Whats’sthe proper way of implementing the IOCTL_SET_READOUT_WINDOW function?

I would appreciate if you can help clarify my doubts.

The readout window controls the low level camera pixel readout. It’s used to give you really high FPS. Like 400 or more.

However, the readout window can’t be smaller than the resolution you define. So, if you set the readout window to be less than QQVGA we just change it back to QQVGA internally.

The crop is applied on the data sent from the camera. This can be any value since it’s applied on the data stream sent from the camera where we have more flexibility.

Thanks for your answer.

So basically, IOCTL_SET_READOUT_WINDOW can change the resolution of the output image automatically, based on what i put in my program.

But rethinking the question, what i would really like to know is, with this function can i set a customized framesize of my output image? (with customized i mean something that is not defined like VGA or QVGA but more like a 100x80 or something like that, similar to what you can do with the Set_windowing function)

I ask this because using the IOCTL_SET_READOUT_WINDOW as seen in the IDE example 100_fps_led_tracking) can increase FPS a lot, part of that i believe occurs because you are using a very small exposure time (correct me if im wrong). And by the way, with that example im just getting up to 53 fps and not 100 fps(could that be because of the camera model im using?).

I’m interested in that because i’m working on an aplication to capture images objects in a moving production chain *for later postprocessing), so i need to capture all objects without loosing information, meaning i need high fps.

set_windowing is how you control to get a custom resolution. This sets the size of data captured in the frame buffer and what you will process.

However, the camera will send an image to the MCU that’s larger than set_windowing. IOCTL_SET_READOUT_WINDOW controls what the camera is actually sending.

Anyway, to get a faster FPS you need both a small IOCTL_SET_READOUT_WINDOW and low exposure.

The FPS is basically the max of the two values. If exposure is high then the camera automatically inserts large vertical blanking times between frame readouts. Then if exposure is less than the readout time you have to wait for the readout to finish.