#include <histogram.hh>
Inheritance diagram for oln::utils::histogram< T, CPT, V2P, Exact >:
Public Types | |
typedef mlc::exact_vt< histogram< T, CPT, V2P, Exact >, Exact >::ret | exact_type |
typedef hist_traits< exact_type >::value_type | value_type |
typedef hist_traits< exact_type >::cpt_type | cpt_type |
typedef hist_traits< exact_type >::value_to_point_type | value_to_point_type |
typedef hist_traits< exact_type >::point_type | point_type |
typedef hist_traits< exact_type >::img_type | img_type |
enum | { dim = hist_traits<exact_type>::dim } |
Public Member Functions | |
histogram (const value_to_point_type &c2p=value_to_point_type()) | |
Empty histogram. | |
template<class I> | histogram (const oln::abstract::image< I > &input, const value_to_point_type &v2p=value_to_point_type()) |
This compute the histogram of an image. | |
void | clear_impl () |
clear() should be called. | |
const cpt_type | at (const T &v) const |
operator[] should be called. | |
cpt_type & | at (const value_type &v) |
operator[] should be called. | |
template<class I> void | init_impl (const oln::abstract::image< I > &img) |
impl() should be called. | |
const img_type & | image () const |
Return the image of occurrence. | |
Protected Attributes | |
const value_to_point_type | v2p_ |
img_type | img_ |
This histogram uses an image of unsigned to store the value. For example the histogram of an image<int_u8> will store the number of occurrences in an image1d; an image<rgb_8> will store the number of occurrences an image3d (because rgb_8 has 3 components).
T | Type of the image. |
CPT | Type used to count the occurrences (unsigned). |
V2P | Conversion class to convert a value T to a point. |
Exact | Exact type of the histogram. |
#include <oln/basics2d.hh> #include <oln/utils/histogram.hh> #include <ntg/all.hh> #include <iostream> int main() { oln::image2d<ntg::rgb_8> in = oln::io::load(IMG_IN "lena.ppm"); oln::utils::histogram<ntg::rgb_8> h(in); ntg::rgb_8 pink(215, 129, 113); // h[pink] = 14 std::cout << "Number of occurrences of the color (213, 129, 135): " << h[pink] << std::endl; }
Definition at line 214 of file histogram.hh.
|
Empty histogram.
Definition at line 233 of file histogram.hh.
00233 : 00234 v2p_(c2p), img_(internal::img_max_size<value_type>()()) 00235 { 00236 clear(); 00237 } |