# sensor.IOCTL\_SET\_READOUT\_WINDOW vs sensor.set\_windowing

**URL:** <https://forums.openmv.io/t/sensor-ioctl-set-readout-window-vs-sensor-set-windowing/8357>\
**Category:** OpenMV Boards\
**Created:** [May 24, 2023, 8:25am UTC](https://forums.openmv.io/t/sensor-ioctl-set-readout-window-vs-sensor-set-windowing/8357 "2023-05-24T08:25:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![KUP](https://avatars.discourse-cdn.com/v4/letter/k/439d5e/32.png) [@KUP](https://forums.openmv.io/u/KUP)\
**Post date:** [May 24, 2023, 8:25am UTC](https://forums.openmv.io/t/sensor-ioctl-set-readout-window-vs-sensor-set-windowing/8357/1 "2023-05-24T08:25:45Z")

</div>

Hi,

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.

---

<div class="post-metadata">

**Author:** ![kwagyeman](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwagyeman/32/4_2.png) [@kwagyeman](https://forums.openmv.io/u/kwagyeman)\
**Post date:** [May 24, 2023, 5:59pm UTC](https://forums.openmv.io/t/sensor-ioctl-set-readout-window-vs-sensor-set-windowing/8357/2 "2023-05-24T17:59:58Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![KUP](https://avatars.discourse-cdn.com/v4/letter/k/439d5e/32.png) [@KUP](https://forums.openmv.io/u/KUP)\
**Post date:** [May 25, 2023, 9:07am UTC](https://forums.openmv.io/t/sensor-ioctl-set-readout-window-vs-sensor-set-windowing/8357/3 "2023-05-25T09:07:19Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![kwagyeman](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwagyeman/32/4_2.png) [@kwagyeman](https://forums.openmv.io/u/kwagyeman)\
**Post date:** [May 25, 2023, 5:40pm UTC](https://forums.openmv.io/t/sensor-ioctl-set-readout-window-vs-sensor-set-windowing/8357/4 "2023-05-25T17:40:06Z")

</div>

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.
