import sensor, image, time
from pyb import UART
green_threshold = ( 66, 80, -15, 0, -6, 15)
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QQVGA)
sensor.skip_frames(time = 2000)
sensor.set_auto_gain(False)
sensor.set_auto_whitebal(False)
clock = time.clock()
uart = UART(3, 115200)
while(True):
clock.tick()
img = sensor.snapshot()
print(type(img))
blobs = img.find_blobs([green_threshold])
print(blobs.corners())
if blobs:
for b in blobs:
img.draw_rectangle(b[0:4])
for i in range(4):
print(b[i])
img.draw_cross(b[5], b[6])
uart.write("x:")
uart.write(str(b[5]))
uart.write("y:")
uart.write(str(b[6]))
uart.write("\r\n")
print("x:"+str(b[5])+","+"y:"+str(b[6]))
#print(clock.fps()) # 注意: 你的OpenMV连到电脑后帧率大概为原来的一半
Traceback (most recent call last):
File "
AttributeError: 'list' object has no attribute 'corners'
MicroPython: v1.15-r32 OpenMV: v4.0.2 HAL: v1.9.0 BOARD: OPENMV4P-STM32H743
Type "help()" for more information.
print(blobs.corners())
我这样使用就会报这样的错
主要是想问大家这个东西该怎么用