是因为IDE没有接收到数据。代码里是正常采集到的。
如果想显示,可以这样:
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.QVGA) # Set frame size to QVGA (320x240)
sensor.skip_frames(time = 2000) # Wait for settings take effect.
# 获得一帧图像
img = sensor.snapshot()
threshold = (0,100, -128,127, 20,50)
img.binary([threshold])
img = sensor.snapshot()
while True:
time.sleep(1)