sensor.reset() # Reset and initialize the sensor.
sensor.set_pixformat(sensor.RGB565) # Set pixel format to RGB565 (or GRAYSCALE)
sensor.set_framesize(sensor.QVGA) # Set frame size to QVGA (320x240)
sensor.skip_frames(time = 2000) # Wait for settings take effect.
clock = time.clock() # Create a clock object to track the FPS.
while(True):
clock.tick() # Update the FPS clock.
img = sensor.snapshot() # Take a picture and return the image.
print(clock.fps()) # Note: OpenMV Cam runs about half as fast when connected
# to the IDE. The FPS should increase once disconnected.
- image.get_pixel(x, y)
- 对于灰度图: 返回(x,y)坐标的灰度值.
- 对于彩色图: 返回(x,y)坐标的(r,g,b)的tuple.
同样,我们可以通过image.set_pixel(x, y, pixel)方法,来设置一个像素点的值。
- image.set_pixel(x, y, pixel)
- 对于灰度图: 设置(x,