CVB++ 15.0
Cvb::Foundation::Arithmetic Namespace Reference

Namespace for collection of arithmetic functions from the Foundation package. More...

Enumerations

enum class  PixelOverflow { Scale , Truncate }
 Defines how arithmetic overflows and underflows are handled. More...
 
enum class  SqrtPixelScaling { AsIs , Yes }
 Defines the post processing of the Sqrt function. More...
 

Functions

std::unique_ptr< ImageAdd (const Image &image1, const Image &image2, PixelOverflow overflow)
 Add the pixel values of both input images to obtain the output image. More...
 
template<class RANGE >
TypedRange< std::unique_ptr< Image >, double, RANGE >::type Add (const Image &image, const RANGE &values, PixelOverflow overflow)
 Add constant offsets to the pixel values of the input image. More...
 
std::unique_ptr< ImageAdd (const Image &image, double value, PixelOverflow overflow)
 Add constant offsets to the pixel values of the input image. More...
 
std::unique_ptr< ImageMultiply (const Image &image1, const Image &image2, PixelOverflow overflow)
 Multiply the pixel values of both input images to obtain the output image. More...
 
template<class RANGE >
TypedRange< std::unique_ptr< Image >, double, RANGE >::type Multiply (const Image &image, const RANGE &values, PixelOverflow overflow)
 Multiply constant values to the pixel values of the input image. More...
 
std::unique_ptr< ImageMultiply (const Image &image, double value, PixelOverflow overflow)
 Multiply constant values to the pixel values of the input image. More...
 
std::unique_ptr< ImageSubtract (const Image &image1, const Image &image2)
 Subtract the pixel values of image 2 from image 1 to obtain the output image. More...
 
template<class RANGE >
TypedRange< std::unique_ptr< Image >, double, RANGE >::type Subtract (const Image &image, const RANGE &values)
 Subtract constant offsets from the pixel values of the input image. More...
 
std::unique_ptr< ImageSubtract (const Image &image, double value)
 Subtract constant offsets from the pixel values of the input image. More...
 
std::unique_ptr< ImageDivide (const Image &image1, const Image &image2, int upShift)
 Divide the pixel values of image1 by the pixel values of image 2 to obtain the output image and shift them up by upShift bits to preserve information. More...
 
template<class RANGE >
TypedRange< std::unique_ptr< Image >, double, RANGE >::type Divide (const Image &image, const RANGE &values)
 Divide pixel values from the input image by constant values. More...
 
std::unique_ptr< ImageDivide (const Image &image, double value)
 Divide pixel values from the input image by a constant value. More...
 
std::unique_ptr< ImageAbsolute (const Image &image)
 Determines the absolute values of the pixels in the input image. More...
 
std::unique_ptr< ImageSubtractAbs (const Image &image1, const Image &image2)
 Subtract the pixel values of image 2 from image 1 to obtain the output image. More...
 
template<class RANGE >
TypedRange< std::unique_ptr< Image >, double, RANGE >::type SubtractAbs (const Image &image, const RANGE &values)
 Subtract constant offsets from the pixel values of the input image. More...
 
std::unique_ptr< ImageSubtractAbs (const Image &image, double value)
 Subtract constant offsets from the pixel values of the input image. More...
 
std::unique_ptr< ImageSquare (const Image &image, PixelOverflow overflow)
 Squares the pixel values of the input image to obtain the output image. More...
 
std::unique_ptr< ImageSqrt (const Image &image, SqrtPixelScaling scaling)
 Calculates the square roots of pixel values of a source image and writes them into the destination image. More...
 

Detailed Description

Namespace for collection of arithmetic functions from the Foundation package.

Remarks
CMake users: Link to imported target CVB::CvbFoundationArithmetic

Enumeration Type Documentation

◆ PixelOverflow

enum class PixelOverflow
strong

Defines how arithmetic overflows and underflows are handled.

Enumerator
Scale 

Resulting pixel values are scaled according to the data type's range.

Truncate 

Resulting pixel values are truncated at the data type's min and max values.

◆ SqrtPixelScaling

enum class SqrtPixelScaling
strong

Defines the post processing of the Sqrt function.

Enumerator
AsIs 

Square root result is stored as is (no scaling).

Yes 

Square root result is scaled to the DataType's range.

Function Documentation

◆ Absolute()

std::unique_ptr< Image > Absolute ( const Image image)
inline

Determines the absolute values of the pixels in the input image.

Parameters
[in]imageInput image.
Returns
The result image.
Exceptions
Anyexception derived from std::exception including CvbException.

Of course calling this function on an image with unsigned pixels will have no effect.

◆ Add() [1/3]

TypedRange< std::unique_ptr< Image >, double, RANGE >::type Add ( const Image image,
const RANGE &  values,
PixelOverflow  overflow 
)
inline

Add constant offsets to the pixel values of the input image.

Parameters
[in]imageInput image.
[in]valuesValues to be added (at least one per plane in image).
[in]overflowDefines how arithmetic overflow is handled.
Returns
The result image.
Exceptions
Anyexception derived from std::exception including CvbException.

If the parameter overflow is set to Scale, the resulting pixel values are divided to fit the dynamic range of the image (truncated otherwise).

◆ Add() [2/3]

std::unique_ptr< Image > Add ( const Image image,
double  value,
PixelOverflow  overflow 
)
inline

Add constant offsets to the pixel values of the input image.

Parameters
[in]imageInput image.
[in]valueValue to be added to each image plane.
[in]overflowDefines how arithmetic overflow is handled.
Returns
The result image.
Exceptions
Anyexception derived from std::exception including CvbException.

If the parameter overflow is set to Scale, the resulting pixel values are divided to fit the dynamic range of the image (truncated otherwise).

◆ Add() [3/3]

std::unique_ptr< Image > Add ( const Image image1,
const Image image2,
PixelOverflow  overflow 
)
inline

Add the pixel values of both input images to obtain the output image.

Parameters
[in]image1Input image 1.
[in]image2Input image 2.
[in]overflowDefines how arithmetic overflow is handled.
Returns
The result image.
Exceptions
Anyexception derived from std::exception including CvbException.

If the parameter overflow is set to Scale, the resulting pixel values are divided to fit the dynamic range of the image (truncated otherwise). If the sizes of the two input images differ, the result image will contain the biggest rectangle common to both input images.

◆ Divide() [1/3]

TypedRange< std::unique_ptr< Image >, double, RANGE >::type Divide ( const Image image,
const RANGE &  values 
)
inline

Divide pixel values from the input image by constant values.

Parameters
[in]imageInput image.
[in]valuesValues to divide by (at least one per plane in image).
Returns
The result image.
Exceptions
Anyexception derived from std::exception including CvbException.

◆ Divide() [2/3]

std::unique_ptr< Image > Divide ( const Image image,
double  value 
)
inline

Divide pixel values from the input image by a constant value.

Parameters
[in]imageInput image.
[in]valueValue to divide each plane by.
Returns
The result image.
Exceptions
Anyexception derived from std::exception including CvbException.

◆ Divide() [3/3]

std::unique_ptr< Image > Divide ( const Image image1,
const Image image2,
int  upShift 
)
inline

Divide the pixel values of image1 by the pixel values of image 2 to obtain the output image and shift them up by upShift bits to preserve information.

Parameters
[in]image1Input image 1.
[in]image2Input image 2.
[in]upShiftResult shift parameter.
Returns
The result image.
Exceptions
Anyexception derived from std::exception including CvbException.

If the sizes of the two input images differ, the result image will contain the biggest rectangle common to both input images.

◆ Multiply() [1/3]

TypedRange< std::unique_ptr< Image >, double, RANGE >::type Multiply ( const Image image,
const RANGE &  values,
PixelOverflow  overflow 
)
inline

Multiply constant values to the pixel values of the input image.

Parameters
[in]imageInput image.
[in]valuesValues to be multiplied (at least one per plane in image).
[in]overflowDefines how arithmetic overflow is handled.
Returns
The result image.
Exceptions
Anyexception derived from std::exception including CvbException.

If the parameter overflow is set to Scale, the resulting pixel values are divided to fit the dynamic range of the image (truncated otherwise).

◆ Multiply() [2/3]

std::unique_ptr< Image > Multiply ( const Image image,
double  value,
PixelOverflow  overflow 
)
inline

Multiply constant values to the pixel values of the input image.

Parameters
[in]imageInput image.
[in]valueValue to be multiplied to each image plane.
[in]overflowDefines how arithmetic overflow is handled.
Returns
The result image.
Exceptions
Anyexception derived from std::exception including CvbException.

If the parameter overflow is set to Scale, the resulting pixel values are divided to fit the dynamic range of the image (truncated otherwise).

◆ Multiply() [3/3]

std::unique_ptr< Image > Multiply ( const Image image1,
const Image image2,
PixelOverflow  overflow 
)
inline

Multiply the pixel values of both input images to obtain the output image.

Parameters
[in]image1Input image 1.
[in]image2Input image 2.
[in]overflowDefines how arithmetic overflow is handled.
Returns
The result image.
Exceptions
Anyexception derived from std::exception including CvbException.

If the parameter overflow is set to Scale, the resulting pixel values are divided to fit the dynamic range of the image (truncated otherwise). If the sizes of the two input images differ, the result image will contain the biggest rectangle common to both input images.

◆ Sqrt()

std::unique_ptr< Image > Sqrt ( const Image image,
SqrtPixelScaling  scaling 
)
inline

Calculates the square roots of pixel values of a source image and writes them into the destination image.

Parameters
[in]imageInput image.
[in]scalingWhether or not to scale the result.
Returns
The result image.
Exceptions
Anyexception derived from std::exception including CvbException.

If the parameter scaling is AsIs, the resulting image has pixel values as they come out of the calculation. If Yes, the results will be multiplied to fit the dynamic range of the image, effectively turning this function into a gamma correction with a gamma value of 1/2.

◆ Square()

std::unique_ptr< Image > Square ( const Image image,
PixelOverflow  overflow 
)
inline

Squares the pixel values of the input image to obtain the output image.

Parameters
[in]imageInput image.
[in]overflowDefines how arithmetic overflow is handled.
Returns
Result image.
Exceptions
Anyexception derived from std::exception including CvbException.

If the parameter overflow is set to Scale, the resulting pixel values are divided to fit the dynamic range of the image (truncated otherwise). Scaling effectively turns this function into a gamma correction with a gamma value of 2.

◆ Subtract() [1/3]

TypedRange< std::unique_ptr< Image >, double, RANGE >::type Subtract ( const Image image,
const RANGE &  values 
)
inline

Subtract constant offsets from the pixel values of the input image.

Parameters
[in]imageInput image.
[in]valuesValues to be subtracted (at least one per plane in image).
Returns
The result image.
Exceptions
Anyexception derived from std::exception including CvbException.

Negative results are saturated at DataType::MinVal.

◆ Subtract() [2/3]

std::unique_ptr< Image > Subtract ( const Image image,
double  value 
)
inline

Subtract constant offsets from the pixel values of the input image.

Parameters
[in]imageInput image.
[in]valueValue to be subtracted from each image plane.
Returns
The result image.
Exceptions
Anyexception derived from std::exception including CvbException.

Negative results are saturated at DataType::MinVal.

◆ Subtract() [3/3]

std::unique_ptr< Image > Subtract ( const Image image1,
const Image image2 
)
inline

Subtract the pixel values of image 2 from image 1 to obtain the output image.

Parameters
[in]image1Input image 1.
[in]image2Input image 2.
Returns
The result image.
Exceptions
Anyexception derived from std::exception including CvbException.

Negative results are saturated at DataType::MinVal. If the sizes of the two input images differ, the result image will contain the biggest rectangle common to both input images.

◆ SubtractAbs() [1/3]

TypedRange< std::unique_ptr< Image >, double, RANGE >::type SubtractAbs ( const Image image,
const RANGE &  values 
)
inline

Subtract constant offsets from the pixel values of the input image.

Parameters
[in]imageInput image.
[in]valuesValues to be subtracted (at least one per plane in image).
Returns
The result image.
Exceptions
Anyexception derived from std::exception including CvbException.

The stored results are the absolute value of the difference of both values.

◆ SubtractAbs() [2/3]

std::unique_ptr< Image > SubtractAbs ( const Image image,
double  value 
)
inline

Subtract constant offsets from the pixel values of the input image.

Parameters
[in]imageInput image.
[in]valueValue to be subtracted from each image plane.
Returns
The result image.
Exceptions
Anyexception derived from std::exception including CvbException.

The stored results are the absolute value of the difference of both values.

◆ SubtractAbs() [3/3]

std::unique_ptr< Image > SubtractAbs ( const Image image1,
const Image image2 
)
inline

Subtract the pixel values of image 2 from image 1 to obtain the output image.

Parameters
[in]image1Input image 1.
[in]image2Input image 2.
Returns
The result image.
Exceptions
Anyexception derived from std::exception including CvbException.

The stored results are the absolute value of the difference of both pixels. If the sizes of the two input images differ, the result image will contain the biggest rectangle common to both input images.