Main Page   Class Hierarchy   Alphabetical List   Compound List   Compound Members  

prapi::EqualAreaQuantizer Class Reference

#include <Quantizer.h>

Inheritance diagram for prapi::EqualAreaQuantizer:

prapi::Quantizer List of all members.

Detailed Description

EqualAreaQuantizer derives the quantization from a distribution.

The distribution is split into pieces whose areas are as close to equal as possible. This ensures maximum resolution where feature density is highest.


Public Methods

 EqualAreaQuantizer (int levels=1)
 Create a EqualAreaQuantizer with the given number of quantization levels.

template<class T> void extractFrom (const List< T > &lst)
 Extract the quantization from a sorted list of values.

template<class T> void extractFrom (const LinkedList< T > *lst)
 Extract the quantization from a sorted linked list of values.

int getBinIndex (double value) throw (QuantizationException&)
 Get the bin index for the given value, i.e.

void setLevels (int l)
 Set the number of quantization levels.

List< double > getCutvalues () const
 Get the list of cut values used by this quantizer.

const List< double > & cutvalues () const
 Get the list of cut values used by this quantizer.

List< double > & cutvalues ()
 Get the list of cut values used by this quantizer.


Static Public Methods

template<class T> void createList (const Matrix< T > &mat, List< T > &lst, int n=0)
 Create a list of values from a matrix.

template<class T> void createList (const Matrix< T > &mat, SortedLinkedList< T > *&lst, int n=0)
 Create a linked list of values from a matrix.


Friends

std::ostream & operator<< (std::ostream &sout, const EqualAreaQuantizer &quantizer)
 Write to a stream.

std::istream & operator>> (std::istream &sin, EqualAreaQuantizer &quantizer)
 Read from a stream.


Member Function Documentation

template<class T>
void prapi::EqualAreaQuantizer::createList const Matrix< T > &    mat,
SortedLinkedList< T > *&    lst,
int    n = 0
[static]
 

Create a linked list of values from a matrix.

The list will contain the matrix' items in ascending order, and the result is suitable for an extractFrom(SortedLinkedList*) call.

Example:

 Matrix<double> mat(...);
 SortedLinkedList<double>* lst = NULL;
 EqualAreaQuantizer::createList(img,lst);
 EqualAreaQuantizer q(8);
 q.extractFrom(lst);
 
Parameters:
mat  any matrix
lst  the list to which values are to be added
n  the number of samples to take from the matrix. 0 means all. If n is less than the size of the image, every (size/n)th sample is selected.
Deprecated:
use createList(const Matrix<T>& mat, List<T>& lst, int n=0) instead

template<class T>
void prapi::EqualAreaQuantizer::createList const Matrix< T > &    mat,
List< T > &    lst,
int    n = 0
[static]
 

Create a list of values from a matrix.

The list will contain the matrix' items in scanning order. If a sorted list is used, the result is suitable for an extractFrom(List&) call.

Example:

 Matrix<double> mat(...);
 SortedDoubleList lst;
 EqualAreaQuantizer::createList(img,lst);
 EqualAreaQuantizer q(8);
 q.extractFrom(lst);
 

Note that using a SortedList for a large number of entries is extremely inefficient as each insertion into the list may involve massive memory transfers. A better solution is to use an ordinary list and sort it afterwards or to use the createList(Matrix&,SortedLinkedList*&) method.

Parameters:
mat  any matrix
lst  the list to which values are to be added
n  the number of samples to take from the matrix. 0 means all. If n is less than the size of the image, every (size/n)th sample is selected.

template<class T>
void prapi::EqualAreaQuantizer::extractFrom const LinkedList< T > *    lst
 

Extract the quantization from a sorted linked list of values.

This method does not assume any prior quantization. That is, the given list is just an ordered set of values.

Parameters:
lst  the values in ascending order
Deprecated:
use extractFrom(const List<T>&) instead

template<class T>
void prapi::EqualAreaQuantizer::extractFrom const List< T > &    lst
 

Extract the quantization from a sorted list of values.

This method does not assume any prior quantization. That is, the given list is just an ordered set of values.

Parameters:
lst  the values in ascending order

int prapi::EqualAreaQuantizer::getBinIndex double    value throw (QuantizationException&) [virtual]
 

Get the bin index for the given value, i.e.

quantize the value.

Returns:
the quantized value

Implements prapi::Quantizer.

void prapi::EqualAreaQuantizer::setLevels int    l [virtual]
 

Set the number of quantization levels.

The output values produced by getBinIndex will range from 0 to l-1.

Reimplemented from prapi::Quantizer.


The documentation for this class was generated from the following files:
Documentation generated on 11.09.2003 with Doxygen.
The documentation is copyrighted material.
Copyright © Topi Mäenpää 2003. All rights reserved.