如何将矩形r中的w和h赋值给一个新的变量
-
import sensor, image, time sensor.reset() sensor.set_pixformat(sensor.GRAYSCALE) # 灰度更快(160x120 max on OpenMV-M7) sensor.set_framesize(sensor.QQVGA) sensor.skip_frames(time = 2000) clock = time.clock() while(True): clock.tick() img = sensor.snapshot() # 下面的`threshold`应设置为足够高的值,以滤除在图像中检测到的具有 # 低边缘幅度的噪声矩形。最适用与背景形成鲜明对比的矩形。 for r in img.find_rects(threshold = 10000): img.draw_rectangle(r.rect()) print('you send:',r)#写到串口监视端,让你能够看到数据
-
w = r.w() h = r.h() print(w,h)
https://docs.singtown.com/micropython/zh/latest/openmvcam/library/omv.image.html#image.rect.rect.w