达到类似于这样的功能
# Hello World Example
#
# Welcome to the OpenMV IDE! Click on the green run arrow button below to run the script!
import sensor, image, time
sensor.reset() # Reset and initialize the sensor.
sensor.set_pixformat(sensor.RGB565) # Set pixel format to RGB565 (or GRAYSCALE)
sensor.set_framesize(sensor.QQVGA) # Set frame size to QVGA (320x240)
sensor.skip_frames(time = 2000) # Wait for settings take effect.
img = sensor.snapshot() # Take a picture and return the image.
img.save("hah.bmp")
for j in range(120):
for i in range(160):
(r,g,b) = img.get_pixel(i,j)
img.set_pixel(i,j,(0,0,b))
sensor.flush()
time.sleep_ms(100)
img.to_grayscale(rgb_channel=2)
这样新的灰度图就是蓝色分量。