CVB.Net 14.0
Arithmetic Class Reference

Collection of arithmetic functions from the Foundation Package. More...

Static Public Member Functions

static Image Add (Image img1, Image img2, PixelOverflow overflow)
 Add the pixel values of both input images to obtain the output image. More...
 
static Image Multiply (Image img1, Image img2, PixelOverflow overflow)
 Multiply the pixel values of both input images to obtain the output image. More...
 
static Image Subtract (Image img1, Image img2)
 Subtract the pixel values of img2 from img1 to obtain the output image. More...
 
static Image SubtractAbs (Image img1, Image img2)
 Subtract the pixel values of img2 from img1 to obtain the output image. More...
 
static Image Divide (Image img1, Image img2, int upShift)
 Divide the pixel values of img2 by the pixel values of img2 to obtain the output image and shift them up by upShift bits to preserve information. More...
 
static Image Square (Image img, PixelOverflow overflow)
 Squares the pixel values of the input image to obtain the output image. More...
 
static Image Sqrt (Image img, SqrtPixelScaling scaling)
 Calculates the square roots of pixel values of a source image and writes them into the destination image. More...
 
static Image Absolute (Image img)
 Determines the absolute values of the pixels in the input image img . More...
 
static Image Add (Image img, double[] values, PixelOverflow overflow)
 Add constant offsets to the pixel values of the input image. More...
 
static Image Add (Image img, double value, PixelOverflow overflow)
 Add constant offsets to the pixel values of the input image. More...
 
static Image Multiply (Image img, double[] values, PixelOverflow overflow)
 Multiply constant values to the pixel values of the input image. More...
 
static Image Multiply (Image img, double value, PixelOverflow overflow)
 Multiply constant values to the pixel values of the input image. More...
 
static Image Subtract (Image img, double[] values)
 Subtract constant offsets from the pixel values of the input image. More...
 
static Image SubtractAbs (Image img, double[] values)
 Subtract constant offsets from the pixel values of the input image. More...
 
static Image Subtract (Image img, double value)
 Subtract constant offsets from the pixel values of the input image. More...
 
static Image SubtractAbs (Image img, double value)
 Subtract constant offsets from the pixel values of the input image. More...
 
static Image Divide (Image img, double[] values)
 Divide pixel values from the input image by constant values. More...
 
static Image Divide (Image img, double value)
 Divide pixel values from the input image by a constant value. More...
 

Detailed Description

Collection of arithmetic functions from the Foundation Package.

Member Function Documentation

◆ Absolute()

static Image Absolute ( Image  img)
static

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

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

Parameters
imgInput image
Returns
Result image
Exceptions
ArgumentNullExceptionIf the input img is null
ObjectDisposedExceptionIf the input img has already been disposed

◆ Add() [1/3]

static Image Add ( Image  img,
double  value,
PixelOverflow  overflow 
)
static

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

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

Parameters
imgInput image
valueValue to be added to each plane
overflowDefines how arithmetic overflow is handled.
Returns
Result image
Exceptions
ArgumentNullExceptionIf the input img is null
ObjectDisposedExceptionIf the input img has already been disposed

◆ Add() [2/3]

static Image Add ( Image  img,
double[]  values,
PixelOverflow  overflow 
)
static

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

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

Parameters
imgInput image
valuesValues to be added (at least one per plane in img
overflowDefines how arithmetic overflow is handled.
Returns
Result image
Exceptions
ArgumentNullExceptionIf the input img or values is null.
ObjectDisposedExceptionIf the input img has already been disposed.

◆ Add() [3/3]

static Image Add ( Image  img1,
Image  img2,
PixelOverflow  overflow 
)
static

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

If the parameter overflow is set to PixelOverflow.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.

Parameters
img1Input image 1
img2Input image 2
overflowDefines how arithmetic overflow is handled.
Returns
Result image
Exceptions
ArgumentNullExceptionIf the input img1 /img2 is null.
ObjectDisposedExceptionIf the input img1 /img2 has already been disposed.

◆ Divide() [1/3]

static Image Divide ( Image  img,
double  value 
)
static

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

Parameters
imgInput image
valueValue to divide each plane by
Returns
Transformed image
Exceptions
ArgumentNullExceptionIf the input img is null
ObjectDisposedExceptionIf the input img has already been disposed
CvbExceptionWhen value is 0.

◆ Divide() [2/3]

static Image Divide ( Image  img,
double[]  values 
)
static

Divide pixel values from the input image by constant values.

Parameters
imgInput image
valuesValues to divide by (at least one per plane inimg )
Returns
Result image
Exceptions
ArgumentNullExceptionIf the input img or values is null.
ObjectDisposedExceptionIf the input img has already been disposed
ArgumentExceptionWhen values contains less values than the img has planes.
CvbExceptionWhen values contains 0.

◆ Divide() [3/3]

static Image Divide ( Image  img1,
Image  img2,
int  upShift 
)
static

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

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

Parameters
img1Input image 1
img2Input image 2
upShiftResult shift parameter
Returns
Result image.
Exceptions
ArgumentNullExceptionIf the input img1 /img2 is null.
ObjectDisposedExceptionIf the input img1 /img2 has already been disposed.

◆ Multiply() [1/3]

static Image Multiply ( Image  img,
double  value,
PixelOverflow  overflow 
)
static

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

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

Parameters
imgInput image
valueValue to be multiplied to each plane
overflowDefines how arithmetic overflow is handled.
Returns
Result image
Exceptions
ArgumentNullExceptionIf the input img is null
ObjectDisposedExceptionIf the input img has already been disposed

◆ Multiply() [2/3]

static Image Multiply ( Image  img,
double[]  values,
PixelOverflow  overflow 
)
static

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

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

Parameters
imgInput image
valuesValues to be multiplied (at least one per plane inimg
overflowDefines how arithmetic overflow is handled.
Returns
Result image
Exceptions
ArgumentNullExceptionIf the input img or values is null.
ObjectDisposedExceptionIf the input img has already been disposed

◆ Multiply() [3/3]

static Image Multiply ( Image  img1,
Image  img2,
PixelOverflow  overflow 
)
static

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

If the parameter overflow is set to PixelOverflow.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.

Parameters
img1Input image 1
img2Input image 2
overflowDefines how arithmetic overflow is handled.
Returns
Result image
Exceptions
ArgumentNullExceptionIf the input img1 /img2 is null.
ObjectDisposedExceptionIf the input img1 /img2 has already been disposed.

◆ Sqrt()

static Image Sqrt ( Image  img,
SqrtPixelScaling  scaling 
)
static

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

If the parameter scaling is SqrtPixelScaling.AsIs, the resulting image has pixel values as they come out of the calculation. If SqrtPixelScaling.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.

Parameters
imgInput image
scalingWhether or not to scale the result.
Returns
Result image
Exceptions
ArgumentNullExceptionIf the input img is null
ObjectDisposedExceptionIf the input img has already been disposed

◆ Square()

static Image Square ( Image  img,
PixelOverflow  overflow 
)
static

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

If the parameter overflow is set to PixelOverflow.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.

Parameters
imgInput image
overflowDefines how arithmetic overflow is handled.
Returns
Result image
Exceptions
ArgumentNullExceptionIf the input img is null
ObjectDisposedExceptionIf the input img has already been disposed

◆ Subtract() [1/3]

static Image Subtract ( Image  img,
double  value 
)
static

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

Negative results are saturated at DataType.MinVal.

Parameters
imgInput image
valueValue to be subtracted to each plane
Returns
Result image
Exceptions
ArgumentNullExceptionIf the input img is null
ObjectDisposedExceptionIf the input img has already been disposed

◆ Subtract() [2/3]

static Image Subtract ( Image  img,
double[]  values 
)
static

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

Negative results are saturated at DataType.MinVal.

Parameters
imgInput image
valuesValues to be subtracted (at least one per plane inimg
Returns
Result image
Exceptions
ArgumentNullExceptionIf the input img or values is null.
ObjectDisposedExceptionIf the input img has already been disposed

◆ Subtract() [3/3]

static Image Subtract ( Image  img1,
Image  img2 
)
static

Subtract the pixel values of img2 from img1 to obtain the output image.

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.

Parameters
img1Input image 1
img2Input image 2
Returns
Result image.
Exceptions
ArgumentNullExceptionIf the input img1 /img2 is null.
ObjectDisposedExceptionIf the input img1 /img2 has already been disposed.

◆ SubtractAbs() [1/3]

static Image SubtractAbs ( Image  img,
double  value 
)
static

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

The stored results are the absolute value (see Math.Abs(double)) of the difference of both pixels.

Parameters
imgInput image
valueValue to be subtracted to each plane
Returns
Result image
Exceptions
ArgumentNullExceptionIf the input img is null
ObjectDisposedExceptionIf the input img has already been disposed

◆ SubtractAbs() [2/3]

static Image SubtractAbs ( Image  img,
double[]  values 
)
static

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

The stored results are the absolute value (see Math.Abs(double)) of the difference of both pixels.

Parameters
imgInput image
valuesValues to be subtracted (at least one per plane inimg
Returns
Result image
Exceptions
ArgumentNullExceptionIf the input img or values is null.
ObjectDisposedExceptionIf the input img has already been disposed

◆ SubtractAbs() [3/3]

static Image SubtractAbs ( Image  img1,
Image  img2 
)
static

Subtract the pixel values of img2 from img1 to obtain the output image.

The stored results are the absolute value (see Math.Abs(double)) 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.

Parameters
img1Input image 1
img2Input image 2
Returns
Result image.
Exceptions
ArgumentNullExceptionIf the input img1 /img2 is null.
ObjectDisposedExceptionIf the input img1 /img2 has already been disposed.