|
iLab Neuromorphic Robotics Toolkit
0.1
|
These methods provide convenient wrappers to the std::algorithm library for working with Images. In general, it is faster and cleaner to use these methods rather than explicitely looping through all of the pixels with a (pair of) for loop(s) around Image::at() or Image::operator().
Functions | |
| template<class PixType , class BinaryOperation > | |
| PixType | nrt::accumulate (nrt::Image< PixType > const &img, PixType init=PixType(0), BinaryOperation op=std::plus< PixType >()) |
| Accumulate the values of all pixels in the Image. | |
| template<class PixType , class UnaryOperator > | |
| void | nrt::transformInPlace (nrt::Image< PixType > &lhs, UnaryOperator op) |
| Apply the given unary operator to each pixel in lhs, storing the returned value back into that pixel. | |
| template<class PixType1 , class PixType2 , class BinaryOperator > | |
| void | nrt::transformInPlace (nrt::Image< PixType1 > &lhs, nrt::Image< PixType2 > const &rhs, BinaryOperator op) |
| Apply the given binary operator to each pixel in lhs and rhs, and store the result in lhs's pixel. | |
| template<class PixType , class UnaryOperator > | |
| nrt::Image< PixType > | nrt::transform (nrt::Image< PixType > const &lhs, UnaryOperator op) |
| Apply the given unary operator to each pixel in lhs, storing the result in a new Image. | |
| template<class PromoteType , class PixType , class UnaryOperator > | |
| nrt::Image< PromoteType > | nrt::transform (nrt::Image< PixType > const &lhs, UnaryOperator op) |
| Apply the given unary operator to each pixel in lhs, storing the result in a new Image of type PixelType. | |
| template<class PixType1 , class PixType2 , class BinaryOperator > | |
| std::enable_if< nrt_traits < PixType1, PixType2 > ::has_arithmetic, nrt::Image < typename nrt_traits < PixType1, PixType2 > ::promote_type > >::type | nrt::transform (nrt::Image< PixType1 > const &lhs, nrt::Image< PixType2 > const &rhs, BinaryOperator op) |
| Apply the given binary function to each pixel in lhs and rhs, storing the result in a new Image. | |
| template<class PixType , class UnaryOperator > | |
| nrt::Image< PixType > | nrt::channel_transform (nrt::Image< PixType > const &lhs, UnaryOperator op) |
| Apply the given unary operator to each channel of each pixel in lhs, storing the result in a new Image. | |
| template<class PromoteType , class PixType , class UnaryOperator > | |
| nrt::Image< PromoteType > | nrt::channel_transform (nrt::Image< PixType > const &lhs, UnaryOperator op) |
| Apply given unary operator to each channel of each pixel in lhs, storing result in a new Image of type PixelType. | |
| template<class PixType1 , class PixType2 , class BinaryOperator > | |
| std::enable_if< nrt_traits < PixType1, PixType2 > ::has_arithmetic, nrt::Image < typename nrt_traits < PixType1, PixType2 > ::promote_type > >::type | nrt::channel_transform (nrt::Image< PixType1 > const &lhs, nrt::Image< PixType2 > const &rhs, BinaryOperator op) |
| Apply the given binary function to each channel of each pixel in lhs and rhs, storing the result in a new Image. | |
| template<class PixType , class UnaryFunction > | |
| void | nrt::for_each (nrt::Image< PixType > const &img, UnaryFunction op) |
| Run the given unary function on each pixel in img. | |
| PixType nrt::accumulate | ( | nrt::Image< PixType > const & | img, |
| PixType | init = PixType(0), |
||
| BinaryOperation | op = std::plus< PixType >() |
||
| ) | [inline] |
Accumulate the values of all pixels in the Image.
| img | The Image on which to perform the accumulation |
| init | The initial value of the accumulation. The default is PixType(0). |
| op | The binary operation to perform on the running accumulation tally and each new pixel in img. The default is the plus operator, but you may supply whatever custom operator you wish. |
Definition at line 45 of file ImageAlgorithmsImpl.H.
References nrt::Image< T, Flags >::const_begin(), and nrt::Image< T, Flags >::const_end().
| void nrt::transformInPlace | ( | nrt::Image< PixType > & | lhs, |
| UnaryOperator | op | ||
| ) | [inline] |
Apply the given unary operator to each pixel in lhs, storing the returned value back into that pixel.
| lhs | The image on which to perform the transformation, as well as the destination for the results of op |
| op | The unary operator which is applied to each pixel |
Definition at line 54 of file ImageAlgorithmsImpl.H.
References nrt::Image< T, Flags >::begin(), nrt::Image< T, Flags >::const_begin(), nrt::Image< T, Flags >::const_end(), and nrt::transform().
| void nrt::transformInPlace | ( | nrt::Image< PixType1 > & | lhs, |
| nrt::Image< PixType2 > const & | rhs, | ||
| BinaryOperator | op | ||
| ) | [inline] |
Apply the given binary operator to each pixel in lhs and rhs, and store the result in lhs's pixel.
| lhs | The left-hand-side image whose pixels are fed as the first parameter to op, as well as the destination for the result of op. |
| rhs | the right-hand-side image whose pixels are fed as the second parameter to op. |
| op | The binary operator which is applied to each pair of pixels |
Definition at line 61 of file ImageAlgorithmsImpl.H.
References nrt::Image< T, Flags >::begin(), nrt::Image< T, Flags >::const_begin(), nrt::Image< T, Flags >::const_end(), and nrt::transform().
| nrt::Image< PixType > nrt::transform | ( | nrt::Image< PixType > const & | lhs, |
| UnaryOperator | op | ||
| ) | [inline] |
Apply the given unary operator to each pixel in lhs, storing the result in a new Image.
| lhs | The source of pixels to be fed into op |
| op | The unary operator to apply to each pixel of lhs. The returned value is stored in the corresponding location of a new Image. |
Definition at line 70 of file ImageAlgorithmsImpl.H.
References nrt::Image< T, Flags >::const_begin(), nrt::Image< T, Flags >::const_end(), and nrt::Image< T, Flags >::dims().
Referenced by nrt::Image< T, Flags >::channel(), nrt::channel_transform(), nrt::eigenMatrixToImage(), nrt::eigenVectorToImage(), nrt::imageToEigenMatrix(), nrt::imageToEigenVector(), nrt::normalize(), nrt::operator*(), nrt::operator*=(), nrt::operator+(), nrt::operator+=(), nrt::operator-(), nrt::operator-=(), nrt::operator/(), nrt::operator/=(), nrt::Point< T, Dimensions >::Point(), nrt::transform(), and nrt::transformInPlace().
| nrt::Image< PromoteType > nrt::transform | ( | nrt::Image< PixType > const & | lhs, |
| UnaryOperator | op | ||
| ) | [inline] |
Apply the given unary operator to each pixel in lhs, storing the result in a new Image of type PixelType.
The only difference between this method and the one above is that the returned Image will be of type PromoteType, rather than PixType.
| lhs | The image on which to perform the transformation. |
| op | The unary operator which is applied to each pixel. The returned value is converted to PromoteType and stored in the corresponding location of a new Image. |
| PromoteType | The pixel type for the new Image |
Definition at line 79 of file ImageAlgorithmsImpl.H.
References nrt::Image< T, Flags >::const_begin(), nrt::Image< T, Flags >::const_end(), nrt::Image< T, Flags >::dims(), and nrt::transform().
| std::enable_if< nrt_traits< PixType1, PixType2 >::has_arithmetic, nrt::Image< typename nrt_traits< PixType1, PixType2 >::promote_type > >::type nrt::transform | ( | nrt::Image< PixType1 > const & | lhs, |
| nrt::Image< PixType2 > const & | rhs, | ||
| BinaryOperator | op | ||
| ) | [inline] |
Apply the given binary function to each pixel in lhs and rhs, storing the result in a new Image.
| lhs | The left-hand-side image whose pixels are fed as the first parameter to op. |
| rhs | The right-hand-side image whose pixels are fed as the second parameter to op. |
| op | The binary operator which is applied to each pair of pixels. The returned value is converted to the promoted value of PixType1 and PixType2, and stored in the corresponding location of a new Image. |
Definition at line 90 of file ImageAlgorithmsImpl.H.
References nrt::Image< T, Flags >::const_begin(), nrt::Image< T, Flags >::const_end(), nrt::Image< T, Flags >::dims(), and nrt::transform().
| nrt::Image< PixType > nrt::channel_transform | ( | nrt::Image< PixType > const & | lhs, |
| UnaryOperator | op | ||
| ) |
Apply the given unary operator to each channel of each pixel in lhs, storing the result in a new Image.
| lhs | The source of pixels to be fed into op |
| op | The unary operator (which takes in a single PixType::PODType) to apply to each channel of each pixel of lhs. The returned value is stored in the corresponding location of a new Image. |
Definition at line 100 of file ImageAlgorithmsImpl.H.
References nrt::transform().
Referenced by nrt::orientedFilter().
| nrt::Image< PromoteType > nrt::channel_transform | ( | nrt::Image< PixType > const & | lhs, |
| UnaryOperator | op | ||
| ) |
Apply given unary operator to each channel of each pixel in lhs, storing result in a new Image of type PixelType.
The only difference between this method and the one above is that the returned Image will be of type PromoteType, rather than PixType.
| lhs | The image on which to perform the transformation. |
| op | The unary operator (which takes in a single PixType::PODType) which is applied to each channel of each pixel. |
The returned value is converted to PromoteType and stored in the corresponding location of a new Image.
| PromoteType | The pixel type for the new Image |
Definition at line 112 of file ImageAlgorithmsImpl.H.
References nrt::transform().
| std::enable_if< nrt_traits< PixType1, PixType2 >::has_arithmetic, nrt::Image< typename nrt_traits< PixType1, PixType2 >::promote_type > >::type nrt::channel_transform | ( | nrt::Image< PixType1 > const & | lhs, |
| nrt::Image< PixType2 > const & | rhs, | ||
| BinaryOperator | op | ||
| ) |
Apply the given binary function to each channel of each pixel in lhs and rhs, storing the result in a new Image.
| lhs | The left-hand-side image whose pixels are fed as the first parameter to op. |
| rhs | The right-hand-side image whose pixels are fed as the second parameter to op. |
| op | The binary operator (which takes in a two PixType::PODType's) which is applied to each channel of each pair of pixels. |
The returned value is converted to the promoted value of PixType1 and PixType2, and stored in the corresponding location of a new Image.
Definition at line 126 of file ImageAlgorithmsImpl.H.
References nrt::transform().
| void nrt::for_each | ( | nrt::Image< PixType > const & | img, |
| UnaryFunction | op | ||
| ) | [inline] |
Run the given unary function on each pixel in img.
| img | The Image on which to apply the unary function. |
| op | A unary function that is run with each pixel as a parameter. |
Definition at line 142 of file ImageAlgorithmsImpl.H.
References nrt::Image< T, Flags >::const_begin(), and nrt::Image< T, Flags >::const_end().