last update 20 Sep 2009 |
#include <cvrMatrixProcessingInterface.h>
Public Member Functions | |
virtual | ~matrixProcessingInterface () |
virtual bool | apply (matrix< T > &srcdest) const =0 |
virtual bool | apply (const matrix< T > &src, matrix< T > &dest) const =0 |
Very simple interface to allow virtualization of classes that transform a matrix into another one, like convolution, correlation, matrixTransform, etc.
Note that it is required that the apply methods do not alter the internal state of the class.
virtual cvr::matrixProcessingInterface< T >::~matrixProcessingInterface | ( | ) | [inline, virtual] |
Virtual destructor.
virtual bool cvr::matrixProcessingInterface< T >::apply | ( | const matrix< T > & | src, | |
matrix< T > & | dest | |||
) | const [pure virtual] |
On-copy processing apply.
The inherited methods take the src matrix and process it leaving the result in the dest matrix.
src | matrix<T> with the source data. | |
dest | matrix<T> where the result will be left. |
Implemented in cvr::geometricTransform< I >, cvr::histogramEqualization, cvr::histogramEqualization, cvr::matrixTransform< I >, cvr::noise, cvr::noise, and cvr::geometricTransform< I >.
virtual bool cvr::matrixProcessingInterface< T >::apply | ( | matrix< T > & | srcdest | ) | const [pure virtual] |
On-place processing apply.
The inherited methods should take the srcdest matrix, process it in some way, and on the same matrix leave the result. No restrictions are imposed on whether the memory block of the resulting matrix will be the same that the one in the original matrix. As a matter of fact, it usually won't be.
If you need to ensure the memory constancy, and assuming the resulting matrix will always have the same size than the original one, then you can use the following code:
matrixProcessingInterfaceInheritedClass<T> theFunctor; matrix<T> tmp; theFunctor.apply(srcdest,tmp); srcdest.fill(tmp)
which of course will be slower as it requires to copy all the data of the result in the original matrix.
srcdest | matrix<T> with the source data. The result will be left here too. |
Implemented in cvr::geometricTransform< I >, cvr::histogramEqualization, cvr::histogramEqualization, cvr::matrixTransform< I >, cvr::noise, cvr::noise, and cvr::geometricTransform< I >.