Book Image

Computer Vision for the Web

By : Foat Akhmadeev
Book Image

Computer Vision for the Web

By: Foat Akhmadeev

Overview of this book

This book will give you an insight into controlling your applications with gestures and head motion and readying them for the web. Packed with real-world tasks, it begins with a walkthrough of the basic concepts of Computer Vision that the JavaScript world offers us, and you’ll implement various powerful algorithms in your own online application. Then, we move on to a comprehensive analysis of JavaScript functions and their applications. Furthermore, the book will show you how to implement filters and image segmentation, and use tracking.js and jsfeat libraries to convert your browser into Photoshop. Subjects such as object and custom detection, feature extraction, and object matching are covered to help you find an object in a photo. You will see how a complex object such as a face can be recognized by a browser as you move toward the end of the book. Finally, you will focus on algorithms to create a human interface. By the end of this book, you will be familiarized with the application of complex Computer Vision algorithms to develop your own applications, without spending much time learning sophisticated theory.
Table of Contents (13 chapters)

Tagging people with tracking.js


To see more about Haar-like features and its implementation, we will discuss tracking.js library. It provides nearly the same functionality as the JSFeat library. What is interesting is that it supplies classifiers for other different objects, for example, face particles. Eventually, we will see how to make it possible to tag friends.

Haar features with tracking.js

Tracking.js provides the functionality to detect not only a face, but various face particles too. It is very easy to do that. You need to perform the following steps:

  1. First, you need to add object files for what you want to detect:

    <script src="/path/to/face.js"></script>
    <script src="/path/to/eye.js"></script>
    <script src="/path/to/mouth.js"></script>
  2. Next, initialize the ObjectTracker function. We did not discuss this in the previous chapter, since it is mostly focused on face detection, not just a regular object. Anyway, we initialize it with the names of the objects...