# set\_windowing：Frame size is not supported or is not set. it is strange

**URL:** <https://forums.openmv.io/t/set-windowing-frame-size-is-not-supported-or-is-not-set-it-is-strange/10750>\
**Category:** OpenMV Boards\
**Created:** [March 19, 2025, 3:40pm UTC](https://forums.openmv.io/t/set-windowing-frame-size-is-not-supported-or-is-not-set-it-is-strange/10750 "2025-03-19T15:40:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![sjh2100](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/sjh2100/32/2979_2.png) [@sjh2100](https://forums.openmv.io/u/sjh2100)\
**Post date:** [March 19, 2025, 3:40pm UTC](https://forums.openmv.io/t/set-windowing-frame-size-is-not-supported-or-is-not-set-it-is-strange/10750/1 "2025-03-19T15:40:51Z")

</div>

![image](https://canada1.discourse-cdn.com/flex029/uploads/openmv1/original/2X/8/81e5a94a1680b796205975172cbd43068639c3f2.png)

```auto
# Untitled - By: Administrator - Wed Mar 19 2025

import sensor
import time
my_roi = (335,240,1270,678)
def sensor_set_gray():
    global my_roi
    sensor.reset()
    sensor.set_pixformat(sensor.GRAYSCALE)
    sensor.set_framesize(sensor.FHD)
    print(my_roi)    
    sensor.set_windowing(my_roi)

    sensor.set_auto_gain(True)
    sensor.set_auto_whitebal(True)

    sensor.set_auto_exposure(True)
    sensor.set_contrast(+1)
    sensor.skip_frames(time = 3000)
    return

clock = time.clock()
sensor_set_gray()
while True:
    clock.tick()
    img = sensor.snapshot()
    print(clock.fps())

```

(335, 240, 1270, 678)  
Traceback (most recent call last):  
File “”, line 23, in  
File “”, line 19, in sensor\_set\_gray  
RuntimeError: Frame size is not supported or is not set.  
OpenMV v4.5.2-dirty; MicroPython v1.20-omv-r22-dirty; OPENMV4P-STM32H743  
Type “help()” for more information.

---

<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:** [March 19, 2025, 6:15pm UTC](https://forums.openmv.io/t/set-windowing-frame-size-is-not-supported-or-is-not-set-it-is-strange/10750/2 "2025-03-19T18:15:13Z")

</div>

It’s because of the crop. The DMA hardware needs certain rules on the file size of the image in pixels. That’s being violated because of the crop. Change your x offset by like 1-3 pixels.

---

<div class="post-metadata">

**Author:** ![sjh2100](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/sjh2100/32/2979_2.png) [@sjh2100](https://forums.openmv.io/u/sjh2100)\
**Post date:** [March 19, 2025, 10:11pm UTC](https://forums.openmv.io/t/set-windowing-frame-size-is-not-supported-or-is-not-set-it-is-strange/10750/3 "2025-03-19T22:11:13Z")

</div>

your means the size of cropping image is not random, it should be 2 times of number?

---

<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:** [March 19, 2025, 10:29pm UTC](https://forums.openmv.io/t/set-windowing-frame-size-is-not-supported-or-is-not-set-it-is-strange/10750/4 "2025-03-19T22:29:25Z")

</div>

It has to pass all of this: [openmv/src/omv/ports/stm32/omv\_csi.c at master · openmv/openmv · GitHub](https://github.com/openmv/openmv/blob/master/src/omv/ports/stm32/omv_csi.c#L654)

Otherwise, the DMA system would get stuck and crash.

---

<div class="post-metadata">

**Author:** ![sjh2100](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/sjh2100/32/2979_2.png) [@sjh2100](https://forums.openmv.io/u/sjh2100)\
**Post date:** [March 20, 2025, 11:00am UTC](https://forums.openmv.io/t/set-windowing-frame-size-is-not-supported-or-is-not-set-it-is-strange/10750/5 "2025-03-20T11:00:23Z")

</div>

i set my\_roi = (340,240,1270,678),the code runs ok.
