基于Openmv图形与颜色识别。(起重机大赛)<第二章>

import sensor, image, time, math, pyb ,utime
from pyb import UART
from pyb import LED
from pyb import Pin
LED(1).on()
LED(2).on()
LED(3).on()
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QVGA)
sensor.skip_frames(time = 2000)
sensor.set_auto_gain(False)
sensor.set_auto_whitebal(False)
clock = time.clock()
sensor.set_auto_gain(False)
sensor.set_auto_whitebal(False)
uart = UART(3, 115200)
thresholds = [(0, 100, 127, 16, -128, 127),
              (0, 70, 127, -128, -8, -128)]
while(True):
 pin0 = Pin('P0',Pin.IN,Pin.PULL_DOWN)
 if pin0.value()==1:
    clock.tick()
    img = sensor.snapshot().lens_corr(1.8)
    for blob in img.find_blobs(thresholds , pixels_threshold=200  , area_threshold=200):
            if 0.40 < blob.density() < 0.65:
                statistics = img.get_statistics(thresholds)
                if 10

你可能感兴趣的:(stm32,python)