[ VIGRA Homepage | Function Index | Class Index | Namespaces | File List | Main Page ]

FindAverage< VALUETYPE > Class Template Reference

Find the average pixel value in an image or ROI. More...

#include <vigra/inspectimage.hxx>

Public Types

typedef VALUETYPE argument_type
 
typedef VALUETYPE first_argument_type
 
typedef NumericTraits< VALUETYPE >::RealPromote result_type
 
typedef double second_argument_type
 
typedef NumericTraits< VALUETYPE >::RealPromote value_type
 

Public Member Functions

result_type average () const
 
double count () const
 
 FindAverage ()
 
result_type operator() () const
 
void operator() (argument_type const &v)
 
void operator() (FindAverage const &v)
 
void operator() (first_argument_type const &v, second_argument_type weight)
 
void reset ()
 

Detailed Description

template<class VALUETYPE>
class vigra::FindAverage< VALUETYPE >

Find the average pixel value in an image or ROI.

In addition the size of the ROI is calculated. This Functor can also be used in conjunction with ArrayOfRegionStatistics to find the average of all regions in a labeled image.

Traits defined:

FunctorTraits::isUnaryAnalyser and FunctorTraits::isInitializer are true (VigraTrueType)

Usage:

#include <vigra/inspectimage.hxx>
Namespace: vigra

vigra::inspectImage(srcImageRange(img), average);
cout << "Average: " << average();
Find the average pixel value in an image or ROI.
Definition inspectimage.hxx:1249
result_type average() const
Definition inspectimage.hxx:1322
void inspectImage(...)
Apply read-only functor to every pixel in the image.
BasicImage< UInt8 > BImage
Definition stdimage.hxx:62

Required Interface:

VALUETYPE v1, v2(v1);
double d;
v1 += v2;
v1 / d;

Member Typedef Documentation

◆ argument_type

template<class VALUETYPE>
typedef VALUETYPE argument_type

the functor's argument type

◆ first_argument_type

template<class VALUETYPE>
typedef VALUETYPE first_argument_type

the functor's first argument type (for calls with a weight)

◆ second_argument_type

template<class VALUETYPE>
typedef double second_argument_type

the functor's second argument type (for calls with a weight)

◆ result_type

template<class VALUETYPE>
typedef NumericTraits<VALUETYPE>::RealPromote result_type

the functor's result type

◆ value_type

template<class VALUETYPE>
typedef NumericTraits<VALUETYPE>::RealPromote value_type

Constructor & Destructor Documentation

◆ FindAverage()

template<class VALUETYPE>
FindAverage ( )

init average

Member Function Documentation

◆ reset()

template<class VALUETYPE>
void reset ( )

(re-)init average

◆ operator()() [1/4]

template<class VALUETYPE>
void operator() ( argument_type const & v)

update average

◆ operator()() [2/4]

template<class VALUETYPE>
void operator() ( first_argument_type const & v,
second_argument_type weight )

update average, using weighted input. stats(value, 1.0) is equivalent to the unweighted call stats(value), and stats(value, 2.0) is equivalent to two unweighted calls.

◆ operator()() [3/4]

template<class VALUETYPE>
void operator() ( FindAverage< VALUETYPE > const & v)

merge two statistics

◆ count()

template<class VALUETYPE>
double count ( ) const

return number of values (sum of weights) seen so far

◆ average()

template<class VALUETYPE>
result_type average ( ) const

return current average

◆ operator()() [4/4]

template<class VALUETYPE>
result_type operator() ( ) const

return current average


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

© Ullrich Köthe (ullrich.koethe@iwr.uni-heidelberg.de)
Heidelberg Collaboratory for Image Processing, University of Heidelberg, Germany

html generated using doxygen and Python
vigra 1.12.2 (Mon Apr 14 2025)