oln::utils::histogram< T, CPT, V2P, Exact > Class Template Reference

#include <histogram.hh>

Inheritance diagram for oln::utils::histogram< T, CPT, V2P, Exact >:

Inheritance graph
[legend]
Collaboration diagram for oln::utils::histogram< T, CPT, V2P, Exact >:

Collaboration graph
[legend]
List of all members.

Public Types

enum  { dim = hist_traits<exact_type>::dim }
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

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_typeat (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_typeimage () const
 Return the image of occurrence.

Protected Attributes

const value_to_point_type v2p_
img_type img_

Detailed Description

template<typename T, typename CPT, class V2P, class Exact>
class oln::utils::histogram< T, CPT, V2P, Exact >

Histogram.

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).

Todo:
FIXME: An image is inside the histogram. This is incorrect because it is not exactly an image (no border needed).
Parameters:
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.
See also:
oln::abstract::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.


Constructor & Destructor Documentation

template<typename T, typename CPT, class V2P, class Exact>
oln::utils::histogram< T, CPT, V2P, Exact >::histogram ( const value_to_point_type c2p = value_to_point_type()  )  [inline]

Empty histogram.

Note:
The function init(image) should be used after this constructor.

Definition at line 233 of file histogram.hh.

00233                                                                         :
00234         v2p_(c2p), img_(internal::img_max_size<value_type>()())
00235       {
00236         this->clear();
00237       }


The documentation for this class was generated from the following file:
Generated on Tue Feb 20 20:29:56 2007 for Olena by  doxygen 1.5.1