Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Learning OpenCV 3 Computer Vision with Python (Update)
Learning OpenCV 3 Computer Vision with Python (Update)

Learning OpenCV 3 Computer Vision with Python (Update): Unleash the power of computer vision with Python using OpenCV

Arrow left icon
Profile Icon Joe Minichino Profile Icon Joseph Howse
Arrow right icon
$9.99 $43.99
Full star icon Full star icon Half star icon Empty star icon Empty star icon 2.1 (7 Ratings)
eBook Sep 2015 266 pages 1st Edition
eBook
$9.99 $43.99
Paperback
$54.99
Subscription
Free Trial
Renews at $19.99p/m
Arrow left icon
Profile Icon Joe Minichino Profile Icon Joseph Howse
Arrow right icon
$9.99 $43.99
Full star icon Full star icon Half star icon Empty star icon Empty star icon 2.1 (7 Ratings)
eBook Sep 2015 266 pages 1st Edition
eBook
$9.99 $43.99
Paperback
$54.99
Subscription
Free Trial
Renews at $19.99p/m
eBook
$9.99 $43.99
Paperback
$54.99
Subscription
Free Trial
Renews at $19.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

Learning OpenCV 3 Computer Vision with Python (Update)

Chapter 2. Handling Files, Cameras, and GUIs

Installing OpenCV and running samples is fun, but at this stage, we want to try it out ourselves. This chapter introduces OpenCV's I/O functionality. We also discuss the concept of a project and the beginnings of an object-oriented design for this project, which we will flesh out in subsequent chapters.

By starting with a look at the I/O capabilities and design patterns, we will build our project in the same way we would make a sandwich: from the outside in. Bread slices and spread, or endpoints and glue, come before fillings or algorithms. We choose this approach because computer vision is mostly extroverted—it contemplates the real world outside our computer—and we want to apply all our subsequent algorithmic work to the real world through a common interface.

Basic I/O scripts

Most CV applications need to get images as input. Most also produce images as output. An interactive CV application might require a camera as an input source and a window as an output destination. However, other possible sources and destinations include image files, video files, and raw bytes. For example, raw bytes might be transmitted via a network connection, or they might be generated by an algorithm if we incorporate procedural graphics into our application. Let's look at each of these possibilities.

Reading/writing an image file

OpenCV provides the imread() and imwrite() functions that support various file formats for still images. The supported formats vary by system but should always include the BMP format. Typically, PNG, JPEG, and TIFF should be among the supported formats too.

Let's explore the anatomy of the representation of an image in Python and NumPy.

No matter the format, each pixel has a value, but the difference is in how the pixel is represented...

Project Cameo (face tracking and image manipulation)

OpenCV is often studied through a cookbook approach that covers a lot of algorithms but nothing about high-level application development. To an extent, this approach is understandable because OpenCV's potential applications are so diverse. OpenCV is used in a wide variety of applications: photo/video editors, motion-controlled games, a robot's AI, or psychology experiments where we log participants' eye movements. Across such different use cases, can we truly study a useful set of abstractions?

I believe we can and the sooner we start creating abstractions, the better. We will structure our study of OpenCV around a single application, but, at each step, we will design a component of this application to be extensible and reusable.

We will develop an interactive application that performs face tracking and image manipulations on camera input in real time. This type of application covers a broad range of OpenCV's functionality...

Cameo – an object-oriented design

Python applications can be written in a purely procedural style. This is often done with small applications, such as our basic I/O scripts, discussed previously. However, from now on, we will use an object-oriented style because it promotes modularity and extensibility.

From our overview of OpenCV's I/O functionality, we know that all images are similar, regardless of their source or destination. No matter how we obtain a stream of images or where we send it as output, we can apply the same application-specific logic to each frame in this stream. Separation of I/O code and application code becomes especially convenient in an application, such as Cameo, which uses multiple I/O streams.

We will create classes called CaptureManager and WindowManager as high-level interfaces to I/O streams. Our application code may use CaptureManager to read new frames and, optionally, to dispatch each frame to one or more outputs, including a still image file, a...

Summary

By now, we should have an application that displays a camera feed, listens for keyboard input, and (on command) records a screenshot or screencast. We are ready to extend the application by inserting some image-filtering code (Chapter 3, Filtering Images) between the start and end of each frame. Optionally, we are also ready to integrate other camera drivers or application frameworks (Appendix A, Integrating with Pygame, OpenCV Computer Vision with Python) besides the ones supported by OpenCV.

We also now have the knowledge to process images and understand the principle of image manipulation through the NumPy arrays. This forms the perfect foundation to understand the next topic, filtering images.

Left arrow icon Right arrow icon

Description

OpenCV 3 is a state-of-the-art computer vision library that allows a great variety of image and video processing operations. Some of the more spectacular and futuristic features such as face recognition or object tracking are easily achievable with OpenCV 3. Learning the basic concepts behind computer vision algorithms, models, and OpenCV's API will enable the development of all sorts of real-world applications, including security and surveillance. Starting with basic image processing operations, the book will take you through to advanced computer vision concepts. Computer vision is a rapidly evolving science whose applications in the real world are exploding, so this book will appeal to computer vision novices as well as experts of the subject wanting to learn the brand new OpenCV 3.0.0. You will build a theoretical foundation of image processing and video analysis, and progress to the concepts of classification through machine learning, acquiring the technical know-how that will allow you to create and use object detectors and classifiers, and even track objects in movies or video camera feeds. Finally, the journey will end in the world of artificial neural networks, along with the development of a hand-written digits recognition application.

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Sep 29, 2015
Length: 266 pages
Edition : 1st
Language : English
ISBN-13 : 9781785289774
Category :
Languages :
Tools :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Sep 29, 2015
Length: 266 pages
Edition : 1st
Language : English
ISBN-13 : 9781785289774
Category :
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total $ 153.97
Learning OpenCV 3 Computer Vision with Python (Update)
$54.99
OpenCV with Python Blueprints
$43.99
OpenCV with Python By Example
$54.99
Total $ 153.97 Stars icon
Banner background image

Table of Contents

10 Chapters
1. Setting Up OpenCV Chevron down icon Chevron up icon
2. Handling Files, Cameras, and GUIs Chevron down icon Chevron up icon
3. Processing Images with OpenCV 3 Chevron down icon Chevron up icon
4. Depth Estimation and Segmentation Chevron down icon Chevron up icon
5. Detecting and Recognizing Faces Chevron down icon Chevron up icon
6. Retrieving Images and Searching Using Image Descriptors Chevron down icon Chevron up icon
7. Detecting and Recognizing Objects Chevron down icon Chevron up icon
8. Tracking Objects Chevron down icon Chevron up icon
9. Neural Networks with OpenCV – an Introduction Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Half star icon Empty star icon Empty star icon 2.1
(7 Ratings)
5 star 14.3%
4 star 14.3%
3 star 0%
2 star 14.3%
1 star 57.1%
Filter icon Filter
Top Reviews

Filter reviews by




G. A. Patino Nov 06, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This book is a great introduction to both computer vision in general, and OpenCV in Python in particular, but even people familiar with computer vision methods will find it useful to learn how to implement them in the Python ecosystem or how to optimize function parameters. An introductory to intermediate command of Python is assumed. The author's present the different concepts within the context of developing an application, and while the book doesn't follow the cookbook format, by the end you will still have a group of very useful scripts that can easily be applied to other projects. The presentation of the programming scripts is detailed and easy to follow. The authors have taken great care to build the complexity of the scripts slowly and without gaps in the sequencing. The use of each script is very well illustrated with images along the book. My only complaint is that the book is still based on Python 2.7, but the code doesn't seem to require many modifications to run in Python 3
Amazon Verified review Amazon
Amazon Customer Nov 13, 2015
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
Learning OpenCV 3 Computer Vision with Python - Second Edition I have done programming in python and was interested in learning OpenCV. This book did great job in introducing the basic computer Vision programming using python. OpenCV 3 is a computer vision library that is used for a variety of image and video processing operations. Some advance features such as face recognition or object tracking, are easily achievable with OpenCV 3.Overall, I found the book was easy to follow and it even included code examples from the book.
Amazon Verified review Amazon
Garret Vo Jan 19, 2016
Full star icon Full star icon Empty star icon Empty star icon Empty star icon 2
The book attempts to provide an introduction to computer vision with opencv. However, the code is incomplete, and the book is hard to follow. I would not recommend this book for beginners who try to learn opencv with python.
Amazon Verified review Amazon
Amazon Customer Feb 03, 2017
Full star icon Empty star icon Empty star icon Empty star icon Empty star icon 1
Really poor. No one revised the book. Instructions and links don't work. And there is no orientation regarding what to do when things go wrong. I'm be better just googling everything or using free OpenCV docs. Waste of money. Not sure if Amazon accepts returns.
Amazon Verified review Amazon
marco Nov 16, 2015
Full star icon Empty star icon Empty star icon Empty star icon Empty star icon 1
I didn`t like the book. The source code is incomplete. There are some mistakes in the code. I gave up the book and gave up Python too.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.