logo

openmv内存不够,MemoryError了怎么解决?

2019-10-17 14:19
Q
_3tg5
import sensor, image, time
import pyb
pin0 = pyb.Pin('P0', pyb.Pin.OUT_PP) #蜂鸣器低电平端
pin1 = pyb.Pin('P1', pyb.Pin.OUT_PP) #蜂鸣器高电平端

thresholds = [(9, 41, -13, 39, -2, 31)]     #高水位试验阈值

sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QVGA)
sensor.skip_frames(time = 2000)
sensor.set_auto_gain(False) # must be turned off for color tracking
sensor.set_auto_whitebal(False) # must be turned off for color tracking
clock = time.clock()
ROI=(0,0,320,130)
while(1) :
    clock.tick()
    img = sensor.snapshot()
    for blob in img.find_blobs([thresholds[0]],roi=ROI, pixels_threshold=200, area_threshold=200, merge=True):
        img.draw_rectangle(blob.rect())
        img.draw_cross(blob.cx(), blob.cy())
        img.draw_rectangle(ROI)
        blobs = img.find_blobs([thresholds[0]])
        if blobs:
            pin0.low()
            #pin1.low()
            #time.sleep(200)
            pin1.high()
            time.sleep(200)
            pin1.low()
            #time.sleep(2000)
2019-10-17 18:04
I
网红小智智 星瞳科技

看上去代码有问题,为什么要在找色块的循环里面再找色块?