下面是先拍目标物体后,画面就泛红的图片和不泛红的图片
1
17788265935
@17788265935
0
声望
13
楼层
859
资料浏览
0
粉丝
0
关注
17788265935 发布的帖子
-
摄像头在照到目标物体后会泛红是怎么回事
如题,这是我的代码import sensor, image, time
sensor.reset() # Initialize the camera sensor.
sensor.set_pixformat(sensor.RGB565) # use RGB565.
sensor.set_framesize(sensor.QQVGA) # use QVGA for quailtiy ,use QQVGA for speed.
sensor.skip_frames(10) # Let new settings take affect.
sensor.set_auto_whitebal(False)
#关闭白平衡。白平衡是默认开启的,在颜色识别中,需要关闭白平衡。
blue_threshold = (25, 75, -10, 18, -53, -37)
clock = time.clock() # Tracks FPS.
while(True):
clock.tick() img = sensor.snapshot().lens_corr(1.8)#.binary([yellow_threshold] for c in img.find_circles(threshold = 3000,x_margin = 10, y_margin = 10, r_margin = 10,r_min = 2, r_max = 100, r_step = 2): area = (c.x()-c.r(), c.y()-c.r(), 2*c.r(), 2*c.r()) blob= img.find_blobs([blue_threshold],roi=area)#寻找黄色最大的色块 if blob: #如果找到了目标颜色 for b in blob:#迭代找到目标颜色区域 img.draw_rectangle(b[0:4]) # rect img.draw_cross(b[5], b[6]) # cx, cy img.draw_circle(c.x(), c.y(), c.r(), color = (255, 0, 0)) x = b.cx() y = b.cy()
之前接过其他模块,是个感光模块