iLab Neuromorphic Robotics Toolkit  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GenericImage Operators

Operator overloads for GenericImage. Note that in the philosophy of explicit constructors we here do not implement operators that mix a GenericImage and an Image<T>; users should instead explicitly convert one of the two operands, e.g.,

We also do not define unary arithmetic operators, as those would be potentially confusing: for example, for GenericImage operator+=(GenericImage), what if the lhs is an Image<PixGray<byte>> and the rhs is an Image<PixRGB<byte>>? Should we return a GenericImage that contains the same type as the lhs (confusing to people who may assume that GenericImage is like "any image"), or a GenericImage that contains a properly promoted Image<PixRGB<int>> (confusing to people who believe unary operators should not change the lhs type). So to avoid any possible confusion, unary arithmetic operators are not defined on GenericImage and one should instead use binary operators (operator+(), operator-(), etc).

Note that GenericImage operators are not fully symmetric and the following applies; note that LHS and RHS can here be either a GenericImage with inside an Image of a certain Pixtype, or they can just be a constant of that Pixtype:

The asymmetry comes from incompatible types with same number of channels, for example GenericImage(PixRGB<byte>) + GenericImage(PixHSV<float>) is a GenericImage(PixRGB<float>) but GenericImage(PixHSV<byte>) + GenericImage(PixRGB<float>) is a GenericImage(PixHSV<float>), i.e., LHS determines the pixel type.

See Also
Image class template and related classes and functions

Macros

#define NRT_ENABLE_IF_PIXEL(PixType)   typename=typename std::enable_if<pixel_helper::is_pixel<PixType>::value>::type
 

Functions

GenericImage nrt::operator+ (GenericImage const &lhs, GenericImage const &rhs)
 Pointwise addition of two GenericImage images: GenericImage + GenericImage.
 
template<class PixType2 , NRT_ENABLE_IF_PIXEL(PixType2) >
GenericImage nrt::operator+ (GenericImage const &lhs, PixType2 const &rhs)
 Addition of a constant to every pixel in a GenericImage: GenericImage + T.
 
template<class PixType1 , NRT_ENABLE_IF_PIXEL(PixType1) >
GenericImage nrt::operator+ (PixType1 const &lhs, GenericImage const &rhs)
 Addition of a constant to every pixel in a GenericImage: T + GenericImage.
 
GenericImage nrt::operator- (GenericImage const &lhs, GenericImage const &rhs)
 Pointwise subtraction of two GenericImage objects: GenericImage - GenericImage.
 
template<class PixType2 , NRT_ENABLE_IF_PIXEL(PixType2) >
GenericImage nrt::operator- (GenericImage const &lhs, PixType2 const &rhs)
 Subtraction of a constant from every pixel in a GenericImage: GenericImage - T.
 
template<class PixType1 , NRT_ENABLE_IF_PIXEL(PixType1) >
GenericImage nrt::operator- (PixType1 const &lhs, GenericImage const &rhs)
 Subtraction of every pixel of a GenericImage from a constant: T - GenericImage.
 
GenericImage nrt::operator* (GenericImage const &lhs, GenericImage const &rhs)
 Pointwise product of two GenericImage images: GenericImage * GenericImage.
 
template<class PixType2 , NRT_ENABLE_IF_PIXEL(PixType2) >
GenericImage nrt::operator* (GenericImage const &lhs, PixType2 const &rhs)
 Product of everypixel of a GenericImage by a constant: GenericImage * T.
 
template<class PixType1 , NRT_ENABLE_IF_PIXEL(PixType1) >
GenericImage nrt::operator* (PixType1 const &lhs, GenericImage const &rhs)
 Product of everypixel of a GenericImage by a constant: T * GenericImage.
 
GenericImage nrt::operator/ (GenericImage const &lhs, GenericImage const &rhs)
 Pointwise division of two GenericImage images: GenericImage / GenericImage. More...
 
template<class PixType2 , NRT_ENABLE_IF_PIXEL(PixType2) >
GenericImage nrt::operator/ (GenericImage const &lhs, PixType2 const &rhs)
 Division of every pixel of a GenericImage by a constant: GenericImage / T. More...
 
template<class PixType1 , NRT_ENABLE_IF_PIXEL(PixType1) >
GenericImage nrt::operator/ (PixType1 const &lhs, GenericImage const &rhs)
 Division of a constant by every pixel of a GenericImage: T / GenericImage. More...
 

Function Documentation

GenericImage nrt::operator/ ( GenericImage const &  lhs,
GenericImage const &  rhs 
)

Pointwise division of two GenericImage images: GenericImage / GenericImage.

Note
Will throw if a division by zero is encountered.
template<class PixType2 , NRT_ENABLE_IF_PIXEL(PixType2) >
GenericImage nrt::operator/ ( GenericImage const &  lhs,
PixType2 const &  rhs 
)

Division of every pixel of a GenericImage by a constant: GenericImage / T.

Note
Will throw if a division by zero is encountered.
template<class PixType1 , NRT_ENABLE_IF_PIXEL(PixType1) >
GenericImage nrt::operator/ ( PixType1 const &  lhs,
GenericImage const &  rhs 
)

Division of a constant by every pixel of a GenericImage: T / GenericImage.

Note
Will throw if a division by zero is encountered.