set_windowing:Frame size is not supported or is not set. it is strange

# 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.

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.

1 Like

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

It has to pass all of this: openmv/src/omv/ports/stm32/omv_csi.c at master · openmv/openmv · GitHub

Otherwise, the DMA system would get stuck and crash.

i set my_roi = (340,240,1270,678),the code runs ok.