last update 20 Sep 2009 |
#include <cvrKernel2D.h>
Public Types | |
Internal types and classes | |
typedef lattice2D< T >::value_type | value_type |
typedef lattice2D< T >::size_type | size_type |
typedef lattice2D< T >::pointer | pointer |
typedef lattice2D< T > ::const_pointer | const_pointer |
typedef lattice2D< T >::reference | reference |
typedef lattice2D< T > ::const_reference | const_reference |
typedef lattice2D< T >::iterator | iterator |
typedef lattice2D< T > ::const_iterator | const_iterator |
Public Member Functions | |
kernel2D () | |
kernel2D (const int fromRow, const int fromCol, const int toRow, const int toCol) | |
kernel2D (const size_type &from, const size_type &to) | |
kernel2D (const iinterval &rows, const iinterval &columns) | |
kernel2D (const int fromRow, const int fromCol, const int toRow, const int toCol, const T &value) | |
kernel2D (const size_type &from, const size_type &to, const T &value) | |
kernel2D (const iinterval &rows, const iinterval &columns, const T &value) | |
kernel2D (const int fromRow, const int fromCol, const int toRow, const int toCol, const T data[]) | |
kernel2D (const size_type &from, const size_type &to, const T data[]) | |
kernel2D (const iinterval &rows, const iinterval &columns, const T data[]) | |
kernel2D (const int fromRow, const int fromCol, const int toRow, const int toCol, T data[], const eConstantReference constRef) | |
kernel2D (const size_type &from, const size_type &to, T data[], const eConstantReference constRef) | |
kernel2D (const iinterval &rows, const iinterval &columns, T data[], const eConstantReference constRef) | |
kernel2D (const genericLattice2D< T > &other) | |
kernel2D (const genericLattice2D< T > &other, const int fromRow, const int fromCol, const int toRow=container::MaxIndex, const int toCol=container::MaxIndex) | |
kernel2D (const genericLattice2D< T > &other, const size_type &from, const size_type &to) | |
kernel2D (const genericLattice2D< T > &other, const iinterval &rows, const iinterval &columns) | |
kernel2D (const genericLattice2D< T > &other, const genericLattice1D< int > &rows) | |
kernel2D (const kernel2D &other) | |
virtual | ~kernel2D () |
kernel2D & | copy (const kernel2D &other) |
virtual const std::string & | name () const |
virtual kernel2D< T > * | clone () const |
virtual kernel2D< T > * | newInstance () const |
template<class U > | |
kernel2D & | castFrom (const kernel2D< U > &other) |
const T & | getNorm () const |
void | setNorm (const T &n) |
void | normalize () |
virtual bool | write (ioHandler &handler, const bool complete=true) const |
virtual bool | read (ioHandler &handler, const bool complete=true) |
Symmetries | |
kernel2D< T > & | mirror (const kernel2D< T > &other) |
kernel2D< T > & | mirror () |
Protected Attributes | |
T | norm_ |
The template type of this class should coincide with the template class of the matrix to be convolved with. For example, if you want to convolve a kernel2D with a matrix<double>, you will need a kernel2D<double> (
For int: 65536 For ubyte: 255 Otherwise: 1.0
typedef lattice2D<T>::const_iterator cvr::kernel2D< T >::const_iterator |
const_iterator
type (allows read-only operations).
The use of the iterator classes is similar to the iterators of the STL (Standard Template Library). See cvr::lattice2D::begin() for an example.
For the debugging version of the iterators, boundary check will be done! This explains the low speed of the iterators of the debug version. In the release version, no boundary check will be done, and the iterators are sometimes a factor 10 faster than the debug iterators.
The use of the access operator at() is faster than the iterators in the debug version only. If you need to iterate on a lattice2D use iterators instead (in the release version iterators are approximately a factor 3 faster than at()).
Reimplemented from cvr::lattice2D< T >.
typedef lattice2D<T>::const_pointer cvr::kernel2D< T >::const_pointer |
typedef lattice2D<T>::const_reference cvr::kernel2D< T >::const_reference |
typedef lattice2D<T>::iterator cvr::kernel2D< T >::iterator |
iterator
type (allows read and write operations).
The use of the iterator classes is similar to the iterators of the STL (Standard Template Library). See cvr::lattice2D::begin() and cvr::lattice2D::inverseBegin() for examples.
For the debugging version of the iterators, boundary check will be done! This explains the low speed of the iterators of the debug version. In the release version, no boundary check will be done, and the iterators are sometimes a factor 10 faster than the debug iterators.
The use of the access operator at() is faster than the iterators in the debug version only. If you need to iterate on a lattice2D use iterators instead (in the release version iterators are approximately a factor 3 faster than at()).
Reimplemented from cvr::lattice2D< T >.
typedef lattice2D<T>::pointer cvr::kernel2D< T >::pointer |
typedef lattice2D<T>::reference cvr::kernel2D< T >::reference |
typedef lattice2D<T>::size_type cvr::kernel2D< T >::size_type |
typedef lattice2D<T>::value_type cvr::kernel2D< T >::value_type |
cvr::kernel2D< T >::kernel2D | ( | ) |
Default constructor creates an empty kernel2D.
cvr::kernel2D< T >::kernel2D | ( | const int | fromRow, | |
const int | fromCol, | |||
const int | toRow, | |||
const int | toCol | |||
) |
Create a kernel2D with uninitialized elements.
fromRow | lowest row index | |
fromCol | lowest column index | |
toRow | highest row index (inclusive) | |
toCol | highest column index (inclusive) |
cvr::kernel2D< T >::kernel2D | ( | const size_type & | from, | |
const size_type & | to | |||
) |
Create a rows x cols kernel2D with uninitialized elements.
from | lowest index | |
to | highest index (inclusive) |
cvr::kernel2D< T >::kernel2D | ( | const iinterval & | rows, | |
const iinterval & | columns | |||
) |
cvr::kernel2D< T >::kernel2D | ( | const int | fromRow, | |
const int | fromCol, | |||
const int | toRow, | |||
const int | toCol, | |||
const T & | value | |||
) |
Create a kernel2D and initialize all elements with the given value.
fromRow | lowest row index | |
fromCol | lowest column index | |
toRow | highest row index (inclusive) | |
toCol | highest column index (inclusive) | |
value | value used for initializing the elements |
cvr::kernel2D< T >::kernel2D | ( | const size_type & | from, | |
const size_type & | to, | |||
const T & | value | |||
) |
Create a kernel2D and initialize all elements with the given value.
from | lowest index | |
to | highest index (inclusive) | |
value | value used for initializing the elements |
cvr::kernel2D< T >::kernel2D | ( | const iinterval & | rows, | |
const iinterval & | columns, | |||
const T & | value | |||
) |
cvr::kernel2D< T >::kernel2D | ( | const int | fromRow, | |
const int | fromCol, | |||
const int | toRow, | |||
const int | toCol, | |||
const T | data[] | |||
) |
Create a kernel2D and initialize all elements with the data pointed by data.
The first elements of the data will be copied on the first row, the next ones on the second row and so on.
fromRow | lowest row index | |
fromCol | lowest column index | |
toRow | highest row index (inclusive) | |
toCol | highest column index (inclusive) | |
data | pointer to the memory block with the data to be initialized with. |
cvr::kernel2D< T >::kernel2D | ( | const size_type & | from, | |
const size_type & | to, | |||
const T | data[] | |||
) |
Create a kernel2D and initialize all elements with the data pointed by data.
The first elements of the data will be copied on the first row, the next ones on the second row and so on.
from | lowest index | |
to | highest index (inclusive) | |
data | pointer to the memory block with the data to be initialized with. |
cvr::kernel2D< T >::kernel2D | ( | const iinterval & | rows, | |
const iinterval & | columns, | |||
const T | data[] | |||
) |
Create a kernel2D and initialize all elements with the data pointed by data.
The first elements of the data will be copied on the first row, the next ones on the second row and so on.
cvr::kernel2D< T >::kernel2D | ( | const int | fromRow, | |
const int | fromCol, | |||
const int | toRow, | |||
const int | toCol, | |||
T | data[], | |||
const eConstantReference | constRef | |||
) |
Create a kernel2D and use the given data as if it was given through the useExternData().
fromRow | lowest row index | |
fromCol | lowest column index | |
toRow | highest row index (inclusive) | |
toCol | highest column index (inclusive) | |
data | pointer to the memory block with the data to be initialized with. | |
constRef | usually you want this value to be ConstantReference. |
cvr::kernel2D< T >::kernel2D | ( | const size_type & | from, | |
const size_type & | to, | |||
T | data[], | |||
const eConstantReference | constRef | |||
) |
Create a kernel2D and use the given data as if it was given through the useExternData().
from | lowest index | |
to | highest index (inclusive) | |
data | pointer to the memory block with the data to be initialized with. | |
constRef | usually you want this value to be ConstantReference. |
cvr::kernel2D< T >::kernel2D | ( | const iinterval & | rows, | |
const iinterval & | columns, | |||
T | data[], | |||
const eConstantReference | constRef | |||
) |
Create a kernel2D and use the given data as if it was given through the useExternData().
cvr::kernel2D< T >::kernel2D | ( | const genericLattice2D< T > & | other | ) |
cvr::kernel2D< T >::kernel2D | ( | const genericLattice2D< T > & | other, | |
const int | fromRow, | |||
const int | fromCol, | |||
const int | toRow = container::MaxIndex , |
|||
const int | toCol = container::MaxIndex | |||
) |
Copy constructor.
Create this kernel2D as a copy of another kernel2D for this const version, the data will be always copied!
other | the genericLattice2D to be copied. | |
fromRow | initial row of the other genericLattice2D to be copied | |
fromCol | initial column of the other genericLattice2D to be copied | |
toRow | last row to be copied of the other genericLattice2D | |
toCol | last column to be copied of the other genericLattice2D |
cvr::kernel2D< T >::kernel2D | ( | const genericLattice2D< T > & | other, | |
const size_type & | from, | |||
const size_type & | to | |||
) |
Copy constructor.
Create this kernel2D as a copy of a section of another kernel2D
other | the genericLattice2D to be copied. | |
from | initial position in the other genericLattice2D to be copied | |
to | last position to be copied of the other genericLattice2D |
cvr::kernel2D< T >::kernel2D | ( | const genericLattice2D< T > & | other, | |
const iinterval & | rows, | |||
const iinterval & | columns | |||
) |
Copy constructor.
Create this kernel2D as a copy of a sublattice2D of another genericLattice2D.
other | the genericLattice2D to be copied. | |
rows | interval of rows to be copied. | |
columns | interval of columns to be copied. |
cvr::kernel2D< T >::kernel2D | ( | const genericLattice2D< T > & | other, | |
const genericLattice1D< int > & | rows | |||
) |
Copy constructor.
Create this kernel2D as a copy of another genericLattice2D taking only the rows indicated by the vector.
The data will be always copied! Multiple occurence of one row index in rows is allowed.
other | the genericLattice2D to be copied. | |
rows | indices of the rows to be copied |
cvr::kernel2D< T >::kernel2D | ( | const kernel2D< T > & | other | ) |
Copy constructor.
other | the one dimensional kernel to be copied |
virtual cvr::kernel2D< T >::~kernel2D | ( | ) | [virtual] |
Destructor.
kernel2D& cvr::kernel2D< T >::castFrom | ( | const kernel2D< U > & | other | ) | [inline] |
Copy from kernel of different type.
other | a one dimensional kernel of another type |
References cvr::kernel2D< T >::getNorm(), and cvr::kernel2D< T >::norm_.
virtual kernel2D<T>* cvr::kernel2D< T >::clone | ( | ) | const [virtual] |
kernel2D& cvr::kernel2D< T >::copy | ( | const kernel2D< T > & | other | ) |
Copy member.
other | the one dimensional kernel to be copied |
const T& cvr::kernel2D< T >::getNorm | ( | ) | const [inline] |
Get normalization factor.
The normalization factor is used by the fixed point types as a representation of the value 1. For example, the norm for a kernel2D<ubyte> can be 255, if the filter kernel don't need values greater than 1.0.
References cvr::kernel2D< T >::norm_.
Referenced by cvr::kernel2D< T >::castFrom().
kernel2D<T>& cvr::kernel2D< T >::mirror | ( | ) |
Mirror this kernel, i.e.
at(x,y) = at(-x,-y);
kernel2D<T>& cvr::kernel2D< T >::mirror | ( | const kernel2D< T > & | other | ) |
Mirror the other kernel and leave the result here, i.e.
at(x,y) = other.at(-x,-y);
other | the kernel to be copied and then mirrored |
virtual const std::string& cvr::kernel2D< T >::name | ( | ) | const [virtual] |
virtual kernel2D<T>* cvr::kernel2D< T >::newInstance | ( | ) | const [virtual] |
Create a new instance.
Reimplemented from cvr::lattice2D< T >.
void cvr::kernel2D< T >::normalize | ( | ) |
Normalize divides all elements by the norm and sets the norm to 1!
virtual bool cvr::kernel2D< T >::read | ( | ioHandler & | handler, | |
const bool | complete = true | |||
) | [virtual] |
void cvr::kernel2D< T >::setNorm | ( | const T & | n | ) | [inline] |
virtual bool cvr::kernel2D< T >::write | ( | ioHandler & | handler, | |
const bool | complete = true | |||
) | const [virtual] |
T cvr::kernel2D< T >::norm_ [protected] |
Normalization factor.
This value will be ignored for floating point formats. For fixed point formats, this value corresponds to 1.0
Referenced by cvr::kernel2D< T >::castFrom(), cvr::kernel2D< T >::getNorm(), and cvr::kernel2D< T >::setNorm().