Search icon
Subscription
0
Cart icon
Close icon
You have no products in your basket yet
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
1. Playing with Images 2. Manipulating Pixels 3. Processing Color Images with Classes 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. Processing Video Sequences Index

Accessing pixel values


In order to access each individual element of a matrix, you just need to specify its row and column numbers. The corresponding element, which can be a single numerical value or a vector of values in the case of a multi-channel image, will be returned.

Getting ready

To illustrate the direct access to pixel values, we will create a simple function that adds salt-and-pepper noise to an image. As the name suggests, salt-and-pepper noise is a particular type of noise in which some randomly selected pixels are replaced by a white or a black pixel. This type of noise can occur in faulty communications when the value of some pixels is lost during the transmission. In our case, we will simply randomly select a few pixels and assign them a white color.

How to do it...

We create a function that receives an input image. This is the image that will be modified by our function. The second parameter is the number of pixels on which we want to overwrite white values:

void salt(cv::Mat...
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}