Visual Servoing Platform  version 3.6.1 under development (2025-02-28)
vpColorHistogram Class Reference

#include <visp3/rbt/vpColorHistogram.h>

Classes

class  Builder
 

Public Member Functions

 vpColorHistogram ()
 
 vpColorHistogram (unsigned int N)
 
void setBinNumber (unsigned int N)
 
unsigned int getBinNumber () const
 
unsigned int getNumPixels () const
 
void build (const vpImage< vpRGBa > &image, const vpImage< bool > &mask)
 
void build (const std::vector< unsigned int > &counts)
 
void merge (const vpColorHistogram &other, float alpha)
 
void computeProbas (const vpImage< vpRGBa > &image, vpImage< float > &proba) const
 
void computeProbas (const vpImage< vpRGBa > &image, vpImage< float > &proba, const vpRect &bb) const
 
unsigned int colorToIndex (const vpRGBa &p) const
 
double probability (const vpRGBa &color) const
 
double kl (const vpColorHistogram &other) const
 
double jsd (const vpColorHistogram &other) const
 
double hellinger (const vpColorHistogram &other) const
 

Static Public Member Functions

static void computeSplitHistograms (const vpImage< vpRGBa > &image, const vpImage< bool > &mask, vpColorHistogram &inMask, vpColorHistogram &outsideMask)
 
static void computeSplitHistograms (const vpImage< vpRGBa > &image, const vpImage< bool > &mask, const vpRect &bbInside, vpColorHistogram &insideMask, vpColorHistogram &outsideMask)
 

Detailed Description

Definition at line 52 of file vpColorHistogram.h.

Constructor & Destructor Documentation

◆ vpColorHistogram() [1/2]

vpColorHistogram::vpColorHistogram ( )

Definition at line 54 of file vpColorHistogram.cpp.

◆ vpColorHistogram() [2/2]

vpColorHistogram::vpColorHistogram ( unsigned int  N)

Definition at line 57 of file vpColorHistogram.cpp.

References setBinNumber().

Member Function Documentation

◆ build() [1/2]

void vpColorHistogram::build ( const std::vector< unsigned int > &  counts)

Definition at line 93 of file vpColorHistogram.cpp.

References vpException::dimensionError.

◆ build() [2/2]

void vpColorHistogram::build ( const vpImage< vpRGBa > &  image,
const vpImage< bool > &  mask 
)

◆ colorToIndex()

unsigned int vpColorHistogram::colorToIndex ( const vpRGBa p) const
inline

Definition at line 95 of file vpColorHistogram.h.

References vpRGBa::B, vpRGBa::G, and vpRGBa::R.

Referenced by build(), computeProbas(), and computeSplitHistograms().

◆ computeProbas() [1/2]

void vpColorHistogram::computeProbas ( const vpImage< vpRGBa > &  image,
vpImage< float > &  proba 
) const

◆ computeProbas() [2/2]

void vpColorHistogram::computeProbas ( const vpImage< vpRGBa > &  image,
vpImage< float > &  proba,
const vpRect bb 
) const

◆ computeSplitHistograms() [1/2]

void vpColorHistogram::computeSplitHistograms ( const vpImage< vpRGBa > &  image,
const vpImage< bool > &  mask,
const vpRect bbInside,
vpColorHistogram insideMask,
vpColorHistogram outsideMask 
)
static

◆ computeSplitHistograms() [2/2]

void vpColorHistogram::computeSplitHistograms ( const vpImage< vpRGBa > &  image,
const vpImage< bool > &  mask,
vpColorHistogram inMask,
vpColorHistogram outsideMask 
)
static

◆ getBinNumber()

unsigned int vpColorHistogram::getBinNumber ( ) const
inline

Definition at line 81 of file vpColorHistogram.h.

Referenced by vpColorHistogram::Builder::build().

◆ getNumPixels()

unsigned int vpColorHistogram::getNumPixels ( ) const
inline

Definition at line 83 of file vpColorHistogram.h.

Referenced by vpColorHistogramMask::updateMask().

◆ hellinger()

double vpColorHistogram::hellinger ( const vpColorHistogram other) const

Definition at line 176 of file vpColorHistogram.cpp.

◆ jsd()

double vpColorHistogram::jsd ( const vpColorHistogram other) const

Definition at line 165 of file vpColorHistogram.cpp.

References kl().

◆ kl()

double vpColorHistogram::kl ( const vpColorHistogram other) const

Definition at line 151 of file vpColorHistogram.cpp.

References vpException::badValue.

Referenced by jsd().

◆ merge()

void vpColorHistogram::merge ( const vpColorHistogram other,
float  alpha 
)

Definition at line 108 of file vpColorHistogram.cpp.

References vpException::badValue.

Referenced by vpColorHistogramMask::updateMask().

◆ probability()

double vpColorHistogram::probability ( const vpRGBa color) const
inline

Definition at line 100 of file vpColorHistogram.h.

◆ setBinNumber()

void vpColorHistogram::setBinNumber ( unsigned int  N)

Change the number of bins per color component that the histogram has After calling this method, the histogram will be reset and the values will not be kept.

Parameters
Nthe number of bins per RGB component: the histogram will have N^3 bins in total. N should be a power of 2 between 1 and 128

Definition at line 62 of file vpColorHistogram.cpp.

References vpException::badValue.

Referenced by vpColorHistogram().