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 now! 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
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
OpenCV 3 Computer Vision Application Programming Cookbook

You're reading from   OpenCV 3 Computer Vision Application Programming Cookbook Recipes to make your applications see

Arrow left icon
Product type Paperback
Published in Feb 2017
Publisher
ISBN-13 9781786469717
Length 474 pages
Edition 3rd Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Robert Laganiere Robert Laganiere
Author Profile Icon Robert Laganiere
Robert Laganiere
Arrow right icon
View More author details
Toc

Table of Contents (15) Chapters Close

Preface 1. Playing with Images FREE CHAPTER 2. Manipulating Pixels 3. Processing the Colors of an Image 4. Counting the Pixels with Histograms 5. Transforming Images with Morphological Operations 6. Filtering the Images 7. Extracting Lines, Contours, and Components 8. Detecting Interest Points 9. Describing and Matching Interest Points 10. Estimating Projective Relations in Images 11. Reconstructing 3D Scenes 12. Processing Video Sequences 13. Tracking Visual Motion 14. Learning from Examples

Scanning an image with iterators

In object-oriented programming, looping over a data collection is usually done using iterators. Iterators are specialized classes that are built to go over each element of a collection, hiding how the iteration over each element is specifically done for a given collection. This application of the information-hiding principle makes scanning a collection easier and safer. In addition, it makes it similar in form no matter what type of collection is used. The Standard Template Library (STL) has an iterator class associated with each of its collection classes. OpenCV then offers a cv::Mat iterator class that is compatible with the standard iterators found in the C++ STL.

Getting ready

In this recipe, we again use the color reduction example described in the previous recipe.

How to do it...

An iterator object for a cv::Mat instance can be obtained by first creating a cv::MatIterator_ object. As is the case with cv::Mat_, the underscore indicates that this is a template...

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 $19.99/month. Cancel anytime