Boost GIL


Public Member Functions | Static Public Member Functions | List of all members
histogram< T > Class Template Reference

Default histogram class provided by boost::gil. More...

#include <histogram.hpp>

Inherits unordered_map< std::tuple< T... >, double, detail::hash_tuple< T... > >.

Public Member Functions

mapped_t & operator() (T... indices)
 Returns bin value corresponding to specified tuple.
 
template<typename OtherType >
bool equals (OtherType const &otherhist) const
 Checks if 2 histograms are equal. Ignores type, and checks if the keys (after type casting) match.
 
template<typename Tuple >
bool is_tuple_compatible (Tuple const &)
 Checks if the histogram class is compatible to be used with the specified tuple type.
 
template<std::size_t... Dimensions, typename Tuple >
key_t key_from_tuple (Tuple const &t) const
 Returns a key compatible to be used as the histogram key from the input tuple.
 
template<std::size_t... Dimensions, typename Pixel >
key_t key_from_pixel (Pixel const &p) const
 Returns a histogram compatible key from the input pixel which can be directly used.
 
key_t nearest_key (key_t const &k) const
 Return nearest smaller key to specified histogram key.
 
template<std::size_t... Dimensions, typename SrcView >
void fill (SrcView const &srcview, std::size_t bin_width=1, bool applymask=false, std::vector< std::vector< bool >> mask={}, key_t lower=key_t(), key_t upper=key_t(), bool setlimits=false)
 Fills the histogram with the input image view.
 
template<std::size_t... Dimensions, typename Tuple >
histogram sub_histogram (Tuple const &t1, Tuple const &t2)
 Can return a subset or a mask over the current histogram.
 
template<std::size_t... Dimensions>
histogram< boost::mp11::mp_at< bin_t, boost::mp11::mp_size_t< Dimensions > >... > sub_histogram ()
 Returns a sub-histogram over specified axes.
 
void normalize ()
 Normalize this histogram class.
 
double sum () const
 Return the sum count of all bins.
 
key_t min_key () const
 Return the minimum key in histogram.
 
key_t max_key () const
 Return the maximum key in histogram.
 
std::vector< key_t > sorted_keys () const
 Return sorted keys in a vector.
 

Static Public Member Functions

static constexpr std::size_t dimension ()
 Returns the number of dimensions(axes) the class supports.
 
static constexpr bool is_pixel_compatible ()
 Checks if the histogram class is compatible to be used with a GIL image type.
 

Detailed Description

template<typename... T>
class boost::gil::histogram< T >

Default histogram class provided by boost::gil.

The class inherits over the std::unordered_map provided by STL. A complete example/tutorial of how to use the class resides in the docs. Simple calling syntax for a 3D dimensional histogram :

histogram<int, int , int> h;
h(1, 1, 1) = 0;

This is just a starter to what all can be achieved with it, refer to the docs for the full demo.


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