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)

Detecting color objects


In the previous chapters, we worked mainly with grayscale images. Of course, the shape and intensity parts of objects are important, but what about the color information? Why don't we use that too? For example, a red apple on a table can be easily detected with just the color information. Actually, that is why color object detection sometimes performs much better than other detector methods. In addition, it is much faster to implement these algorithms, and a computer usually consumes less resources for these types of operation.

The tracking.js library provides an outstanding functionality to create a color detection application. We will start from a basic color tracking example. It is relatively simple, but you need to keep in mind that it performs best only when a colored object can be easily separated from the background.

Using predefined colors with the tracking.js library

Color detection is one of the methods provided by tracking.js. To use it properly, we need to...