LBP Library - A Collection of LBP algorithms for background subtraction in videos.
Switch branches/tags
Nothing to show
Clone or download
Latest commit c5ce21c Sep 27, 2018

LBP Library

Last Page Update: 26/09/2018

Latest Library Version: 1.0.1 (see Release Notes for more info).

The LBP Library is a collection of eleven Local Binary Patterns (LBP) algorithms developed for background subtraction problem. The algorithms were implemented in C++ based on OpenCV. A CMake file is provided and the library is complatible with Windows, Linux and Mac OS X. The library was tested successfully with OpenCV 2.4.x and OpenCV 3.4.x.

List of the algorithms available in the LBP Library


If you use this library for your publications, please cite it as:

author    = {Silva, Caroline and Bouwmans, Thierry and Frelicot, Carl},
title     = {An eXtended Center-Symmetric Local Binary Pattern for Background Modeling and Subtraction in Videos},
booktitle = {10th International Joint Conference on Computer Vision, Imaging and Computer Graphics Theory and Applications (VISAPP)},
address   = {Berlin, Germany},
year      = {2015},
url       = {}

List of collaborators

Andrews Sobral and Cristina Lazar.

Example code

#include <iostream>
#include <opencv2/opencv.hpp>

#include "lbplibrary.hpp"
using namespace lbplibrary;

int main(int argc, char **argv)
  	cv::VideoCapture cap(0);
	if (!cap.isOpened())

	LBP *lbp;
	lbp = new OLBP;
	//lbp = new ELBP;
	//lbp = new VARLBP;
	//lbp = new CSLBP;
	//lbp = new CSLDP;
	//lbp = new XCSLBP;
	//lbp = new SILTP;
	//lbp = new CSSILTP;
	//lbp = new SCSLBP;
	//lbp = new BGLBP;

	cv::Mat frame, img_lbp;
	while (1)
		cap >> frame;
		cv::resize(frame, frame, cv::Size(320, 240));

		imshow("capture", frame);

		cv::cvtColor(frame, frame, CV_BGR2GRAY);
		//cv::GaussianBlur(frame, frame, cv::Size(7, 7), 5, 3, cv::BORDER_CONSTANT);

		imshow("gray", frame);
		show_histogram("gray_hist", frame);

		lbp->run(frame, img_lbp);
		cv::normalize(img_lbp, img_lbp, 0, 255, cv::NORM_MINMAX, CV_8UC1);

		cv::imshow("lbp", img_lbp);
		show_histogram("lbp_hist", img_lbp);

		if (cv::waitKey(10) >= 0)

	delete lbp;

Release Notes:

  • Version 1.0.1: Code refactoring, removed unused variables, added OpenCV 3.x support, fixed some issues and updated cmakefile.

  • Version 1.0.0: First stable version. Added 11 LBP algorithms.