PCL
pcl::Histogram Class Reference

Discrete image histogram function. More...

#include <Histogram.h>

+ Inheritance diagram for pcl::Histogram:

Public Types

using count_type = uint64
 
using histogram_type = UI64Vector
 

Public Member Functions

 Histogram (const Histogram &)=default
 
 Histogram (const histogram_type &data)
 
 Histogram (Histogram &&)=default
 
 Histogram (int resolution=0x10000L)
 
 ~Histogram () override
 
void Allocate ()
 
void Assign (const Histogram &x)
 
void Clear ()
 
void ClearRectangle ()
 
void ClearSelectedChannel ()
 
int ClipHigh (count_type n) const
 
int ClipLow (count_type n) const
 
count_type Count () const
 
count_type Count (int i) const
 
count_type Count (int i, int j) const
 
double Entropy () const
 
void GetData (count_type *where, int fromLevel=0, int toLevel=-1) const
 
void GetHistogramRange (int &i, int &j, double a, double b) const
 
void GetNormalizedRange (double &a, double &b, int i, int j) const
 
const histogram_typeHistogramData () const
 
int HistogramLevel (double x) const
 
bool IsEmpty () const
 
int LastLevel () const
 
double NormalizedClipHigh (count_type n) const
 
double NormalizedClipLow (count_type n) const
 
double NormalizedLevel (int i) const
 
double NormalizedPeakLevel () const
 
const DImageoperator<< (const DImage &)
 
const Imageoperator<< (const Image &)
 
const ImageVariantoperator<< (const ImageVariant &)
 
const UInt16Imageoperator<< (const UInt16Image &)
 
const UInt32Imageoperator<< (const UInt32Image &)
 
const UInt8Imageoperator<< (const UInt8Image &)
 
Histogramoperator= (const Histogram &)=default
 
Histogramoperator= (Histogram &&)=default
 
count_type operator[] (int i) const
 
count_type PeakCount () const
 
count_type PeakCount (int i, int j) const
 
int PeakLevel () const
 
void Resample (Histogram &h) const
 
int Resolution () const
 
void SelectChannel (int channel)
 
int SelectedChannel () const
 
const RectSelectedRectangle () const
 
void SelectRectangle (const Rect &r)
 
void SetHistogramData (const histogram_type &data)
 
void SetResolution (int resolution)
 
int UpdatePeakLevel ()
 
- Public Member Functions inherited from pcl::ParallelProcess
 ParallelProcess ()=default
 
 ParallelProcess (const ParallelProcess &)=default
 
virtual ~ParallelProcess ()
 
void DisableParallelProcessing (bool disable=true) noexcept
 
void EnableParallelProcessing (bool enable=true, int maxProcessors=0) noexcept
 
bool IsParallelProcessingEnabled () const noexcept
 
int MaxProcessors () const noexcept
 
ParallelProcessoperator= (const ParallelProcess &)=default
 
void SetMaxProcessors (int maxProcessors) noexcept
 
void Swap (ParallelProcess &process) noexcept
 

Detailed Description

TODO: Write a detailed description for Histogram.

Definition at line 75 of file Histogram.h.

Member Typedef Documentation

◆ count_type

Represents a histogram bin count, or the value of the discrete histogram function at a specific abscissa or range of abscissae.

Definition at line 83 of file Histogram.h.

◆ histogram_type

A vector of histogram bin counts, which is the type used internally to store the values of the discrete histogram function.

Definition at line 89 of file Histogram.h.

Constructor & Destructor Documentation

◆ Histogram() [1/4]

pcl::Histogram::Histogram ( int  resolution = 0x10000L)
inline

Constructs an empty Histogram object with the specified resolution.

The resolution of a histogram function is the number of discrete intervals (or bins) used to analyze image data. The minimum possible resolution is 2. In PCL, the default resolution is 2^16 = 65536 intervals (also known as a 16-bit histogram).

Definition at line 99 of file Histogram.h.

◆ Histogram() [2/4]

pcl::Histogram::Histogram ( const histogram_type data)
inline

Constructs a Histogram object by importing a copy of the specified data vector as its internal vector of histogram function values. Automatically sets the histogram resolution equal to the length of the data vector, and calculates the peak level of the newly constructed histogram.

If the specified data vector has less than two components, this constructor will yield an empty histogram with the default 16-bit resolution.

Definition at line 116 of file Histogram.h.

◆ Histogram() [3/4]

pcl::Histogram::Histogram ( const Histogram )
default

Copy constructor.

◆ Histogram() [4/4]

pcl::Histogram::Histogram ( Histogram &&  )
default

Move constructor.

◆ ~Histogram()

pcl::Histogram::~Histogram ( )
inlineoverride

Destroys a Histogram object.

Definition at line 134 of file Histogram.h.

Member Function Documentation

◆ Allocate()

void pcl::Histogram::Allocate ( )
inline

If this histogram object is empty, this member function allocates the internal vector of histogram function values. Newly allocated vectors are not initialized, so the histogram will contain unpredictable values after calling this function.

If the histogram is not empty, calling this function has no effect.

Definition at line 222 of file Histogram.h.

Referenced by Resample().

◆ Assign()

void pcl::Histogram::Assign ( const Histogram x)
inline

Assigns another Histogram object x to this object.

Definition at line 151 of file Histogram.h.

◆ Clear()

void pcl::Histogram::Clear ( )
inline

Deallocates the internal vector of histogram values, yielding an empty Histogram object.

Definition at line 160 of file Histogram.h.

Referenced by Resample().

◆ ClearRectangle()

void pcl::Histogram::ClearRectangle ( )
inline

Clears the rectangular selection in this Histogram object.

After calling this function, histograms will be calculated for the current rectangular selection of the target image.

Definition at line 602 of file Histogram.h.

◆ ClearSelectedChannel()

void pcl::Histogram::ClearSelectedChannel ( )
inline

Clears the channel index selection in this Histogram object.

After calling this function, histograms will be calculated for the current selected channel of the target image.

Definition at line 636 of file Histogram.h.

◆ ClipHigh()

int pcl::Histogram::ClipHigh ( count_type  n) const
inline

Returns the discrete histogram level where the sum of counts for its succeding levels is greater than or equal to the specified amount n.

This function is useful to compute an automatic histogram highlights clipping point. The returned index is the position of the highlights clipping point that clips (sets to white) the specified amount of image pixel samples

Definition at line 418 of file Histogram.h.

◆ ClipLow()

int pcl::Histogram::ClipLow ( count_type  n) const
inline

Returns the discrete histogram level where the sum of counts for its preceding levels is greater than or equal to the specified amount n.

This function is useful to compute an automatic histogram shadows clipping point. The returned index is the position of the shadows clipping point that clips (sets to black) the specified amount of image pixel samples

Definition at line 392 of file Histogram.h.

◆ Count() [1/3]

count_type pcl::Histogram::Count ( ) const
inline

Returns the total sum of the counts in all histogram intervals, or the sum of all discrete histogram function values. If this Histogram object is empty, this function returns zero.

Definition at line 312 of file Histogram.h.

◆ Count() [2/3]

count_type pcl::Histogram::Count ( int  i) const
inline

Returns the histogram count, or the value of the histogram function, at the specified discrete level i.

Definition at line 321 of file Histogram.h.

◆ Count() [3/3]

count_type pcl::Histogram::Count ( int  i,
int  j 
) const
inline

Returns the sum of counts in the specified interval of discrete histogram levels i, j.

Definition at line 341 of file Histogram.h.

References pcl::Range(), pcl::Sum(), and pcl::Swap().

◆ Entropy()

double pcl::Histogram::Entropy ( ) const
inline

Computes the discrete entropy of this histogram.

The returned value is normalized to the total weight of the histogram, that is, it is independent on the total number of counts stored in the histogram data vector.

Definition at line 527 of file Histogram.h.

◆ GetData()

void pcl::Histogram::GetData ( count_type where,
int  fromLevel = 0,
int  toLevel = -1 
) const
inline
Deprecated:
This member function has been deprecated. It is kept as part of PCL for compatibility with existing modules; do not use it in newly produced code.

Definition at line 471 of file Histogram.h.

References pcl::Range(), and pcl::Swap().

◆ GetHistogramRange()

void pcl::Histogram::GetHistogramRange ( int &  i,
int &  j,
double  a,
double  b 
) const
inline

Converts the specified normalized levels a, b in the [0,1] range to discrete histogram levels i, j, respectively.

Definition at line 287 of file Histogram.h.

◆ GetNormalizedRange()

void pcl::Histogram::GetNormalizedRange ( double &  a,
double &  b,
int  i,
int  j 
) const
inline

Converts the specified discrete histogram levels i, j to normalized levels a, b, respectively, in the [0,1] range.

Definition at line 299 of file Histogram.h.

◆ HistogramData()

const histogram_type& pcl::Histogram::HistogramData ( ) const
inline

Returns a reference to the immutable internal vector of histogram function values.

Definition at line 439 of file Histogram.h.

◆ HistogramLevel()

int pcl::Histogram::HistogramLevel ( double  x) const
inline

Returns the index of the discrete level in this Histogram object corresponding to the specified normalized level x in the [0,1] range.

Definition at line 267 of file Histogram.h.

References pcl::Range(), and pcl::RoundInt().

◆ IsEmpty()

bool pcl::Histogram::IsEmpty ( ) const
inline

Returns true iff this Histogram object is empty. An empty histogram has no computed histogram values.

Definition at line 170 of file Histogram.h.

◆ LastLevel()

int pcl::Histogram::LastLevel ( ) const
inline

Returns the highest valid discrete histogram level, or Resolution()-1.

Definition at line 191 of file Histogram.h.

◆ NormalizedClipHigh()

double pcl::Histogram::NormalizedClipHigh ( count_type  n) const
inline

Returns the normalized histogram level (in the [0,1] range) where the sum of counts for its succeding levels is greater than or equal to the specified amount n.

Definition at line 430 of file Histogram.h.

◆ NormalizedClipLow()

double pcl::Histogram::NormalizedClipLow ( count_type  n) const
inline

Returns the normalized histogram level (in the [0,1] range) where the sum of counts for its preceding levels is greater than or equal to the specified amount n.

Definition at line 404 of file Histogram.h.

◆ NormalizedLevel()

double pcl::Histogram::NormalizedLevel ( int  i) const
inline

Returns the normalized histogram level in the [0,1] range corresponding to the specified discrete level i in this Histogram object.

Definition at line 277 of file Histogram.h.

References pcl::Range().

◆ NormalizedPeakLevel()

double pcl::Histogram::NormalizedPeakLevel ( ) const
inline

Returns the histogram peak level as a floating point number normalized to the [0,1] range. See PeakLevel().

Definition at line 245 of file Histogram.h.

◆ operator<<() [1/6]

const DImage& pcl::Histogram::operator<< ( const DImage )

Computes the histogram function of a 64-bit floating point real image.

◆ operator<<() [2/6]

const Image& pcl::Histogram::operator<< ( const Image )

Computes the histogram function of a 32-bit floating point real image.

◆ operator<<() [3/6]

const ImageVariant& pcl::Histogram::operator<< ( const ImageVariant )

Computes the histogram function of the image transported by an ImageVariant object.

◆ operator<<() [4/6]

const UInt16Image& pcl::Histogram::operator<< ( const UInt16Image )

Computes the histogram function of a 16-bit unsigned integer image.

◆ operator<<() [5/6]

const UInt32Image& pcl::Histogram::operator<< ( const UInt32Image )

Computes the histogram function of a 32-bit unsigned integer image.

◆ operator<<() [6/6]

const UInt8Image& pcl::Histogram::operator<< ( const UInt8Image )

Computes the histogram function of an 8-bit unsigned integer image.

◆ operator=() [1/2]

Histogram& pcl::Histogram::operator= ( const Histogram )
default

Copy assignment operator. Returns a reference to this object.

◆ operator=() [2/2]

Histogram& pcl::Histogram::operator= ( Histogram &&  )
default

Move assignment operator. Returns a reference to this object.

◆ operator[]()

count_type pcl::Histogram::operator[] ( int  i) const
inline

Subscript operator. Equivalent to Count( int ).

Definition at line 332 of file Histogram.h.

References pcl::Count().

◆ PeakCount() [1/2]

count_type pcl::Histogram::PeakCount ( ) const
inline

Returns the histogram function value for the bin at the current peak level. Typically, the peak count is used to normalize the histogram to a prescribed range. For example, by dividing all histogram function values by the peak count the entire histogram will be normalized to the [0,1] range.

Definition at line 361 of file Histogram.h.

References pcl::Count().

◆ PeakCount() [2/2]

count_type pcl::Histogram::PeakCount ( int  i,
int  j 
) const
inline

Returns the peak count, or the maximum histogram function value, within the specified range [i,j] of discrete histogram intervals.

Definition at line 370 of file Histogram.h.

References pcl::MaxItem(), pcl::Range(), and pcl::Swap().

◆ PeakLevel()

int pcl::Histogram::PeakLevel ( ) const
inline

Returns the current peak level of the histogram. If this histogram is empty, the peak level is zero conventionally.

The peak level is simply the index (or integer abscissa) of the histogram bin with the largest count, or the position on the X axis of the maximum of the histogram function, in the discrete range [0,LastLevel()].

Definition at line 236 of file Histogram.h.

◆ Resample()

void pcl::Histogram::Resample ( Histogram h) const
inline

Remaps the histogram function to fit the resolution of a target histogram h.

If the target histogram has the same resolution as this object, this member function is equivalent to a plain assignment. If the resolutions differ, if this histogram is empty then the target histogram is deallocated and cleared, otherwise the target histogram is recomputed as a resampled version of this histogram.

This member function is useful to generate reduced versions of a histogram. It can also be used to generate bootstrap samples from an existing histogram function.

Definition at line 500 of file Histogram.h.

References Allocate(), pcl::GenericVector< T >::Begin(), Clear(), pcl::GenericVector< T >::End(), pcl::GenericVector< T >::Length(), pcl::MaxItem(), and pcl::RoundInt().

◆ Resolution()

int pcl::Histogram::Resolution ( ) const
inline

Returns the current resolution of this Histogram object.

The resolution of a histogram function is the number of discrete intervals (or bins) used to analyze image data. The minimum possible resolution is 2. In PCL, the default resolution is 2^16 = 65536 intervals (also known as a 16-bit histogram).

Definition at line 183 of file Histogram.h.

◆ SelectChannel()

void pcl::Histogram::SelectChannel ( int  channel)
inline

Selects a channel index for this Histogram object.

When a positive (>= 0) channel index is specified, it is used for calculation of histograms. If a negative channel index is specified, the current selected channel in the target image will be used.

Definition at line 625 of file Histogram.h.

◆ SelectedChannel()

int pcl::Histogram::SelectedChannel ( ) const
inline

Returns the current channel index selected in this Histogram object.

By default, the selected channel index is -1, meaning that the channel selected in the target image will be used.

Definition at line 613 of file Histogram.h.

◆ SelectedRectangle()

const Rect& pcl::Histogram::SelectedRectangle ( ) const
inline

Returns the current rectangular selection in this Histogram object.

By default, the rectangular selection is an empy rectangle, meaning that the rectangular selection in the target image will be used.

Definition at line 578 of file Histogram.h.

◆ SelectRectangle()

void pcl::Histogram::SelectRectangle ( const Rect r)
inline

Sets a new rectangular selection for this Histogram object.

When a non-empty rectangular selection is specified, it is used as the region of interest (ROI) for calculation of histograms. If an empty or invalid rectangle is specified, the current selection in the target image will be used.

Definition at line 591 of file Histogram.h.

◆ SetHistogramData()

void pcl::Histogram::SetHistogramData ( const histogram_type data)
inline

Causes this Histogram object to import a copy of the specified data vector as its internal vector of histogram function values. Automatically sets the histogram resolution equal to the length of the data vector, and recalculates the peak level of the new histogram.

If the specified data vector has less than two components, this member function will yield an empty histogram without changing the current histogram resolution.

Definition at line 454 of file Histogram.h.

References pcl::GenericVector< T >::Length().

◆ SetResolution()

void pcl::Histogram::SetResolution ( int  resolution)
inline

Sets the resolution of this Histogram object.

The resolution of a histogram function is the number of discrete intervals (or bins) used to analyze image data. The minimum possible resolution is 2. In PCL, the default resolution is 2^16 = 65536 intervals (also known as a 16-bit histogram).

After calling this member function, the histogram will be empty and the internal vector of histogram function values will be deallocated.

Definition at line 207 of file Histogram.h.

◆ UpdatePeakLevel()

int pcl::Histogram::UpdatePeakLevel ( )
inline

Recalculates the histogram peak level from current histogram function values. If the histogram is empty, the peak level is reset to zero conventionally.

Returns the newly calculated histogram peak level.

Definition at line 257 of file Histogram.h.

References pcl::MaxItem().


The documentation for this class was generated from the following file: