logo

为什么iris会报错,显示没定义?

2020-08-28 21:38
N
_65gc
while (True):
    clock.tick()
    # Capture snapshot
    img = sensor.snapshot()
    # Find eyes !
    # Note: Lower scale factor scales-down the image more and detects smaller objects.
    # 注意:较低的比例因子会进一步缩小图像,并检测较小的物体。
    # Higher threshold results in a higher detection rate, with more false positives.
    # 阈值越高,检测率越高,假阳性也越多。
    eyes = img.find_features(eyes_cascade, threshold=0.5, scale=1.5)
    # 先利用find_features函数识别人眼。image.find_features(cascade, threshold=0.5, scale=1.5),thresholds越大,
    # 匹配速度越快,错误率也会上升。scale可以缩放被匹配特征的大小。

    # 在识别到的人眼中寻找瞳孔。
    for e in eyes:
        iris = img.find_eye(e)
        #image.find_eye((x, y, w, h)),find_eye的参数是一个矩形区域,左上顶点为
        #(x,y),宽w,高h,注意(x,y,w,h)是一个元组,不要漏掉括号()。上行代码中
        #的e即代表识别到的眼睛的矩形区域。
        #find_eye的原理是找到区域中颜色最深处的中心。
        img.draw_rectangle(e)
        img.draw_cross(iris[0], iris[1])
        #用矩形标记人眼,用十字形标记瞳孔。
        output_str="[%d,%d]"%(iris[0][0]-basic1, iris[0][1]-basic2)
        print('you send:',output_str)
    while basic1==0:
   
        basic1=int(iris[0][0])  
        basic2=int(iris[0][1])
        
       
    # Print FPS.
    # 注:实际FPS更高,流FB使它更慢![0_1598621856469_QQ图片20200828213715.png](https://fcdn.singtown.com/4d61858f-7597-4e2e-b139-18e62a6835c9.png)
0a8226b0-a174-4a96-84c5-1fdf10a24200.png
2020-08-29 18:21
I
网红小智智 星瞳科技

https://www.bing.com/search?q=python+%E5%B1%80%E9%83%A8%E5%8F%98%E9%87%8F&form=QBLH&sp=-1&pq=python+%E5%B1%80%E9%83%A8%E5%8F%98%E9%87%8F&sc=0-11&qs=n&sk=&cvid=0723BDD8ABFA4BFF9A854D36C38318E6