import sensor, image, tv
from PIL import Image
sensor.reset() # Initialize the camera sensor.
sensor.set_pixformat(sensor.RGB565) # or sensor.GRAYSCALE
sensor.set_framesize(sensor.QQVGA)
tv.init() # Initialize the tv.
while(True):
img = sensor.snapshot()
img.convert('L')
tv.display(img)
https://docs.singtown.com/micropython/zh/latest/openmvcam/library/omv.image.html#image.to_grayscale