Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
OpenCV Computer Vision Application Programming Cookbook Second Edition

You're reading from  OpenCV Computer Vision Application Programming Cookbook Second Edition

Product type Book
Published in Aug 2014
Publisher Packt
ISBN-13 9781782161486
Pages 374 pages
Edition 1st Edition
Languages
Author (1):
Robert Laganiere Robert Laganiere
Profile icon Robert Laganiere

Table of Contents (18) Chapters

OpenCV Computer Vision Application Programming Cookbook Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Playing with Images Manipulating Pixels Processing Color Images with Classes Counting the Pixels with Histograms Transforming Images with Morphological Operations Filtering the Images Extracting Lines, Contours, and Components Detecting Interest Points Describing and Matching Interest Points Estimating Projective Relations in Images Processing Video Sequences Index

Backprojecting a histogram to detect specific image content


A histogram is an important characteristic of an image's content. If you look at an image area that shows a particular texture or a particular object, then the histogram of this area can be seen as a function that gives the probability that a given pixel belongs to this specific texture or object. In this recipe, you will learn how the concept of histogram backprojection can be advantageously used to detect specific image content.

How to do it...

Suppose you have an image and you wish to detect specific content inside it (for example, in the following image, the clouds in the sky). The first thing to do is to select a region of interest that contains a sample of what you are looking for. This region is the one inside the rectangle drawn on the following test image:

In our program, the region of interest is obtained as follows:

   cv::Mat imageROI;
   imageROI= image(cv::Rect(216,33,24,30)); // Cloud region

You then extract the histogram...

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