Hi,
I’m using set_windowing() in openmvH7 and RuntimeError happened.

Here is the code:
import sensor, image, time
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.VGA)
sensor.skip_frames(time = 2000)
sensor.set_windowing((134,243,113,110))
clock = time.clock()
img = sensor.snapshot()
while(True):
clock.tick()
img = sensor.snapshot()
But the code work well in openmv4 plus,I am quite confused.
Thanks for any help.
Raymond
Hi, which line of code is throwing the error?
If it’s snapshot then the issue is related to you asking for a buffer size that’s not aligned per all the DMA rules. To fix that just add a pixel to the window to have even boundaries.
Our code is pretty mature at this point on handling all types of crops and resolutions. If it can’t handle something it reliably catches the error instead of breaking.
yes,it’s the snapshot throwing the error.So if I change
sensor.set_windowing((134,243,113,110))
into
sensor.set_windowing((134,243,110,110))
the code would just work well?
It’s probably the odd numbers you are using:
So, Chang the 243 to 244 and 113 to 114 or etc.
But, what’s happening is that the system computed all the DMA line widths and did all the pixel calcs and it found the solution doesn’t work. So, just adjust the window until it stops complaining.
Once you have a valid solution here it’s 0 CPU load to capture an image. The whole process is DMA accelerated with just 1 interrupt to the CPU per frame.