View project onGitHub

opencvblobslib logo

Wiki with infos, benchmark and changelogs

This Project aims to upgrade the old cvBlobsLib library with new features like the use of Mat objects instead of IplImage and multi core support.

For who doesn't know cvBlobsLib yet, here is a brief list of features:

  • Binary image 8-connected component labelling/blob extraction.
  • Blob filtering (based on size or other user-defined features).
  • Blob properties computation, e.g.:
    • Mean and standard deviation of the pixel values in the covered region.
    • Area and perimeter.
    • Bounding box.
    • Containing ellipse.
    • Moments computation.
    • Color-fill of the blob region.

OpenCVBlobsLib added Features:

  • Multi core support for the extraction stage.
  • OpenCV 2.0 compliant interface.
  • Blob joining, allowing for distinct regions to be grouped as one.
  • Generic bug fixing.
  • Linux compatibility.

Download link:

Please download the snapshot from the links above!


  • 08/03/2014
    • Modified the area function, in order to choose between Green's formula and pixelwise calculation
    • Changed the repository structure in order to allow CMake building.
  • 26/02/2014
    • Added density function, which checks the area of the blob against the area of its convex hull, giving an idea of how much dense the blob is.
    • Fix for compilation on MAC OS.
    • Added overlappingPixels function, to count how many pixels 2 blobs share.
    • New enums to use the Filter function.
    • New wiki pages.
  • 08/02/2014
    • Modified function MeanStdDev in order to return Scalar objects instead of doubles. In this way RGB images can be handled.
    • Modified GetBoundingBox in order to return the actual width and height (before they were 1 pixel less). Now a 1 pixel blob has its width and height set to 1.
    • Added a new function GetBlobNearestTo, to obtain the blob nearest to a user-defined point.
  • 31/01/2014
    • Labelling algorithm: rare threading and infinite loops issues fix.
  • 16/01/2014
    • Version 1.0.3
    • Warning removal.
    • Unreferecenced variables or classes removal.
    • Fix at ExternPerimeter function, where it returned wrong values if called many times with different parameters (xBorder,yBorder and mask). Now the value is always recalculated, since the parameters can change from one call to the other.
    • Fix at CBlobGetExterior and CBlobGetExternPerimeter classes, where xBorder and yBorder had different default values from the default constructor. Now they are correctly always initialised to true.
  • 14/01/2013
    • Version 1.0.2
    • Fixed a bug with x64 systems (bad conversion from pointer to int)
  • 29/12/2013
    • Version 1.0.1.
    • Potential stack corruption issues fix.
    • Linux compilation issues fix.
    • Thanks to

Building notes:

The building system moved to using Cmake! See

To do list:

  • [x] Adapt all the functions to work with joined blobs
  • [x] Further enhance performance in multi-threading algorithm
  • [x] Create more comparison graphs
  • [ ] Add a function that counts how many pixels are in a certain range of colour in a blob
  • [x] Create a CMake script
  • [ ] Finish the example
  • [x] Start to write tutorials and the wiki

Stay tuned!

All the credits for the original code go to its Author (Ricard Borras).

Saverio Murgia and Luca Nardelli