Saving an image as .ppm

Hy there

I’m using a H7 Board and an OV7725 Image sensor with firmware version 3.6.7

My question is below, here is some info on the application:
I would like to take a snapshot in “high res”, save the image and do some computations on a reduced (in size and color) image, then look for tags/markers/rois within the reduced image.
After i have found some roi’s, i want to reload the high res image, get those rois (from the higer res image) and decode the info I expect to find.

The Question:
I’m Trying to save a VGA/RGB585 Image as a .ppm, but it dosen’t seem to work if i go above QVGA (with QVGA the script runs fine).
Say if i set framesize to VGA, i get the following error: OSError: Image is not PPM!
I have looked trough the doc and the forum, to no availe, what am i missing?

import sensor, image, time, pyb, machine


clock = time.clock()

fname = "tempImg.ppm"

cnt = 0;
t_save = 0;
t_load = 0;

while(cnt < 100):
    img = sensor.snapshot()

    now = pyb.millis()
    t_save = pyb.millis() - now + t_save

    now = pyb.millis()
    img = image.Image(fname, copy_to_fb = True)
    t_load = pyb.millis() - now + t_load


    cnt = cnt + 1

print("ran " + str(cnt) + "times, avg save: " + str(t_save/cnt) + ", avg load: " + str(t_load/cnt))

sensor.skip_frames(time = 2000)

Thanks for your time

Hi, the H7 regular switches to Bayer internally when the resolution is 640x480. Most functions in our vision library don’t work with bayer. We plan to roll more support for bayer image processing out in the future though.

Grayscale does not have this issue.