In [4]:
w = calico.makeCameraWidget()
w
In [7]:
from Accord.Vision.Detection import *
from Accord.Vision.Detection.Cascades import *
cascade = FaceHaarCascade()
detector = HaarObjectDetector(cascade, 45)

def findface(image):
    points = detector.ProcessFrame(image.toBitmap())
    w = Window(image.width, image.height)
    w.draw(image)
    calico.display(image)
    calico.display(points)
    for j in points:
        r = Rectangle((j.X, j.Y), (j.X + j.Width, j.Y + j.Height))
        r.outline = Color("green")
        r.setWidth(3)
        r.fill = None
        w.draw(r)
    calico.animate(w)
In [6]:
from Graphics import *
def f(value_name, value):
    v = Picture(w.imageuri)
    findface(v)
    
w.on_value_change(f, "imageuri")
In [ ]: