Computer Vision for the Web: Unleash the power of the Computer Vision algorithms in JavaScript to develop vision-enabled web content
()
About this ebook
Foat Akhmadeev
Foat Akhmadeev has 5 years of experience in software development and research. He completed his master's degree in the year 2014 from the Kazan Federal University, Russia. He has worked on different projects, including development of high-loaded websites written in Java and real-time object detection for mobile phones. He has an extensive background in the field of Computer Vision. He has also written a scientific paper on 3D reconstruction from a single image. For more information, you can visit his website at http://foat.me.
Related to Computer Vision for the Web
Related ebooks
OpenCV Android Programming By Example: Leverage OpenCV to develop vision-aware and intelligent Android applications. Rating: 0 out of 5 stars0 ratingsMastering WebGL: Crafting Advanced 3D Web Experiences: WebGL Wizadry Rating: 0 out of 5 stars0 ratingsOpenCV Essentials Rating: 0 out of 5 stars0 ratingsMastering OpenCV 3 - Second Edition Rating: 0 out of 5 stars0 ratingsNW.js Essentials Rating: 0 out of 5 stars0 ratingsOpenCV with Python Blueprints: Design and develop advanced computer vision projects using OpenCV with Python Rating: 0 out of 5 stars0 ratingsMastering Three.js: A Journey Through 3D Web Development Rating: 0 out of 5 stars0 ratingsHTML 5 Shoot 'em Up in an Afternoon Rating: 0 out of 5 stars0 ratingsJava for Data Science Rating: 0 out of 5 stars0 ratingsMastering D3.js Rating: 3 out of 5 stars3/5OpenCV By Example Rating: 0 out of 5 stars0 ratingsOpenCV for Secret Agents Rating: 0 out of 5 stars0 ratingsActionScript Graphing Cookbook Rating: 0 out of 5 stars0 ratingsNeural Networks with Python Rating: 0 out of 5 stars0 ratingsUltimate Python Libraries for Data Analysis and Visualization Rating: 0 out of 5 stars0 ratingsOpenCV Computer Vision Application Programming Cookbook Second Edition Rating: 0 out of 5 stars0 ratingsMastering OpenCV with Python Rating: 0 out of 5 stars0 ratingsOpenFlow Cookbook Rating: 5 out of 5 stars5/5Build Your Own Distributed Compilation Cluster - A Practical Walkthrough Rating: 0 out of 5 stars0 ratingsFennel Explained: A Lisp for Lua in Game Development and Embedding Rating: 0 out of 5 stars0 ratingsLearning Highcharts 4 Rating: 0 out of 5 stars0 ratingsDynamic Programming in Java: From Basics to Expert Proficiency Rating: 0 out of 5 stars0 ratingsBuilding Modern GUIs with tkinter and Python: Building user-friendly GUI applications with ease (English Edition) Rating: 0 out of 5 stars0 ratingsDjango 1.0 Template Development Rating: 0 out of 5 stars0 ratingsUltimate Web Authentication Handbook Rating: 0 out of 5 stars0 ratingsBeagleBone Robotic Projects Rating: 5 out of 5 stars5/5Kinect in Motion – Audio and Visual Tracking by Example Rating: 0 out of 5 stars0 ratingsTypeScript Programming In Action: Code Editing For Software Engineers Rating: 0 out of 5 stars0 ratings
Programming For You
Python Programming : How to Code Python Fast In Just 24 Hours With 7 Simple Steps Rating: 4 out of 5 stars4/5Python Data Structures and Algorithms Rating: 5 out of 5 stars5/5Python: Learn Python in 24 Hours Rating: 4 out of 5 stars4/5Coding All-in-One For Dummies Rating: 4 out of 5 stars4/5SQL QuickStart Guide: The Simplified Beginner's Guide to Managing, Analyzing, and Manipulating Data With SQL Rating: 4 out of 5 stars4/5Coding All-in-One For Dummies Rating: 0 out of 5 stars0 ratingsSQL All-in-One For Dummies Rating: 3 out of 5 stars3/5Python: For Beginners A Crash Course Guide To Learn Python in 1 Week Rating: 4 out of 5 stars4/5Excel : The Ultimate Comprehensive Step-By-Step Guide to the Basics of Excel Programming: 1 Rating: 5 out of 5 stars5/5Linux: Learn in 24 Hours Rating: 5 out of 5 stars5/5Excel 101: A Beginner's & Intermediate's Guide for Mastering the Quintessence of Microsoft Excel (2010-2019 & 365) in no time! Rating: 0 out of 5 stars0 ratingsBeginning Programming with Python For Dummies Rating: 3 out of 5 stars3/5Microsoft Azure For Dummies Rating: 0 out of 5 stars0 ratingsSQL: For Beginners: Your Guide To Easily Learn SQL Programming in 7 Days Rating: 5 out of 5 stars5/5Escape the Game: How to Make Puzzles and Escape Rooms Rating: 3 out of 5 stars3/5Learn to Code. Get a Job. The Ultimate Guide to Learning and Getting Hired as a Developer. Rating: 5 out of 5 stars5/5Learn PowerShell in a Month of Lunches, Fourth Edition: Covers Windows, Linux, and macOS Rating: 5 out of 5 stars5/5PYTHON PROGRAMMING Rating: 4 out of 5 stars4/5iPhone 16 Pro Max User Manual: The Complete Step-By-Step Guide to Maximize your New iPhone 16 Pro Max and iOS 18 Rating: 0 out of 5 stars0 ratings
Reviews for Computer Vision for the Web
0 ratings0 reviews
Book preview
Computer Vision for the Web - Foat Akhmadeev
Table of Contents
Computer Vision for the Web
Credits
About the Author
About the Reviewer
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Downloading the color images of this book
Errata
Piracy
Questions
1. Math Never Was So Simple!
Installation and core structure representation of JSFeat
Initializing the project
Understanding a digital image
Loading an image into a matrix
Basic matrix operations
Going deeper
Matrix displaying
Useful functions and where to use them
Sorting using JSFeat
Linear algebra
A perspective example
Summary
2. Turn Your Browser into Photoshop
Introducing the tracking.js library
Installation and image loading
Conversion between JSFeat and tracking.js image formats
What is filtering and how to use it?
Image convolution
The Gaussian filter and separate convolution
The box blur
The integral image
Basic edge detection
The Sobel filter
Other operators
Advanced image processing
The Canny edge detector
Histogram equalization
Summary
3. Easy Object Detection for Everyone
Detecting color objects
Using predefined colors with the tracking.js library
Using your own colors
Digging into the tracking.js API
Using the and
Building a custom tracker
Image features
Detecting key points
A practical example
Descriptors and object matching
The BRIEF and ORB descriptors
Descriptors implementation and their matching
Finding an object location
Summary
4. Smile and Wave, Your Face Has Been Tracked!
Face detection with JSFeat
Face detection using Haar-like features
Brightness binary features
Tagging people with tracking.js
Haar features with tracking.js
Tagging people in photos
Head tracking with Camshift
The idea behind head tracking
The head tracking application
Summary
5. May JS Be with You! Control Your Browser with Motion
Basic tracking with tracking.js
An example of an object tracking application
Controlling objects with the head motion
The Head-coupled perspective
Controlling a simple box
Optical flow for motion estimation
The Lucas-Kanade optical flow
Optical flow map with oflow
Track points with JSFeat
Zooming with gestures
Summary
6. What's Next?
Refresh your memory
Importance of client-side scripting
Other interesting libraries in Computer Vision
CCV library and its extensions
Face detection and more
Object detection with js-objectdetect
Summary
Index
Computer Vision for the Web
Computer Vision for the Web
Copyright © 2015 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: October 2015
Production reference: 1091015
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78588-617-1
www.packtpub.com
Credits
Author
Foat Akhmadeev
Reviewer
Noritsuna Imamura
Acquisition Editor
Tushar Gupta
Content Development Editor
Amey Varangaonkar
Technical Editor
Vivek Pala
Copy Editor
Pranjali Chury
Project Coordinator
Francina Pinto
Proofreader
Safis Editing
Indexer
Mariammal Chettiyar
Graphics
Disha Haria
Production Coordinator
Arvindkumar Gupta
Cover Work
Arvindkumar Gupta
About the Author
Foat Akhmadeev has 5 years of experience in software development and research. He completed his master's degree in the year 2014 from the Kazan Federal University, Russia. He has worked on different projects, including development of high-loaded websites written in Java and real-time object detection for mobile phones. He has an extensive background in the field of Computer Vision. He has also written a scientific paper on 3D reconstruction from a single image. For more information, you can visit his website at http://foat.me.
About the Reviewer
Noritsuna Imamura is a specialist in embedded Linux/Android-based Computer Vision, and is one of the main members of SIProp.org (http://siprop.org/). His main works are as follows:
ITRI Smart Glass, which is similar to Google Glass. He worked on this using Android 4.3 and OpenCV 2.4 in June 2014 (https://www.itri.org.tw/chi/Content/techTransfer/tech_tran_cont.aspx?&SiteID=1&MmmID=620622510147005345&Keyword=&MSid=4858).
The Treasure Hunting Robot, a brainwave controlling robot that he developed in February 2012 (http://www.siprop.org/en/2.0/index.php?product%2FTreasureHuntingRobot).
OpenCV for Android NDK. This has been included since Android 4.0.1 (http://tools.oesf.biz/android-4.0.1_r1.0/search?q=SIProp).
The Auto Chasing Turtle, a human face recognition robot with Kinect, which he developed in February 2011 (http://www.siprop.org/ja/2.0/index.php?product%2FAutoChasingTurtle).
Feel Sketch—an AR Authoring Tool and AR Browser as an Android application, which he developed in December 2009 (http://code.google.com/p/feelsketch/).
He can be contacted via e-mail at <[email protected]>.
www.PacktPub.com
Support files, eBooks, discount offers, and more
For support files and downloads related to your book, please visit www.PacktPub.com.
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at
At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.
Support files, eBooks, discount offers, and morehttps://www2.packtpub.com/books/subscription/packtlib
Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can search, access, and read Packt's entire library of books.
Why subscribe?
Fully searchable across every book published by Packt
Copy and paste, print, and bookmark content
On demand and accessible via a web browser
Free access for Packt account holders
If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view 9 entirely free books. Simply use your login credentials for immediate access.
Preface
Computer Vision is one of the popular areas in computer science that have gained widespread importance lately. Besides, the power of personal computers has grown, thus opening the gate for developers to use Computer Vision algorithms directly on end user machines using client-side scripting. Nowadays, the most popular programming language for the web is JavaScript. It allows us to develop complex algorithms and run them directly in a web browser; this solves several major problems—the user needs nothing but a browser to run a web application, and as a developer, you get a lower load on your server. In this book, we will provide a comprehensive overview of the most popular JavaScript libraries and discuss the techniques they provide to help you in your initial steps in exciting fields, such as image processing and Computer Vision. This book covers Computer Vision methods by providing an intuitive overview of each algorithm and showing clear examples of the usage of libraries.
What this book covers
Chapter 1, Math Never Was So Simple! covers most of the necessary math operations that you need for using Computer Vision libraries and developing your own application.
Chapter 2, Turning Your Browser into Photoshop, introduces the most popular image processing techniques that are commonly used in the Computer Vision area.
Chapter 3, Easy Object Detection for Everyone, provides a detailed overview of object detection in photos and videos, starting from the basic examples, such as detecting objects by color, to the more complex examples such as feature detection.
Chapter 4, Smile and Wave, Your Face Has Been Tracked! covers detection of the face and face particles. In addition to this, it gives you an example of head tracking.
Chapter 5, May JS Be with You! Control Your Browser with Motion, extends the topic of object detection to object tracking and provides exhaustive examples. It also demonstrates how to create a human interface using gestures or head motion.
Chapter 6, What's Next? summarizes all that we will do throughout this book. Moreover, it provides references to several libraries that are not presented here.
What you need for this book
This book provides an