为什么在中文文档中找的方法报错?
-
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 "", line 77, in
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())
我这样使用就会报这样的错
主要是想问大家这个东西该怎么用
-
find_blobs返回的是列表,里面包含很多个blob对象,尝试用for blob in blobs:来打印每一个blob的conners