Putting it all together

Now we have two different uses of two different algorithms to detect faces.

Here are some observations:

  • The images using PIGO are smoother—there are fewer jumps and lags.
  • The PIGO algorithm jitters a little more than the standard Viola-Jones method.
  • The PIGO algorithm is more robust to rotations—I could tilt my head more and still have my face detected compared to the standard Viola-Jones method.

We can of course put both of them together:

var haarCascadeFile = "Path/To/CascadeFile.xml"var blue = color.RGBA{0, 0, 255, 0}var green = color.RGBA{0, 255, 0, 0}func main() {var err error  // open webcam  if webcam, err = gocv.VideoCaptureDevice(0); err != nil {    log.Fatal(err)  }  defer webcam.Close() width := int(webcam.Get(gocv.VideoCaptureFrameWidth)) ...

Get Go Machine Learning Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.