last update 20 Sep 2009 |
#include <cvrKernel1D.h>
Public Types | |
Internal types and classes | |
typedef lattice1D< T >::value_type | value_type |
typedef lattice1D< T >::size_type | size_type |
typedef lattice1D< T >::pointer | pointer |
typedef lattice1D< T > ::const_pointer | const_pointer |
typedef lattice1D< T >::reference | reference |
typedef lattice1D< T > ::const_reference | const_reference |
typedef lattice1D< T >::iterator | iterator |
typedef lattice1D< T > ::const_iterator | const_iterator |
Public Member Functions | |
kernel1D () | |
kernel1D (const int from, const int to, const T &init) | |
kernel1D (const int from, const int to) | |
kernel1D (const vector< T > &other, const int theOffset) | |
kernel1D (const kernel1D &other) | |
virtual | ~kernel1D () |
kernel1D & | copy (const kernel1D &other) |
virtual const std::string & | name () const |
virtual kernel1D< T > * | clone () const |
virtual kernel1D< T > * | newInstance () const |
template<class U > | |
kernel1D & | castFrom (const kernel1D< U > &other) |
kernel1D< T > & | castFrom (const vector< T > &other, const int firstElement=0) |
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 | |
kernel1D< T > & | mirror (const kernel1D< T > &other) |
kernel1D< T > & | mirror () |
bool | isSymmetric () const |
bool | isAsymmetric () const |
void | computeSymmetricComponent () |
void | computeSymmetricComponent (const kernel1D< T > &other) |
void | computeAsymmetricComponent () |
void | computeAsymmetricComponent (const kernel1D< T > &other) |
Protected Attributes | |
T | norm_ |
The template type of this class should coincide with the template class of the vector be convolved with. For example, if you want to convolve a kernel1D with a vector<double>, you will need a kernel1D<double> (
For int: 65536 For ubyte: 255 Otherwise: 1.0
typedef lattice1D<T>::const_iterator cvr::kernel1D< 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::lattice1D::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 lattice1D use iterators instead (in the release version iterators are approximately a factor 3 faster than at()).
Reimplemented from cvr::lattice1D< T >.
typedef lattice1D<T>::const_pointer cvr::kernel1D< T >::const_pointer |
typedef lattice1D<T>::const_reference cvr::kernel1D< T >::const_reference |
typedef lattice1D<T>::iterator cvr::kernel1D< 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::lattice1D::begin() and cvr::lattice1D::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 lattice1D use iterators instead (in the release version iterators are approximately a factor 3 faster than at()).
Reimplemented from cvr::lattice1D< T >.
typedef lattice1D<T>::pointer cvr::kernel1D< T >::pointer |
typedef lattice1D<T>::reference cvr::kernel1D< T >::reference |
typedef lattice1D<T>::size_type cvr::kernel1D< T >::size_type |
typedef lattice1D<T>::value_type cvr::kernel1D< T >::value_type |
cvr::kernel1D< T >::kernel1D | ( | ) |
Default constructor.
cvr::kernel1D< T >::kernel1D | ( | const int | from, | |
const int | to, | |||
const T & | init | |||
) |
Construct a filter kernel indexed from from to to and initialized with the value init.
cvr::kernel1D< T >::kernel1D | ( | const int | from, | |
const int | to | |||
) |
Construct a uninitialization filter kernel indexed from from to to.
c
is not defined, and in the same way, if you want a kernel1D with initialized data, you have to specify explicitely the value with which the elements have to be initialized. cvr::kernel1D< T >::kernel1D | ( | const vector< T > & | other, | |
const int | theOffset | |||
) |
cvr::kernel1D< T >::kernel1D | ( | const kernel1D< T > & | other | ) |
Copy constructor.
other | the one dimensional kernel to be copied |
virtual cvr::kernel1D< T >::~kernel1D | ( | ) | [virtual] |
Destructor.
kernel1D<T>& cvr::kernel1D< T >::castFrom | ( | const vector< T > & | other, | |
const int | firstElement = 0 | |||
) |
Copy the content of the other vector in this kernel and assign the index (firstElement) to the first element of the vector.
For example if other
is a 3 dimensional vector, then castFrom(other,-1)
is a 3-elements-kernel which indices lay inside [-1,1].
other | the vector with the data to be copied | |
firstElement | index for the first element of the vector |
kernel1D& cvr::kernel1D< T >::castFrom | ( | const kernel1D< U > & | other | ) | [inline] |
Copy from kernel of different type.
other | a one dimensional kernel of another type |
References cvr::kernel1D< T >::getNorm(), and cvr::kernel1D< T >::norm_.
virtual kernel1D<T>* cvr::kernel1D< T >::clone | ( | ) | const [virtual] |
void cvr::kernel1D< T >::computeAsymmetricComponent | ( | const kernel1D< T > & | other | ) |
Get kernel asymmetric component of other kernel.
Each discrete function (including kernels like this one) can be decomposed into a symmetric component $ and an asymmetric component following the equation
This method extracts the asymmetric component of the other kernel.
other | the kernel which will be decomposed. |
void cvr::kernel1D< T >::computeAsymmetricComponent | ( | ) |
Get kernel asymmetric component.
Each discrete function (including kernels like this one) can be decomposed into a symmetric component $ and an asymmetric component following the equation
This method extracts the asymmetric component only
void cvr::kernel1D< T >::computeSymmetricComponent | ( | const kernel1D< T > & | other | ) |
Get kernel symmetric component of other kernel.
Each discrete function (including kernels like this one) can be decomposed into a symmetric component $ and an asymmetric component following the equation
This method extracts the symmetric component of the other kernel.
other | the kernel which will be decomposed. |
void cvr::kernel1D< T >::computeSymmetricComponent | ( | ) |
Get kernel symmetric component.
Each discrete function (including kernels like this one) can be decomposed into a symmetric component $ and an asymmetric component following the equation
This method extracts the symmetric component only
kernel1D& cvr::kernel1D< T >::copy | ( | const kernel1D< T > & | other | ) |
Copy member.
other | the one dimensional kernel to be copied |
const T& cvr::kernel1D< 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 kernel1D<ubyte> can be 255, if the filter kernel don't need values greater than 1.0.
References cvr::kernel1D< T >::norm_.
Referenced by cvr::kernel1D< T >::castFrom().
bool cvr::kernel1D< T >::isAsymmetric | ( | ) | const |
Check if this kernel is asymmetric, i.e.
if it is valid at(x)==-at(-x) and firstIdx() == -lastIdx()
bool cvr::kernel1D< T >::isSymmetric | ( | ) | const |
Check if this kernel is symmetric, i.e.
if it is valid at(x)==at(-x) and firstIdx() == -lastIdx()
kernel1D<T>& cvr::kernel1D< T >::mirror | ( | ) |
Mirror this kernel, i.e.
at(x) = at(-x);
kernel1D<T>& cvr::kernel1D< T >::mirror | ( | const kernel1D< T > & | other | ) |
Mirror the other kernel and leave the result here, i.e.
at(x) = other.at(-x);
other | the kernel to be copied and then mirrored |
virtual const std::string& cvr::kernel1D< T >::name | ( | ) | const [virtual] |
virtual kernel1D<T>* cvr::kernel1D< T >::newInstance | ( | ) | const [virtual] |
Create a new instance.
Reimplemented from cvr::lattice1D< T >.
void cvr::kernel1D< T >::normalize | ( | ) |
Normalize divides all elements by the norm and sets the norm to 1!
virtual bool cvr::kernel1D< T >::read | ( | ioHandler & | handler, | |
const bool | complete = true | |||
) | [virtual] |
void cvr::kernel1D< T >::setNorm | ( | const T & | n | ) | [inline] |
virtual bool cvr::kernel1D< T >::write | ( | ioHandler & | handler, | |
const bool | complete = true | |||
) | const [virtual] |
T cvr::kernel1D< 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::kernel1D< T >::castFrom(), cvr::kernel1D< T >::getNorm(), and cvr::kernel1D< T >::setNorm().