1.2K views

Uploaded by pi194043

This article describes the Uniform Local Binary Pattern and details about computation of Spatial Histogram Computation

save

- VBSchedule v2
- Assignment 1
- Local Binary Pattern
- Modified Canny Edge Detection
- polynomial approximation of a 2D signal
- Swiss Empheris
- PDF Joiner
- Integral Image for Computation of Mean And Variance
- Consolidated Informatica Questions
- Control Limited Adaptive Histogram Equalization for Image Enhancement
- Synthe Midi Pic
- CZ1102Computing & Problem Solving Lecture 2
- Datetime Calculations
- July2007 Formulas
- Fpc v4.0 Usage Notes
- Computer Programming and Data Structures
- Python 3 Cheat Sheet
- Pointer Program
- Using VLOOKUP in Excel.docx
- Database Design
- (ebook) Tuning Of Fuzzy Pid Controllers.pdf
- SDK_VB6_0__HTMarch_dll-EN.pdf
- Vector Review
- Computer Paper
- Microsoft_Excel_Level_2_2007.pdf
- class4
- Microsoft Office Excel 2007
- Important Valeo Qs
- All Progams From Balgurusamy
- AgainstAllOdds_FacultyGuide_Set1.pdf
- Polynomial Approximation of 2D image patch -Part 2
- Compiling Native C/C++ library for Android
- Multi Class Logistic Regression Training and Testing
- Gaussian Multivariate Distribution -Part 1
- ARM Neon Optimization for image interleaving and deinterleaving
- A linear channel filter
- Adaptive Skin Color Detector
- OpenVision Library Gaussian Mixture Model Implementation
- Fast 2D Separable Symmetric/Anti-Symmmetric Convolution
- Continuous Emission Hidden Markov Model for sequence classification
- Dense optical flow expansion based on polynomial basis approximation
- Implementation of discrete hidden markov model for sequence classification in C++ using Eigen
- Markov chain implementation in C++ using Eigen
- C++ Inheritance
- Mean Shift Algorithm
- Polynomial Approximation of 1D signal
- C++ Const,Volatile Type Qualifiers
- Random Ferns for Patch Description
- Integral Image for Computation of Mean And Variance
- C++ Class Members and friends
- Embedded Systems Programming with ARM on Linux - Blinking LED
- C++ virtual functions and abstract class
- C++ static members and function
- Mean Shift Tracking
- Tan and Triggs Illumination normalization
- Normalized convolution for image interpolation
- 02 - What is Prescriptive Analytics
- Viva Presentation Final 08.06.2012
- Akeb2015 - A Three-Stage Heuristic for the Capacitated
- info 563
- Project Scheduling -- Probabilistic PERT
- Project 1
- Group Technology
- Barrier Optimization Algorithm Applied to Calculation of Optimal Loading of Dissimilar Cables in One Trench
- Stochastic Process
- Fourier Transform
- Motion Blur Detection
- Papadakis-PredictingAirfarePrices.pdf
- Patrick Tb Ch15
- Predicting Sentences Using N-Gram Language Models
- Matrix Chain Multiplication
- A Robust Design of a Static VAR or Controller for Power System Stability
- Nature482_02_Turing Centenary: The Dawn of Computing
- 06624583.pdf
- Notes for Equilibrium and Entropy
- ELEMENTARY DIFFERENTIAL EQUATIONS AND BOUNDARY VALUE PROBLEMS.pdf
- Fuzzy logic
- Introduction to Intelligent Systems
- Fifth Order Improved Runge-Kutta Method
- 1. MEC522_Chapter 1
- The Regulator and Its Functions
- MTH 221 Week 1 5 All Assignments and Discussion Questions - Page 2
- Chapter11
- Survey Paper on Designing of FIR Filter using Genetic Algorithm
- Zaki2000(ArticuloBD)
- APProximation Problem

You are on page 1of 8

Pi19404

January 23, 2014

Contents

Contents

Uniform LBP Features and Spatial Histogram Computation

0.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 0.2 Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

3 8 8

2|8

0.1 Introduction

In the earlier article we had seen that we had computed a LBP image.Each pixel in this image still can take 28 possible values. The idea of uniform LBP is to perform lossy encoding so that we eliminate some irrelevant data and retain useful information which takes on 58 possible values. In this article we will look at Uniform LBP and computation of Spatial Histogram of LBP which can be used as a feature for image description.

Uniform LBP features are considered as one which have only 2 contigious regions corresponding to 0s and 1s,while non uniform LBP have more than 1 contigious regions corresponding to 0s and 1s. This we need a mapping from which assign each on 28 possible codes to one of 58 encoded uniform LBP values. All the non uniform codes are assigned to a single values. The uniform LBPs can be viewed as corners,line,ramp gradient The non uniform LBPs are assumed to be irrelevant and can be ignored. A uniform binary pattern can be identified by performing a bit wise traversal and checking if number of bit transitions are atmost 2 . This is done by first circular right/left shifting the given code and performing XOR operation with the original code. Since we need to only consider 8 bit numbers ,we need perform circular shift and masking MSB for integers.

int rightshift(int num, int shift) { //right shift the number to right

3|8

//left shift numbers and mask the MSB for 8 bit number return (num >> shift) | ((num << (8 - shift)&0xFF));

Now number of bit operations is simply the number of set bits in the result The code for this can be as follows

int countSetBits(int code) { int count=0; while(code!=0) { if(code&&0x01) count++; code=code>>1; } return count; } bool checkUniform(int code) { int b = rightshift(code,1); int c = code ^ b; int count=countSetBits(c); if (count <=2) return true; else return false; }

the method to count bits is naive way and since we are using 8 bit words,it will take 8 iterations of the for loop. Brian Kernighans method performs this by going through as many iterations as set bits

int countSetBits(int code) { int count=0; int v=code; for(count=0;v;count++) { v&=v-1; //clears the LSB } return count; }

4|8

The result can be precomputed for possible input code to determine if a LBP is a uniform code or not. The next task is to map the LBP codes to one of 58 uniform codes. The encoding will be done along the rows as per the below figure

Since we known the possible input codes before hand,we can prepare a lookup table before hand to check if a uniform code or not Now if it is a uniform code we need to map it to one of possible 58 codes.

5|8

To do this we move from all numbers from 0 28 ,check if they are uniform and assign them to a one of 58 possible code. However we can see than

//3x3 neighborhood will have 8 neighborhood pixels //all non uniform codes are assigned to 59 void initUniform() { lookup.resize(255); int index=0; for(int i=0;i<=255;i++) { bool status=checkUniform(i); if(status==true) { lookup[i]=index; index++; } else { lookup[i]=59; } } }

Thus we modify the existing lbp image code to return only uniform lbp coded as destination lbp image by performing a simple lookup operations. Now next task is to compute a spatial histogram,the histogram may be computed over the entire image or dividing the image into grids

ocv::Histogram hist; //class for computing histogram vector<float> spatialHistogram(Mat lbpImage,Size grid) { //feature vector vector<float> histogram; histogram.resize(grid.width*grid.height*59); int width=lbpImage.cols/grid.width; int height=lbpImage.rows/grid.height; int cnt=0; //#pragma omp parallel for

6|8

for(int i=0;i<grid.height;i++) { for(int j=0;j<grid.width;j++) { Mat cell=lbpImage(Rect(j*width,i*height,width,height)); Mat cell_hist=computeHistogram(cell); Mat tmp_feature; //reshape the feature vector into 1 row cell_hist.reshape(1,1).convertTo(tmp_feature,CV_32FC1); float * ptr=tmp_feature.ptr<float>(0); for(int k=0;k<tmp_feature.cols;k++) { //if no LBP feature is found assing it a small value if(ptr[k]==0) ptr[k]=1/58; //update the histogram vector histogram[cnt*59+k]=ptr[k]; } cnt++; } } } return histogram;

The LBP spatial histogram can be used as a texture descriptor. However the LBP image is a gradient image in some sense,it encode information about different types of gradiants The LBP pattern can be used to identify isolated corners or flat region ( all 0 or 1) The LBP pattern can be used to identify corner a continuous run of 0 or 1 of length (5-8 and its rotated version) The LBP pattern can be used to identify a edge a continous run of 0 or 1(length 4 and rotated version ) The LBP pattern can be used to identify horizontal or vertical edge ( vertical/horizontal run of 0 and 1 ) The LBP pattern can be used to identiy a line end (1000000 and its rotated version) The LBP pattern with 2 continous 12 can be considered as a horizonal or vertical line

7|8

0.2 Code

The code for the same can be found at git rep https://github. com/pi19404/OpenVision/ in ImgFeatures/lbpfeatures.cpp and ImgFeatures/lbpfeatures.hpp files.

8|8

- VBSchedule v2Uploaded byCire Ihcakub
- Assignment 1Uploaded byaliazamrana
- Local Binary PatternUploaded bypi194043
- Modified Canny Edge DetectionUploaded bypi194043
- polynomial approximation of a 2D signalUploaded bypi194043
- Swiss EmpherisUploaded byGauriGan
- PDF JoinerUploaded byrazvan
- Integral Image for Computation of Mean And VarianceUploaded bypi194043
- Consolidated Informatica QuestionsUploaded bysumit04_28
- Control Limited Adaptive Histogram Equalization for Image EnhancementUploaded bypi194043
- Synthe Midi PicUploaded byJorge Champre
- CZ1102Computing & Problem Solving Lecture 2Uploaded byCharmaine Chu
- Datetime CalculationsUploaded bydodoman666
- July2007 FormulasUploaded bymirmoinul
- Fpc v4.0 Usage NotesUploaded byn1ghtwalk3rr
- Computer Programming and Data StructuresUploaded byBhanu K Prakash
- Python 3 Cheat SheetUploaded byLaurent Pointal
- Pointer ProgramUploaded byMukesh Kumar
- Using VLOOKUP in Excel.docxUploaded byNicholas Njela
- Database DesignUploaded bySohil Shah
- (ebook) Tuning Of Fuzzy Pid Controllers.pdfUploaded byJessica Vélez
- SDK_VB6_0__HTMarch_dll-EN.pdfUploaded bypaulo artur
- Vector ReviewUploaded byOcto1
- Computer PaperUploaded byRahul Gupta
- Microsoft_Excel_Level_2_2007.pdfUploaded bydfal13
- class4Uploaded byapi-3774180
- Microsoft Office Excel 2007Uploaded byXtian Josef Oalin Osio
- Important Valeo QsUploaded byMarwan Ahmed
- All Progams From BalgurusamyUploaded byurvipatil
- AgainstAllOdds_FacultyGuide_Set1.pdfUploaded byhjbortol

- Polynomial Approximation of 2D image patch -Part 2Uploaded bypi194043
- Compiling Native C/C++ library for AndroidUploaded bypi194043
- Multi Class Logistic Regression Training and TestingUploaded bypi194043
- Gaussian Multivariate Distribution -Part 1Uploaded bypi194043
- ARM Neon Optimization for image interleaving and deinterleavingUploaded bypi194043
- A linear channel filterUploaded bypi194043
- Adaptive Skin Color DetectorUploaded bypi194043
- OpenVision Library Gaussian Mixture Model ImplementationUploaded bypi194043
- Fast 2D Separable Symmetric/Anti-Symmmetric ConvolutionUploaded bypi194043
- Continuous Emission Hidden Markov Model for sequence classificationUploaded bypi194043
- Dense optical flow expansion based on polynomial basis approximationUploaded bypi194043
- Implementation of discrete hidden markov model for sequence classification in C++ using EigenUploaded bypi194043
- Markov chain implementation in C++ using EigenUploaded bypi194043
- C++ InheritanceUploaded bypi194043
- Mean Shift AlgorithmUploaded bypi194043
- Polynomial Approximation of 1D signalUploaded bypi194043
- C++ Const,Volatile Type QualifiersUploaded bypi194043
- Random Ferns for Patch DescriptionUploaded bypi194043
- Integral Image for Computation of Mean And VarianceUploaded bypi194043
- C++ Class Members and friendsUploaded bypi194043
- Embedded Systems Programming with ARM on Linux - Blinking LEDUploaded bypi194043
- C++ virtual functions and abstract classUploaded bypi194043
- C++ static members and functionUploaded bypi194043
- Mean Shift TrackingUploaded bypi194043
- Tan and Triggs Illumination normalizationUploaded bypi194043
- Normalized convolution for image interpolationUploaded bypi194043

- 02 - What is Prescriptive AnalyticsUploaded byHéctor Miguel Vera Tovar
- Viva Presentation Final 08.06.2012Uploaded bykuttyrk
- Akeb2015 - A Three-Stage Heuristic for the CapacitatedUploaded byJuan Sebastián Poveda Gulfo
- info 563Uploaded byLilyMSU
- Project Scheduling -- Probabilistic PERTUploaded bySanjana Ganesh
- Project 1Uploaded byVivekKaushik
- Group TechnologyUploaded byVenkateshAthava
- Barrier Optimization Algorithm Applied to Calculation of Optimal Loading of Dissimilar Cables in One TrenchUploaded byaryo_el06
- Stochastic ProcessUploaded byarafatasghar
- Fourier TransformUploaded byraushankumar201
- Motion Blur DetectionUploaded byistiaque_hmd
- Papadakis-PredictingAirfarePrices.pdfUploaded byLoy Alvares
- Patrick Tb Ch15Uploaded byShams Shams
- Predicting Sentences Using N-Gram Language ModelsUploaded byMao Yu
- Matrix Chain MultiplicationUploaded byamukhopadhyay
- A Robust Design of a Static VAR or Controller for Power System StabilityUploaded byGowri Ganesh
- Nature482_02_Turing Centenary: The Dawn of ComputingUploaded byzukun
- 06624583.pdfUploaded byAerozen Flores
- Notes for Equilibrium and EntropyUploaded byHera Cambal
- ELEMENTARY DIFFERENTIAL EQUATIONS AND BOUNDARY VALUE PROBLEMS.pdfUploaded bydarklordsauron
- Fuzzy logicUploaded byKavin Kannan
- Introduction to Intelligent SystemsUploaded byOana Munteanu
- Fifth Order Improved Runge-Kutta MethodUploaded byarungovindneelan
- 1. MEC522_Chapter 1Uploaded byFaez Feakry
- The Regulator and Its FunctionsUploaded bysolbahia
- MTH 221 Week 1 5 All Assignments and Discussion Questions - Page 2Uploaded byRoderick Thomason
- Chapter11Uploaded byprasanth_223
- Survey Paper on Designing of FIR Filter using Genetic AlgorithmUploaded byInternational Journal for Scientific Research and Development - IJSRD
- Zaki2000(ArticuloBD)Uploaded byJuan Perez
- APProximation ProblemUploaded byShreyas Satardekar