image.Image() OSError: Unsupported format!

sensor.reset()

# Set sensor settings
sensor.set_contrast(1)
sensor.set_gainceiling(16)
# Max resolution for template matching with SEARCH_EX is QQVGA
sensor.set_framesize(sensor.QQVGA)
# You can set windowing to reduce the search image.
#sensor.set_windowing(((640-80)//2, (480-60)//2, 80, 60))
sensor.set_pixformat(sensor.GRAYSCALE)

# Load template.
# Template should be a small (eg. 32x32 pixels) grayscale image.
line:29 template0 = image.Image("/1.pgm") 

clock = time.clock()

# Run template matching
while (True):
    clock.tick()
    img = sensor.snapshot()
    #对每个模板遍历进行模板匹配
    # find_template(template, threshold, [roi, step, search])
    # ROI: The region of interest tuple (x, y, w, h).
    # Step: The loop step used (y+=step, x+=step) use a bigger step to make it faster.
    # Search is either image.SEARCH_EX for exhaustive search or image.SEARCH_DS for diamond search
    #
    # Note1: ROI has to be smaller than the image and bigger than the template.
    # Note2: In diamond search, step and ROI are both ignored.
    t1 = template0
    r1 = img.find_template(t1, 0.80, step=4, search=SEARCH_EX) #, roi=(10, 0, 60, 60))
    if r1:
        img.draw_rectangle(r1)
        print('1')
    print(clock.fps())


Traceback (most recent call last):

File "<stdin>", line 29, in <module>

OSError: Unsupported format!

MicroPython: v1.18-omv-r6 OpenMV: v4.3.1 HAL: v1.9.0 BOARD: OPENMV4P-STM32H743

Type "help()" for more information.

It’s complaining about the PGM image you supplied. Is it actually pgm?