Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Static Public Member Functions | List of all members
BIAS::ImageCalc< StorageType > Class Template Reference

Performs pixelwise arithmetic and boolean operations on images. More...

#include <Base/ImageUtils/ImageCalc.hh>

Static Public Member Functions

static void Abs (const Image< StorageType > &in, Image< StorageType > &out)
 Computes the absolute value for each pixel. More...
 
static void Add (const Image< StorageType > &in1, const Image< StorageType > &in2, Image< StorageType > &out)
 Computes the pixelwise sum of the input images. More...
 
static void AddScalar (const Image< StorageType > &in, StorageType scalar, Image< StorageType > &out)
 Adds the scalar value to each pixel of the input image. More...
 
static void And (const Image< StorageType > &in1, const Image< StorageType > &in2, Image< StorageType > &out)
 Performs a pixelwise AND on the input images. More...
 
static void Divide (const Image< StorageType > &in1, const Image< StorageType > &in2, Image< StorageType > &out)
 Computes the pixelwise quotient of the input images. More...
 
static void DivideScalar (const Image< StorageType > &in, StorageType scalar, Image< StorageType > &out)
 Divides each pixel from the input image by the scalar. More...
 
static void Log (const Image< StorageType > &in, Image< StorageType > &out)
 Computes the natural logarithm (base e) for each pixel. More...
 
static void Log10 (const Image< StorageType > &in, Image< StorageType > &out)
 Computes the common logarithm (base 10) for each pixel. More...
 
static void Multiply (const Image< StorageType > &in1, const Image< StorageType > &in2, Image< StorageType > &out)
 Computes the pixelwise product of the input images. More...
 
static void MultiplyScalar (const Image< StorageType > &in, StorageType scalar, Image< StorageType > &out)
 Multiplies the scalar value to each pixel of the input image. More...
 
static void Nand (const Image< StorageType > &in1, const Image< StorageType > &in2, Image< StorageType > &out)
 Performs a pixelwise NAND on the input images. More...
 
static void Nor (const Image< StorageType > &in1, const Image< StorageType > &in2, Image< StorageType > &out)
 Performs a pixelwise NOR on the input images. More...
 
static void Or (const Image< StorageType > &in1, const Image< StorageType > &in2, Image< StorageType > &out)
 Performs a pixelwise OR on the input images. More...
 
static void Subtract (const Image< StorageType > &in1, const Image< StorageType > &in2, Image< StorageType > &out)
 Computes the pixelwise difference of the input images. More...
 
static void SubtractScalar (const Image< StorageType > &in, StorageType scalar, Image< StorageType > &out)
 Subtracts the scalar value from each pixel of the input image. More...
 
static void Xor (const Image< StorageType > &in1, const Image< StorageType > &in2, Image< StorageType > &out)
 Performs a pixelwise XOR on the input images. More...
 

Detailed Description

template<class StorageType>
class BIAS::ImageCalc< StorageType >

Performs pixelwise arithmetic and boolean operations on images.

Note
Over- and underflows are not prevented. You may want to convert your 1-byte images (like char or unsigned char) to float.
The output image is always initialised.

Possible improvements:

Definition at line 52 of file ImageCalc.hh.

Member Function Documentation

template<class StorageType >
void ImageCalc::Abs ( const Image< StorageType > &  in,
Image< StorageType > &  out 
)
static

Computes the absolute value for each pixel.

Obiously only makes sense for signed storage types...

Definition at line 451 of file ImageCalc.cpp.

References BIAS::ImageBase::GetChannelCount(), BIAS::ImageBase::GetHeight(), BIAS::Image< StorageType >::GetImageData(), BIAS::ImageBase::GetWidth(), and BIAS::Image< StorageType >::Init().

template<class StorageType >
void ImageCalc::Add ( const Image< StorageType > &  in1,
const Image< StorageType > &  in2,
Image< StorageType > &  out 
)
static
template<class StorageType >
void ImageCalc::AddScalar ( const Image< StorageType > &  in,
StorageType  scalar,
Image< StorageType > &  out 
)
static
template<class StorageType >
void ImageCalc::And ( const Image< StorageType > &  in1,
const Image< StorageType > &  in2,
Image< StorageType > &  out 
)
static

Performs a pixelwise AND on the input images.

The input images are interpreted binary: input pixel values == 0 are treated as FALSE and all values != 0 are interpreted as TRUE. Output image will be of same storage type as input images, but will contain only binary values, i.e. only 0 and 1.

Each image channel is treated individually.

Definition at line 150 of file ImageCalc.cpp.

References BIAS::ImageBase::GetChannelCount(), BIAS::ImageBase::GetHeight(), BIAS::Image< StorageType >::GetImageData(), BIAS::ImageBase::GetWidth(), and BIAS::Image< StorageType >::Init().

template<class StorageType >
void ImageCalc::Divide ( const Image< StorageType > &  in1,
const Image< StorageType > &  in2,
Image< StorageType > &  out 
)
static

Computes the pixelwise quotient of the input images.

The first image is divided by the second one.

Note
In case of division by zero the output image's pixel will be set to 0 and a BIASWARN will be printed to stdout

Definition at line 117 of file ImageCalc.cpp.

References BIAS::ImageBase::GetChannelCount(), BIAS::ImageBase::GetHeight(), BIAS::Image< StorageType >::GetImageData(), BIAS::ImageBase::GetWidth(), and BIAS::Image< StorageType >::Init().

template<class StorageType >
void ImageCalc::DivideScalar ( const Image< StorageType > &  in,
StorageType  scalar,
Image< StorageType > &  out 
)
static

Divides each pixel from the input image by the scalar.

Note
The scalar must not be 0!

Definition at line 384 of file ImageCalc.cpp.

References BIAS::ImageBase::GetChannelCount(), BIAS::ImageBase::GetHeight(), BIAS::Image< StorageType >::GetImageData(), BIAS::ImageBase::GetWidth(), and BIAS::Image< StorageType >::Init().

template<class StorageType >
void ImageCalc::Log ( const Image< StorageType > &  in,
Image< StorageType > &  out 
)
static

Computes the natural logarithm (base e) for each pixel.

Note
Each pixel's value will be cast to double for the computation and then back to it's original storage type.

Definition at line 411 of file ImageCalc.cpp.

References BIAS::ImageBase::GetChannelCount(), BIAS::ImageBase::GetHeight(), BIAS::Image< StorageType >::GetImageData(), BIAS::ImageBase::GetWidth(), and BIAS::Image< StorageType >::Init().

template<class StorageType >
void ImageCalc::Log10 ( const Image< StorageType > &  in,
Image< StorageType > &  out 
)
static

Computes the common logarithm (base 10) for each pixel.

Note
Each pixel's value will be cast to double for the computation and then back to it's original storage type.

Definition at line 431 of file ImageCalc.cpp.

References BIAS::ImageBase::GetChannelCount(), BIAS::ImageBase::GetHeight(), BIAS::Image< StorageType >::GetImageData(), BIAS::ImageBase::GetWidth(), and BIAS::Image< StorageType >::Init().

template<class StorageType >
void ImageCalc::Multiply ( const Image< StorageType > &  in1,
const Image< StorageType > &  in2,
Image< StorageType > &  out 
)
static
template<class StorageType >
void ImageCalc::MultiplyScalar ( const Image< StorageType > &  in,
StorageType  scalar,
Image< StorageType > &  out 
)
static
template<class StorageType >
void ImageCalc::Nand ( const Image< StorageType > &  in1,
const Image< StorageType > &  in2,
Image< StorageType > &  out 
)
static

Performs a pixelwise NAND on the input images.

The input images are interpreted binary: input pixel values == 0 are treated as FALSE and all values != 0 are interpreted as TRUE. Output image will be of same storage type as input images, but will contain only binary values, i.e. only 0 and 1.

Each image channel is treated individually.

Definition at line 183 of file ImageCalc.cpp.

References BIAS::ImageBase::GetChannelCount(), BIAS::ImageBase::GetHeight(), BIAS::Image< StorageType >::GetImageData(), BIAS::ImageBase::GetWidth(), and BIAS::Image< StorageType >::Init().

template<class StorageType >
void ImageCalc::Nor ( const Image< StorageType > &  in1,
const Image< StorageType > &  in2,
Image< StorageType > &  out 
)
static

Performs a pixelwise NOR on the input images.

The input images are interpreted binary: input pixel values == 0 are treated as FALSE and all values != 0 are interpreted as TRUE. Output image will be of same storage type as input images, but will contain only binary values, i.e. only 0 and 1.

Each image channel is treated individually.

Definition at line 249 of file ImageCalc.cpp.

References BIAS::ImageBase::GetChannelCount(), BIAS::ImageBase::GetHeight(), BIAS::Image< StorageType >::GetImageData(), BIAS::ImageBase::GetWidth(), and BIAS::Image< StorageType >::Init().

template<class StorageType >
void ImageCalc::Or ( const Image< StorageType > &  in1,
const Image< StorageType > &  in2,
Image< StorageType > &  out 
)
static

Performs a pixelwise OR on the input images.

The input images are interpreted binary: input pixel values == 0 are treated as FALSE and all values != 0 are interpreted as TRUE. Output image will be of same storage type as input images, but will contain only binary values, i.e. only 0 and 1.

Each image channel is treated individually.

Definition at line 216 of file ImageCalc.cpp.

References BIAS::ImageBase::GetChannelCount(), BIAS::ImageBase::GetHeight(), BIAS::Image< StorageType >::GetImageData(), BIAS::ImageBase::GetWidth(), and BIAS::Image< StorageType >::Init().

template<class StorageType >
void ImageCalc::Subtract ( const Image< StorageType > &  in1,
const Image< StorageType > &  in2,
Image< StorageType > &  out 
)
static

Computes the pixelwise difference of the input images.

The second image is subtracted from the first one.

Definition at line 63 of file ImageCalc.cpp.

References BIAS::ImageBase::GetChannelCount(), BIAS::ImageBase::GetHeight(), BIAS::Image< StorageType >::GetImageData(), BIAS::ImageBase::GetWidth(), and BIAS::Image< StorageType >::Init().

template<class StorageType >
void ImageCalc::SubtractScalar ( const Image< StorageType > &  in,
StorageType  scalar,
Image< StorageType > &  out 
)
static
template<class StorageType >
void ImageCalc::Xor ( const Image< StorageType > &  in1,
const Image< StorageType > &  in2,
Image< StorageType > &  out 
)
static

Performs a pixelwise XOR on the input images.

The input images are interpreted binary: input pixel values == 0 are treated as FALSE and all values != 0 are interpreted as TRUE. Output image will be of same storage type as input images, but will contain only binary values, i.e. only 0 and 1.

Each image channel is treated individually.

Definition at line 282 of file ImageCalc.cpp.

References BIAS::ImageBase::GetChannelCount(), BIAS::ImageBase::GetHeight(), BIAS::Image< StorageType >::GetImageData(), BIAS::ImageBase::GetWidth(), and BIAS::Image< StorageType >::Init().


The documentation for this class was generated from the following files: