Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
OpenCV with Python Blueprints

You're reading from   OpenCV with Python Blueprints Design and develop advanced computer vision projects using OpenCV with Python

Arrow left icon
Product type Paperback
Published in Oct 2015
Publisher Packt
ISBN-13 9781785282690
Length 230 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (2):
Arrow left icon
Michael Beyeler (USD) Michael Beyeler (USD)
Author Profile Icon Michael Beyeler (USD)
Michael Beyeler (USD)
Michael Beyeler Michael Beyeler
Author Profile Icon Michael Beyeler
Michael Beyeler
Arrow right icon
View More author details
Toc

The process flow

Features are extracted, matched, and tracked by the FeatureMatching class, especially by its public match method. However, before we can begin analyzing the incoming video stream, we have some homework to do. It might not be clear right away what some of these things mean (especially for SURF and FLANN), but we will discuss these steps in detail in the following sections. For now, we only have to worry about initialization:

class FeatureMatching:
     def __init__(self, train_image='salinger.jpg'):
  1. This sets up a SURF detector (see the next section for details) with a Hessian threshold between 300 and 500:
    self.min_hessian = 400
    self.SURF = cv2.SURF(self.min_hessian)
  2. We load a template of our object of interest (self.img_obj), or print an error if it cannot be found:
    self.img_obj = cv2.imread(train_image, cv2.CV_8UC1)
    if self.img_obj is None:
        print "Could not find train image " + train_imageraise SystemExit
  3. Also, store the shape of the image (self.sh_train...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime