Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Learning OpenCV 3 Application Development

You're reading from  Learning OpenCV 3 Application Development

Product type Book
Published in Dec 2016
Publisher Packt
ISBN-13 9781784391454
Pages 310 pages
Edition 1st Edition
Languages
Author (1):
Samyak Datta Samyak Datta
Profile icon Samyak Datta

Table of Contents (16) Chapters

Learning OpenCV 3 Application Development
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Laying the Foundation Image Filtering Image Thresholding Image Histograms Image Derivatives and Edge Detection Face Detection Using OpenCV Affine Transformations and Face Alignment Feature Descriptors in OpenCV Machine Learning with OpenCV Command-line Arguments in C++

A complete implementation of LBP


In the section on LBP, we have already developed the code for computing the LBP code for each pixel, given the input image, and have also seen some basic operations to detect uniform pattern bit vectors. We are now going to focus specifically on building a spatially enhanced histogram.

The following function constructs the uniform pattern histogram of a sub-image given to it as input. Instead of completely ignoring the non-uniform patterns from our analysis, we instead group them together into a single bin towards the end:

Mat uniformPatternHistogram(const Mat& src, int numPatterns) { 
    Mat hist; 
 
    hist = Mat::zeros(1, (numPatterns + 1), CV_32SC1); 
    for(int i = 0; i < numPatterns; ++i) { 
        if(countTransitions(convertToBinary(i)) > 2) 
            hist.at<int>(0, i) = -1; 
    } 
 
    for(int i = 0; i < src.rows; i++) { 
        for(int j = 0; j < src.cols; j++) { 
...
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}