Table of Contents

Class Image<TColor, TDepth>

Namespace
Emgu.CV
Assembly
Emgu.CV.dll

An Image is a wrapper to IplImage of OpenCV.

public class Image<TColor, TDepth> : CvArray<TDepth>, IXmlSerializable, ISerializable, IEquatable<Image<TColor, TDepth>>, IInputOutputArray, IInputArrayOfArrays, IOutputArrayOfArrays, IOutputArray, IInputArray, IDisposable where TColor : struct, IColor where TDepth : new()

Type Parameters

TColor

Color type of this image (either Gray, Bgr, Bgra, Hsv, Hls, Lab, Luv, Xyz, Ycc, Rgb or Rbga)

TDepth

Depth of this image (either Byte, SByte, Single, double, UInt16, Int16 or Int32)

Inheritance
CvArray<TDepth>
Image<TColor, TDepth>
Implements
IXmlSerializable
IEquatable<Image<TColor, TDepth>>
Derived
Inherited Members
Extension Methods

Constructors

Image()

Create an empty Image

protected Image()

Image(Image<Gray, TDepth>[])

Create a multi-channel image from multiple gray scale images

public Image(Image<Gray, TDepth>[] channels)

Parameters

channels Image<Gray, TDepth>[]

The image channels to be merged into a single image

Image(Mat)

Create an Image by copying data from a Mat.

public Image(Mat mat)

Parameters

mat Mat

The Mat to copy pixel data from

Image(Size)

Create a blank Image of the specific size

public Image(Size size)

Parameters

size Size

The size of the image

Image(int, int)

Create a blank Image of the specified width and height.

public Image(int width, int height)

Parameters

width int

The width of the image

height int

The height of the image

Image(int, int, int, nint)

Create an Image from unmanaged data.

public Image(int width, int height, int stride, nint scan0)

Parameters

width int

The width of the image

height int

The height of the image

stride int

Size of aligned image row in bytes

scan0 nint

Pointer to aligned image data, where each row should be 4-align

Remarks

The caller is responsible for allocating and freeing the block of memory specified by the scan0 parameter, however, the memory should not be released until the related Image is released.

Image(int, int, TColor)

Create a blank Image of the specified width, height and color.

public Image(int width, int height, TColor value)

Parameters

width int

The width of the image

height int

The height of the image

value TColor

The initial color of the image

Image(SerializationInfo, StreamingContext)

Constructor used to deserialize runtime serialized object

public Image(SerializationInfo info, StreamingContext context)

Parameters

info SerializationInfo

The serialization info

context StreamingContext

The streaming context

Image(string)

Read image from a file

public Image(string fileName)

Parameters

fileName string

the name of the file that contains the image

Image(TDepth[,,])

Create image from the specific multi-dimensional data, where the 1st dimension is # of rows (height), the 2nd dimension is # cols (width) and the 3rd dimension is the channel

public Image(TDepth[,,] data)

Parameters

data TDepth[,,]

The multi-dimensional data where the 1st dimension is # of rows (height), the 2nd dimension is # cols (width) and the 3rd dimension is the channel

Properties

CvDepth

Get the equivalent opencv depth type for this image

public static IplDepth CvDepth { get; }

Property Value

IplDepth

Data

Get or Set the data for this matrix. The Get function has O(1) complexity. The Set function make a copy of the data

public TDepth[,,] Data { get; set; }

Property Value

TDepth[,,]

Remarks

If the image contains Byte and width is not a multiple of 4. The second dimension of the array might be larger than the Width of this image.
This is necessary since the length of a row need to be 4 align for OpenCV optimization. The Set function always make a copy of the specific value. If the image contains Byte and width is not a multiple of 4. The second dimension of the array created might be larger than the Width of this image.

IsROISet

Indicates if the region of interest has been set

public bool IsROISet { get; }

Property Value

bool

this[Point]

Get or Set the color in the location

public TColor this[Point location] { get; set; }

Parameters

location Point

the location of the pixel

Property Value

TColor

the color in the location

this[int]

Get or Set the specific channel of the current image. For Get operation, a copy of the specific channel is returned. For Set operation, the specific channel is copied to this image.

public Image<Gray, TDepth> this[int channel] { get; set; }

Parameters

channel int

The channel to get from the current image, zero based index

Property Value

Image<Gray, TDepth>

The specific channel of the current image

this[int, int]

Get or Set the color in the rowth row (y direction) and columnth column (x direction)

public TColor this[int row, int column] { get; set; }

Parameters

row int

The zero-based row (y direction) of the pixel

column int

The zero-based column (x direction) of the pixel

Property Value

TColor

The color in the specific row and column

MIplImage

The IplImage structure

public MIplImage MIplImage { get; }

Property Value

MIplImage

ManagedArray

Get the underneath managed array

public override Array ManagedArray { get; set; }

Property Value

Array

NumberOfChannels

Get the number of channels for this image

public override int NumberOfChannels { get; }

Property Value

int

ROI

Get or Set the region of interest for this image. To clear the ROI, set it to System.Drawing.Rectangle.Empty

public Rectangle ROI { get; set; }

Property Value

Rectangle

Size

Get the size of the array

public override Size Size { get; }

Property Value

Size

Methods

AbsDiff(Image<TColor, TDepth>)

Computes absolute different between this image and the other image

public Image<TColor, TDepth> AbsDiff(Image<TColor, TDepth> img2)

Parameters

img2 Image<TColor, TDepth>

The other image to compute absolute different with

Returns

Image<TColor, TDepth>

The image that contains the absolute different value

AbsDiff(TColor)

Computes absolute different between this image and the specific color

[ExposableMethod(Exposable = true, Category = "Math")]
public Image<TColor, TDepth> AbsDiff(TColor color)

Parameters

color TColor

The color to compute absolute different with

Returns

Image<TColor, TDepth>

The image that contains the absolute different value

Accumulate(Image<TColor, TDepth>)

Accumulate img2 to the current image using the specific mask

public void Accumulate(Image<TColor, TDepth> img2)

Parameters

img2 Image<TColor, TDepth>

The image to be added to the current image

Accumulate(Image<TColor, TDepth>, Image<Gray, byte>)

Accumulate img2 to the current image using the specific mask

public void Accumulate(Image<TColor, TDepth> img2, Image<Gray, byte> mask)

Parameters

img2 Image<TColor, TDepth>

The image to be added to the current image

mask Image<Gray, byte>

the mask

AccumulateWeighted(Image<TColor, TDepth>, double, Image<Gray, byte>)

Update Running Average. this = (1-alpha)this + alphaimg, using the mask

public void AccumulateWeighted(Image<TColor, TDepth> img, double alpha, Image<Gray, byte> mask = null)

Parameters

img Image<TColor, TDepth>

Input image, 1- or 3-channel, Byte or Single (each channel of multi-channel image is processed independently).

alpha double

The weight of img

mask Image<Gray, byte>

The mask for the running average

Action(Action<TDepth>)

perform an generic action based on each element of the image

public void Action(Action<TDepth> action)

Parameters

action Action<TDepth>

The action to be applied to each element of the image

Action<TOtherDepth>(Image<TColor, TOtherDepth>, Action<TDepth, TOtherDepth>)

Perform an generic operation based on the elements of the two images

public void Action<TOtherDepth>(Image<TColor, TOtherDepth> img2, Action<TDepth, TOtherDepth> action) where TOtherDepth : new()

Parameters

img2 Image<TColor, TOtherDepth>

The second image to perform action on

action Action<TDepth, TOtherDepth>

An action such that the first parameter is the a single channel of a pixel from the first image, the second parameter is the corresponding channel of the correspondind pixel from the second image

Type Parameters

TOtherDepth

The depth of the second image

Add(Image<TColor, TDepth>)

Elementwise add another image with the current image

public Image<TColor, TDepth> Add(Image<TColor, TDepth> img2)

Parameters

img2 Image<TColor, TDepth>

The image to be added to the current image

Returns

Image<TColor, TDepth>

The result of elementwise adding img2 to the current image

Add(Image<TColor, TDepth>, Image<Gray, byte>)

Elementwise add img2 with the current image, using a mask

public Image<TColor, TDepth> Add(Image<TColor, TDepth> img2, Image<Gray, byte> mask)

Parameters

img2 Image<TColor, TDepth>

The image to be added to the current image

mask Image<Gray, byte>

The mask for the add operation

Returns

Image<TColor, TDepth>

The result of elementwise adding img2 to the current image, using the specific mask

Add(TColor)

Elementwise add a color val to the current image

[ExposableMethod(Exposable = true, Category = "Math")]
public Image<TColor, TDepth> Add(TColor val)

Parameters

val TColor

The color value to be added to the current image

Returns

Image<TColor, TDepth>

The result of elementwise adding color val from the current image

AddWeighted(Image<TColor, TDepth>, double, double, double)

Return the weighted sum such that: res = this * alpha + img2 * beta + gamma

public Image<TColor, TDepth> AddWeighted(Image<TColor, TDepth> img2, double alpha, double beta, double gamma)

Parameters

img2 Image<TColor, TDepth>

img2 in: res = this * alpha + img2 * beta + gamma

alpha double

alpha in: res = this * alpha + img2 * beta + gamma

beta double

beta in: res = this * alpha + img2 * beta + gamma

gamma double

gamma in: res = this * alpha + img2 * beta + gamma

Returns

Image<TColor, TDepth>

this * alpha + img2 * beta + gamma

AllocateData(int, int, int)

Re-allocate data for the array

protected override void AllocateData(int rows, int cols, int numberOfChannels)

Parameters

rows int

The number of rows

cols int

The number of columns

numberOfChannels int

The number of channels of this image

And(Image<TColor, TDepth>)

Perform an elementwise AND operation with another image and return the result

public Image<TColor, TDepth> And(Image<TColor, TDepth> img2)

Parameters

img2 Image<TColor, TDepth>

The second image for the AND operation

Returns

Image<TColor, TDepth>

The result of the AND operation

And(Image<TColor, TDepth>, Image<Gray, byte>)

Perform an elementwise AND operation with another image, using a mask, and return the result

public Image<TColor, TDepth> And(Image<TColor, TDepth> img2, Image<Gray, byte> mask)

Parameters

img2 Image<TColor, TDepth>

The second image for the AND operation

mask Image<Gray, byte>

The mask for the AND operation

Returns

Image<TColor, TDepth>

The result of the AND operation

And(TColor)

Perform an binary AND operation with some color

public Image<TColor, TDepth> And(TColor val)

Parameters

val TColor

The color for the AND operation

Returns

Image<TColor, TDepth>

The result of the AND operation

And(TColor, Image<Gray, byte>)

Perform an binary AND operation with some color using a mask

public Image<TColor, TDepth> And(TColor val, Image<Gray, byte> mask)

Parameters

val TColor

The color for the AND operation

mask Image<Gray, byte>

The mask for the AND operation

Returns

Image<TColor, TDepth>

The result of the AND operation

AvgSdv(out TColor, out MCvScalar)

Calculates the average value and standard deviation of array elements, independently for each channel

public void AvgSdv(out TColor avg, out MCvScalar sdv)

Parameters

avg TColor

The avg color

sdv MCvScalar

The standard deviation for each channel

AvgSdv(out TColor, out MCvScalar, Image<Gray, byte>)

Calculates the average value and standard deviation of array elements, independently for each channel

public void AvgSdv(out TColor average, out MCvScalar sdv, Image<Gray, byte> mask)

Parameters

average TColor

The avg color

sdv MCvScalar

The standard deviation for each channel

mask Image<Gray, byte>

The operation mask

BuildPyramid(int)

Compute the image pyramid

public Image<TColor, TDepth>[] BuildPyramid(int maxLevel)

Parameters

maxLevel int

The number of level's for the pyramid; Level 0 referes to the current image, level n is computed by calling the PyrDown() function on level n-1

Returns

Image<TColor, TDepth>[]

The image pyramid

Canny(double, double)

Find the edges on this image and marked them in the returned image.

[ExposableMethod(Exposable = true, Category = "Gradients, Edges")]
public Image<Gray, byte> Canny(double thresh, double threshLinking)

Parameters

thresh double

The threshhold to find initial segments of strong edges

threshLinking double

The threshold used for edge Linking

Returns

Image<Gray, byte>

The edges found by the Canny edge detector

Canny(double, double, int, bool)

Find the edges on this image and marked them in the returned image.

public Image<Gray, byte> Canny(double thresh, double threshLinking, int apertureSize, bool l2Gradient)

Parameters

thresh double

The threshhold to find initial segments of strong edges

threshLinking double

The threshold used for edge Linking

apertureSize int

The aperture size, use 3 for default

l2Gradient bool

a flag, indicating whether a more accurate norm should be used to calculate the image gradient magnitude ( L2gradient=true ), or whether the default norm is enough ( L2gradient=false ).

Returns

Image<Gray, byte>

The edges found by the Canny edge detector

Clone()

Make a clone of the current image. All image data as well as the COI and ROI are cloned

public Image<TColor, TDepth> Clone()

Returns

Image<TColor, TDepth>

A clone of the current image. All image data as well as the COI and ROI are cloned

Cmp(Image<TColor, TDepth>, CmpType)

Compare the current image with img2 and returns the comparison mask

public Image<TColor, byte> Cmp(Image<TColor, TDepth> img2, CmpType cmpType)

Parameters

img2 Image<TColor, TDepth>

The other image to compare with

cmpType CmpType

The comparison type

Returns

Image<TColor, byte>

The result of the comparison as a mask

Cmp(double, CmpType)

Compare the current image with value and returns the comparison mask

[ExposableMethod(Exposable = true, Category = "Logic")]
public Image<TColor, byte> Cmp(double value, CmpType comparisonType)

Parameters

value double

The value to compare with

comparisonType CmpType

The comparison type

Returns

Image<TColor, byte>

The result of the comparison as a mask

ConcateHorizontal(Image<TColor, TDepth>)

Concate the current image with another image horizontally.

public Image<TColor, TDepth> ConcateHorizontal(Image<TColor, TDepth> otherImage)

Parameters

otherImage Image<TColor, TDepth>

The other image to concate

Returns

Image<TColor, TDepth>

A new image that is the horizontal concatening of this image and otherImage

ConcateVertical(Image<TColor, TDepth>)

Concate the current image with another image vertically.

public Image<TColor, TDepth> ConcateVertical(Image<TColor, TDepth> otherImage)

Parameters

otherImage Image<TColor, TDepth>

The other image to concate

Returns

Image<TColor, TDepth>

A new image that is the vertical concatening of this image and otherImage

ConvertFrom(IInputArray)

Convert the source image to the current image, if the size are different, the current image will be a resized version of the srcImage.

public void ConvertFrom(IInputArray srcImage)

Parameters

srcImage IInputArray

The sourceImage

ConvertFrom<TSrcColor, TSrcDepth>(Image<TSrcColor, TSrcDepth>)

Convert the source image to the current image, if the size are different, the current image will be a resized version of the srcImage.

public void ConvertFrom<TSrcColor, TSrcDepth>(Image<TSrcColor, TSrcDepth> srcImage) where TSrcColor : struct, IColor where TSrcDepth : new()

Parameters

srcImage Image<TSrcColor, TSrcDepth>

The sourceImage

Type Parameters

TSrcColor

The color type of the source image

TSrcDepth

The color depth of the source image

ConvertScale<TOtherDepth>(double, double)

Convert the current image to the specific depth, at the same time scale and shift the values of the pixel

public Image<TColor, TOtherDepth> ConvertScale<TOtherDepth>(double scale, double shift) where TOtherDepth : new()

Parameters

scale double

The value to be multiplied with the pixel

shift double

The value to be added to the pixel

Returns

Image<TColor, TOtherDepth>

Image of the specific depth, val = val * scale + shift

Type Parameters

TOtherDepth

The type of depth to convert to

Convert<TOtherDepth>(Func<TDepth, int, int, TOtherDepth>)

Compute the element of a new image based on the value as well as the x and y positions of each pixel on the image

public Image<TColor, TOtherDepth> Convert<TOtherDepth>(Func<TDepth, int, int, TOtherDepth> converter) where TOtherDepth : new()

Parameters

converter Func<TDepth, int, int, TOtherDepth>

The function to be applied to the image pixels

Returns

Image<TColor, TOtherDepth>

The result image

Type Parameters

TOtherDepth

The depth type to convert the image to.

Convert<TOtherDepth>(Func<TDepth, TOtherDepth>)

Compute the element of the new image based on element of this image

public Image<TColor, TOtherDepth> Convert<TOtherDepth>(Func<TDepth, TOtherDepth> converter) where TOtherDepth : new()

Parameters

converter Func<TDepth, TOtherDepth>

The function to be applied to the image pixels

Returns

Image<TColor, TOtherDepth>

The result image

Type Parameters

TOtherDepth

The depth type of the result image

Convert<TOtherColor, TOtherDepth>()

Convert the current image to the specific color and depth

[ExposableMethod(Exposable = true, Category = "Conversion", GenericParametersOptions = new Type[] { typeof(Bgr), typeof(Bgra), typeof(Gray), typeof(Hsv), typeof(Hls), typeof(Lab), typeof(Luv), typeof(Xyz), typeof(Ycc), typeof(float), typeof(byte), typeof(double) }, GenericParametersOptionSizes = new int[] { 9, 3 })]
public Image<TOtherColor, TOtherDepth> Convert<TOtherColor, TOtherDepth>() where TOtherColor : struct, IColor where TOtherDepth : new()

Returns

Image<TOtherColor, TOtherDepth>

Image of the specific color and depth

Type Parameters

TOtherColor

The type of color to be converted to

TOtherDepth

The type of pixel depth to be converted to

Convert<TDepth2, TDepth3>(Image<TColor, TDepth2>, Func<TDepth, TDepth2, TDepth3>)

Compute the element of the new image based on the elements of the two image

public Image<TColor, TDepth3> Convert<TDepth2, TDepth3>(Image<TColor, TDepth2> img2, Func<TDepth, TDepth2, TDepth3> converter) where TDepth2 : new() where TDepth3 : new()

Parameters

img2 Image<TColor, TDepth2>

The second image

converter Func<TDepth, TDepth2, TDepth3>

The function to be applied to the image pixels

Returns

Image<TColor, TDepth3>

The result image

Type Parameters

TDepth2

The depth type of img2

TDepth3

The depth type of the result image

Convert<TDepth2, TDepth3, TDepth4>(Image<TColor, TDepth2>, Image<TColor, TDepth3>, Func<TDepth, TDepth2, TDepth3, TDepth4>)

Compute the element of the new image based on the elements of the three image

public Image<TColor, TDepth4> Convert<TDepth2, TDepth3, TDepth4>(Image<TColor, TDepth2> img2, Image<TColor, TDepth3> img3, Func<TDepth, TDepth2, TDepth3, TDepth4> converter) where TDepth2 : new() where TDepth3 : new() where TDepth4 : new()

Parameters

img2 Image<TColor, TDepth2>

The second image

img3 Image<TColor, TDepth3>

The third image

converter Func<TDepth, TDepth2, TDepth3, TDepth4>

The function to be applied to the image pixels

Returns

Image<TColor, TDepth4>

The result image

Type Parameters

TDepth2

The depth type of img2

TDepth3

The depth type of img3

TDepth4

The depth type of the result image

Convert<TDepth2, TDepth3, TDepth4, TDepth5>(Image<TColor, TDepth2>, Image<TColor, TDepth3>, Image<TColor, TDepth4>, Func<TDepth, TDepth2, TDepth3, TDepth4, TDepth5>)

Compute the element of the new image based on the elements of the four image

public Image<TColor, TDepth5> Convert<TDepth2, TDepth3, TDepth4, TDepth5>(Image<TColor, TDepth2> img2, Image<TColor, TDepth3> img3, Image<TColor, TDepth4> img4, Func<TDepth, TDepth2, TDepth3, TDepth4, TDepth5> converter) where TDepth2 : new() where TDepth3 : new() where TDepth4 : new() where TDepth5 : new()

Parameters

img2 Image<TColor, TDepth2>

The second image

img3 Image<TColor, TDepth3>

The third image

img4 Image<TColor, TDepth4>

The fourth image

converter Func<TDepth, TDepth2, TDepth3, TDepth4, TDepth5>

The function to be applied to the image pixels

Returns

Image<TColor, TDepth5>

The result image

Type Parameters

TDepth2

The depth type of img2

TDepth3

The depth type of img3

TDepth4

The depth type of img4

TDepth5

The depth type of the result image

Convolution(ConvolutionKernelF, double, BorderType)

Performs a convolution using the specific kernel

public Image<TColor, float> Convolution(ConvolutionKernelF kernel, double delta = 0, BorderType borderType = BorderType.Default)

Parameters

kernel ConvolutionKernelF

The convolution kernel

delta double

The optional value added to the filtered pixels before storing them in dst

borderType BorderType

The pixel extrapolation method.

Returns

Image<TColor, float>

The result of the convolution

Copy(Image<Gray, byte>)

Make a copy of the image using a mask, if ROI is set, only copy the ROI

public Image<TColor, TDepth> Copy(Image<Gray, byte> mask = null)

Parameters

mask Image<Gray, byte>

the mask for coping

Returns

Image<TColor, TDepth>

A copy of the image

Copy(Image<TColor, TDepth>, Image<Gray, byte>)

Copy the masked area of this image to destination

public void Copy(Image<TColor, TDepth> dest, Image<Gray, byte> mask)

Parameters

dest Image<TColor, TDepth>

the destination to copy to

mask Image<Gray, byte>

the mask for copy

Copy(RotatedRect)

Get a copy of the boxed region of the image

public Image<TColor, TDepth> Copy(RotatedRect box)

Parameters

box RotatedRect

The boxed region of the image

Returns

Image<TColor, TDepth>

A copy of the boxed region of the image

Copy(Rectangle)

Make a copy of the specific ROI (Region of Interest) from the image

public Image<TColor, TDepth> Copy(Rectangle roi)

Parameters

roi Rectangle

The roi to be copied

Returns

Image<TColor, TDepth>

The region of interest

CopyBlank()

Create an image of the same size

public Image<TColor, TDepth> CopyBlank()

Returns

Image<TColor, TDepth>

The image of the same size

Remarks

The initial pixel in the image equals zero

CountNonzero()

Count the non Zero elements for each channel

public int[] CountNonzero()

Returns

int[]

Count the non Zero elements for each channel

Dilate(int)

Dilates this image using a 3x3 rectangular structuring element. Dilation are applied several (iterations) times

public Image<TColor, TDepth> Dilate(int iterations)

Parameters

iterations int

The number of dilate iterations

Returns

Image<TColor, TDepth>

The dilated image

DisposeObject()

Release all unmanaged memory associate with the image

protected override void DisposeObject()

Draw(IConvexPolygonF, TColor, int)

Draw a convex polygon using the specific color and thickness

public virtual void Draw(IConvexPolygonF polygon, TColor color, int thickness)

Parameters

polygon IConvexPolygonF

The convex polygon to be drawn

color TColor

The color of the triangle

thickness int

If thickness is less than 1, the triangle is filled up

Draw(IInputArrayOfArrays, int, TColor, int, LineType, IInputArray, int, Point)

Draws contour outlines in the image if thickness>=0 or fills area bounded by the contours if thickness<0

public void Draw(IInputArrayOfArrays contours, int contourIdx, TColor color, int thickness = 1, LineType lineType = LineType.EightConnected, IInputArray hierarchy = null, int maxLevel = 2147483647, Point offset = default)

Parameters

contours IInputArrayOfArrays

All the input contours. Each contour is stored as a point vector.

contourIdx int

Parameter indicating a contour to draw. If it is negative, all the contours are drawn.

color TColor

Color of the contours

thickness int

Thickness of lines the contours are drawn with. If it is negative the contour interiors are drawn

lineType LineType

Type of the contour segments

hierarchy IInputArray

Optional information about hierarchy. It is only needed if you want to draw only some of the contours

maxLevel int

Maximal level for drawn contours. If 0, only contour is drawn. If 1, the contour and all contours after it on the same level are drawn. If 2, all contours after and all contours one level below the contours are drawn, etc. If the value is negative, the function does not draw the contours following after contour but draws child contours of contour up to abs(maxLevel)-1 level.

offset Point

Shift all the point coordinates by the specified value. It is useful in case if the contours retrieved in some image ROI and then the ROI offset needs to be taken into account during the rendering.

Draw(CircleF, TColor, int, LineType, int)

Draw a Circle of the specific color and thickness

public virtual void Draw(CircleF circle, TColor color, int thickness = 1, LineType lineType = LineType.EightConnected, int shift = 0)

Parameters

circle CircleF

The circle to be drawn

color TColor

The color of the circle

thickness int

If thickness is less than 1, the circle is filled up

lineType LineType

Line type

shift int

Number of fractional bits in the center coordinates and radius value

Draw(Cross2DF, TColor, int)

Draw a 2D Cross using the specific color and thickness

public void Draw(Cross2DF cross, TColor color, int thickness)

Parameters

cross Cross2DF

The 2D Cross to be drawn

color TColor

The color of the cross

thickness int

Must be > 0

Draw(Ellipse, TColor, int, LineType)

Draw a Ellipse of the specific color and thickness

public void Draw(Ellipse ellipse, TColor color, int thickness = 1, LineType lineType = LineType.EightConnected)

Parameters

ellipse Ellipse

The ellipse to be draw

color TColor

The color of the ellipse

thickness int

If thickness is less than 1, the ellipse is filled up

lineType LineType

Line type

Draw(LineSegment2D, TColor, int, LineType, int)

Draw a line segment using the specific color and thickness

public virtual void Draw(LineSegment2D line, TColor color, int thickness, LineType lineType = LineType.EightConnected, int shift = 0)

Parameters

line LineSegment2D

The line segment to be drawn

color TColor

The color of the line segment

thickness int

The thickness of the line segment

lineType LineType

Line type

shift int

Number of fractional bits in the center coordinates and radius value

Draw(LineSegment2DF, TColor, int, LineType, int)

Draw a line segment using the specific color and thickness

public virtual void Draw(LineSegment2DF line, TColor color, int thickness, LineType lineType = LineType.EightConnected, int shift = 0)

Parameters

line LineSegment2DF

The line segment to be drawn

color TColor

The color of the line segment

thickness int

The thickness of the line segment

lineType LineType

Line type

shift int

Number of fractional bits in the center coordinates and radius value

Draw(Point[], TColor, int, LineType, Point)

Draws contour outlines in the image if thickness>=0 or fills area bounded by the contours if thickness<0

public void Draw(Point[] contours, TColor color, int thickness = 1, LineType lineType = LineType.EightConnected, Point offset = default)

Parameters

contours Point[]

The input contour stored as a point vector.

color TColor

Color of the contours

thickness int

Thickness of lines the contours are drawn with. If it is negative the contour interiors are drawn

lineType LineType

Type of the contour segments

offset Point

Shift all the point coordinates by the specified value. It is useful in case if the contours retrieved in some image ROI and then the ROI offset needs to be taken into account during the rendering.

Draw(Rectangle, TColor, int, LineType, int)

Draw an Rectangle of the specific color and thickness

public virtual void Draw(Rectangle rect, TColor color, int thickness = 1, LineType lineType = LineType.EightConnected, int shift = 0)

Parameters

rect Rectangle

The rectangle to be drawn

color TColor

The color of the rectangle

thickness int

If thickness is less than 1, the rectangle is filled up

lineType LineType

Line type

shift int

Number of fractional bits in the center coordinates and radius value

Draw(string, Point, FontFace, double, TColor, int, LineType, bool)

Draw the text using the specific font on the image

public virtual void Draw(string message, Point bottomLeft, FontFace fontFace, double fontScale, TColor color, int thickness = 1, LineType lineType = LineType.EightConnected, bool bottomLeftOrigin = false)

Parameters

message string

The text message to be draw

bottomLeft Point

The location of the bottom left corner of the font

fontFace FontFace

Font type.

fontScale double

Font scale factor that is multiplied by the font-specific base size.

color TColor

The color of the text

thickness int

Thickness of the lines used to draw a text.

lineType LineType

Line type

bottomLeftOrigin bool

When true, the image data origin is at the bottom-left corner. Otherwise, it is at the top-left corner.

DrawPolyline(Point[], bool, TColor, int, LineType, int)

Draw the polyline defined by the array of 2D points

public void DrawPolyline(Point[] pts, bool isClosed, TColor color, int thickness = 1, LineType lineType = LineType.EightConnected, int shift = 0)

Parameters

pts Point[]

A polyline defined by its point

isClosed bool

if true, the last line segment is defined by the last point of the array and the first point of the array

color TColor

the color used for drawing

thickness int

the thinkness of the line

lineType LineType

Line type

shift int

Number of fractional bits in the center coordinates and radius value

DrawPolyline(Point[][], bool, TColor, int, LineType, int)

Draw the polylines defined by the array of array of 2D points

public void DrawPolyline(Point[][] pts, bool isClosed, TColor color, int thickness = 1, LineType lineType = LineType.EightConnected, int shift = 0)

Parameters

pts Point[][]

An array of polylines each represented by an array of points

isClosed bool

if true, the last line segment is defined by the last point of the array and the first point of the array

color TColor

the color used for drawing

thickness int

the thickness of the line

lineType LineType

Line type

shift int

Number of fractional bits in the center coordinates and radius value

Equals(Image<TColor, TDepth>)

Compare two images, returns true if each of the pixels are equal, false otherwise

public bool Equals(Image<TColor, TDepth> img2)

Parameters

img2 Image<TColor, TDepth>

The other image to compare with

Returns

bool

true if each of the pixels for the two images are equal, false otherwise

Erode(int)

Erodes this image using a 3x3 rectangular structuring element. Erosion are applied several (iterations) times

public Image<TColor, TDepth> Erode(int iterations)

Parameters

iterations int

The number of erode iterations

Returns

Image<TColor, TDepth>

The eroded image

Exp()

Calculates exponent of every element of input array: dst(I)=exp(src(I))

[ExposableMethod(Exposable = true, Category = "Math")]
public Image<TColor, TDepth> Exp()

Returns

Image<TColor, TDepth>

The exponent image

Remarks

Maximum relative error is ~7e-6. Currently, the function converts denormalized values to zeros on output.

FillConvexPoly(Point[], TColor, LineType, int)

Fill the convex polygon with the specific color

public void FillConvexPoly(Point[] pts, TColor color, LineType lineType = LineType.EightConnected, int shift = 0)

Parameters

pts Point[]

The array of points that define the convex polygon

color TColor

The color to fill the polygon with

lineType LineType

Line type

shift int

Number of fractional bits in the center coordinates and radius value

FindCornerSubPix(PointF[][], Size, Size, MCvTermCriteria)

Iterates to find the sub-pixel accurate location of corners, or radial saddle points

public void FindCornerSubPix(PointF[][] corners, Size win, Size zeroZone, MCvTermCriteria criteria)

Parameters

corners PointF[][]

Coordinates of the input corners, the values will be modified by this function call

win Size

Half sizes of the search window. For example, if win=(5,5) then 52+1 x 52+1 = 11 x 11 search window is used

zeroZone Size

Half size of the dead region in the middle of the search zone over which the summation in formulae below is not done. It is used sometimes to avoid possible singularities of the autocorrelation matrix. The value of (-1,-1) indicates that there is no such size

criteria MCvTermCriteria

Criteria for termination of the iterative process of corner refinement. That is, the process of corner position refinement stops either after certain number of iteration or when a required accuracy is achieved. The criteria may specify either of or both the maximum number of iteration and the required accuracy

Flip(FlipType)

Return a flipped copy of the current image

public Image<TColor, TDepth> Flip(FlipType flipType)

Parameters

flipType FlipType

The type of the flipping

Returns

Image<TColor, TDepth>

The flipped copy of this image

FromIplImagePtr(nint)

Get the managed image from an unmanaged IplImagePointer

public static Image<TColor, TDepth> FromIplImagePtr(nint iplImage)

Parameters

iplImage nint

The pointer to the iplImage

Returns

Image<TColor, TDepth>

The managed image from the iplImage pointer

GetAverage()

Get the average value on this image

public TColor GetAverage()

Returns

TColor

The average color of the image

GetAverage(Image<Gray, byte>)

Get the average value on this image, using the specific mask

public TColor GetAverage(Image<Gray, byte> mask)

Parameters

mask Image<Gray, byte>

The mask for find the average value

Returns

TColor

The average color of the masked area

GetMoments(bool)

Calculates spatial and central moments up to the third order and writes them to moments. The moments may be used then to calculate gravity center of the shape, its area, main axises and various shape characteristics including 7 Hu invariants.

public Moments GetMoments(bool binary)

Parameters

binary bool

If the flag is true, all the zero pixel values are treated as zeroes, all the others are treated as 1's

Returns

Moments

spatial and central moments up to the third order

GetObjectData(SerializationInfo, StreamingContext)

A function used for runtime serialization of the object

public override void GetObjectData(SerializationInfo info, StreamingContext context)

Parameters

info SerializationInfo

Serialization info

context StreamingContext

streaming context

GetSubRect(Rectangle)

Get a subimage which image data is shared with the current image.

public Image<TColor, TDepth> GetSubRect(Rectangle rect)

Parameters

rect Rectangle

The rectangle area of the sub-image

Returns

Image<TColor, TDepth>

A subimage which image data is shared with the current image

GetSum()

Get the sum for each color channel

public TColor GetSum()

Returns

TColor

The sum for each color channel

GrabCut(Rectangle, int)

Use grabcut to perform background foreground segmentation.

public Image<Gray, byte> GrabCut(Rectangle rect, int iteration)

Parameters

rect Rectangle

The initial rectangle region for the foreground

iteration int

The number of iterations to run GrabCut

Returns

Image<Gray, byte>

The background foreground mask where 2 indicates background and 3 indicates foreground

HoughCircles(TColor, TColor, double, double, int, int)

First apply Canny Edge Detector on the current image, then apply Hough transform to find circles

public CircleF[][] HoughCircles(TColor cannyThreshold, TColor accumulatorThreshold, double dp, double minDist, int minRadius = 0, int maxRadius = 0)

Parameters

cannyThreshold TColor

The higher threshold of the two passed to Canny edge detector (the lower one will be twice smaller).

accumulatorThreshold TColor

Accumulator threshold at the center detection stage. The smaller it is, the more false circles may be detected. Circles, corresponding to the larger accumulator values, will be returned first

dp double

Resolution of the accumulator used to detect centers of the circles. For example, if it is 1, the accumulator will have the same resolution as the input image, if it is 2 - accumulator will have twice smaller width and height, etc

minDist double

Minimum distance between centers of the detected circles. If the parameter is too small, multiple neighbor circles may be falsely detected in addition to a true one. If it is too large, some circles may be missed

minRadius int

Minimal radius of the circles to search for

maxRadius int

Maximal radius of the circles to search for

Returns

CircleF[][]

The circle detected for each of the channels

HoughLines(double, double, double, double, int, double, double)

Apply Canny Edge Detector follows by Probabilistic Hough transform to find line segments in the image

public LineSegment2D[][] HoughLines(double cannyThreshold, double cannyThresholdLinking, double rhoResolution, double thetaResolution, int threshold, double minLineWidth, double gapBetweenLines)

Parameters

cannyThreshold double

The threshold to find initial segments of strong edges

cannyThresholdLinking double

The threshold used for edge Linking

rhoResolution double

Distance resolution in pixel-related units.

thetaResolution double

Angle resolution measured in radians

threshold int

A line is returned by the function if the corresponding accumulator value is greater than threshold

minLineWidth double

Minimum width of a line

gapBetweenLines double

Minimum gap between lines

Returns

LineSegment2D[][]

The line segments detected for each of the channels

HoughLinesBinary(double, double, int, double, double)

Apply Probabilistic Hough transform to find line segments. The current image must be a binary image (eg. the edges as a result of the Canny edge detector)

public LineSegment2D[][] HoughLinesBinary(double rhoResolution, double thetaResolution, int threshold, double minLineWidth, double gapBetweenLines)

Parameters

rhoResolution double

Distance resolution in pixel-related units.

thetaResolution double

Angle resolution measured in radians

threshold int

A line is returned by the function if the corresponding accumulator value is greater than threshold

minLineWidth double

Minimum width of a line

gapBetweenLines double

Minimum gap between lines

Returns

LineSegment2D[][]

The line segments detected for each of the channels

InPaint(Image<Gray, byte>, double)

Use inpaint to recover the intensity of the pixels which location defined by mask on this image

public Image<TColor, TDepth> InPaint(Image<Gray, byte> mask, double radius)

Parameters

mask Image<Gray, byte>

The inpainting mask. Non-zero pixels indicate the area that needs to be inpainted

radius double

The radius of circular neighborhood of each point inpainted that is considered by the algorithm

Returns

Image<TColor, TDepth>

The inpainted image

InRange(Image<TColor, TDepth>, Image<TColor, TDepth>)

Checks that image elements lie between values defined by two images of same size and type

public Image<Gray, byte> InRange(Image<TColor, TDepth> lower, Image<TColor, TDepth> higher)

Parameters

lower Image<TColor, TDepth>

The inclusive lower limit of color value

higher Image<TColor, TDepth>

The inclusive upper limit of color value

Returns

Image<Gray, byte>

res[i,j] = 255 if lower[i,j] <= this[i,j] <= higher[i,j], 0 otherwise

InRange(TColor, TColor)

Checks that image elements lie between two scalars

[ExposableMethod(Exposable = true, Category = "Logic")]
public Image<Gray, byte> InRange(TColor lower, TColor higher)

Parameters

lower TColor

The inclusive lower limit of color value

higher TColor

The inclusive upper limit of color value

Returns

Image<Gray, byte>

res[i,j] = 255 if lower <= this[i,j] <= higher, 0 otherwise

Integral()

Calculates integral images for the source image

public Image<TColor, double> Integral()

Returns

Image<TColor, double>

The integral image

Integral(out Image<TColor, double>, out Image<TColor, double>)

Calculates integral images for the source image

public void Integral(out Image<TColor, double> sum, out Image<TColor, double> squareSum)

Parameters

sum Image<TColor, double>

The integral image

squareSum Image<TColor, double>

The integral image for squared pixel values

Integral(out Image<TColor, double>, out Image<TColor, double>, out Image<TColor, double>)

Calculates one or more integral images for the source image

public void Integral(out Image<TColor, double> sum, out Image<TColor, double> squareSum, out Image<TColor, double> titledSum)

Parameters

sum Image<TColor, double>

The integral image

squareSum Image<TColor, double>

The integral image for squared pixel values

titledSum Image<TColor, double>

The integral for the image rotated by 45 degrees

Laplace(int)

Calculates Laplacian of the source image by summing second x- and y- derivatives calculated using Sobel operator. Specifying aperture_size=1 gives the fastest variant that is equal to convolving the image with the following kernel:

|0 1 0| |1 -4 1| |0 1 0|

[ExposableMethod(Exposable = true, Category = "Gradients, Edges")]
public Image<TColor, float> Laplace(int apertureSize)

Parameters

apertureSize int

Aperture size

Returns

Image<TColor, float>

The Laplacian of the image

Log()

Calculates natural logarithm of absolute value of every element of input array

[ExposableMethod(Exposable = true, Category = "Math")]
public Image<TColor, TDepth> Log()

Returns

Image<TColor, TDepth>

Natural logarithm of absolute value of every element of input array

LogPolar(PointF, double, Inter, Warp)

Convert the image to log polar, simulating the human foveal vision

[ExposableMethod(Exposable = true, Category = "Transform")]
public Image<TColor, TDepth> LogPolar(PointF center, double magnitude, Inter interpolationType = Inter.Linear, Warp warpType = Warp.FillOutliers)

Parameters

center PointF

The transformation center, where the output precision is maximal

magnitude double

Magnitude scale parameter

interpolationType Inter

interpolation type

warpType Warp

Warp type

Returns

Image<TColor, TDepth>

The converted image

MapDataToImage(int, int, int, nint)

Let this Image object use the specific Image data.

protected void MapDataToImage(int width, int height, int stride, nint scan0)

Parameters

width int

The width of the image

height int

The height of the image

stride int

The data stride (bytes per row)

scan0 nint

The origin of the data

MatchTemplate(Image<TColor, TDepth>, TemplateMatchingType)

The function slides through image, compares overlapped patches of size wxh with templ using the specified method and return the comparison results

public Image<Gray, float> MatchTemplate(Image<TColor, TDepth> template, TemplateMatchingType method)

Parameters

template Image<TColor, TDepth>

Searched template; must be not greater than the source image and the same data type as the image

method TemplateMatchingType

Specifies the way the template must be compared with image regions

Returns

Image<Gray, float>

The comparison result: width = this.Width - template.Width + 1; height = this.Height - template.Height + 1

Max(Image<TColor, TDepth>)

Find the elementwise maximum value

public Image<TColor, TDepth> Max(Image<TColor, TDepth> img2)

Parameters

img2 Image<TColor, TDepth>

The second image for the Max operation

Returns

Image<TColor, TDepth>

An image where each pixel is the maximum of this image and the parameter image

Max(double)

Find the elementwise maximum value

public Image<TColor, TDepth> Max(double value)

Parameters

value double

The value to compare with

Returns

Image<TColor, TDepth>

An image where each pixel is the maximum of this image and value

Min(Image<TColor, TDepth>)

Find the elementwise minimum value

public Image<TColor, TDepth> Min(Image<TColor, TDepth> img2)

Parameters

img2 Image<TColor, TDepth>

The second image for the Min operation

Returns

Image<TColor, TDepth>

An image where each pixel is the minimum of this image and the parameter image

Min(double)

Find the elementwise minimum value

public Image<TColor, TDepth> Min(double value)

Parameters

value double

The value to compare with

Returns

Image<TColor, TDepth>

An image where each pixel is the minimum of this image and value

MinMax(out double[], out double[], out Point[], out Point[])

Returns the min / max location and values for the image

public void MinMax(out double[] minValues, out double[] maxValues, out Point[] minLocations, out Point[] maxLocations)

Parameters

minValues double[]

The minimum values for each channel

maxValues double[]

The maximum values for each channel

minLocations Point[]

The minimum locations for each channel

maxLocations Point[]

The maximum locations for each channel

MorphologyEx(MorphOp, IInputArray, Point, int, BorderType, MCvScalar)

Perform advanced morphological transformations using erosion and dilation as basic operations.

public Image<TColor, TDepth> MorphologyEx(MorphOp operation, IInputArray kernel, Point anchor, int iterations, BorderType borderType, MCvScalar borderValue)

Parameters

operation MorphOp

Type of morphological operation

kernel IInputArray

Structuring element

anchor Point

Anchor position with the kernel. Negative values mean that the anchor is at the kernel center.

iterations int

Number of times erosion and dilation are applied

borderType BorderType

Border type

borderValue MCvScalar

Border value

Returns

Image<TColor, TDepth>

The result of the morphological operation

Mul(Image<TColor, TDepth>)

Elementwise multiply img2 with the current image

public Image<TColor, TDepth> Mul(Image<TColor, TDepth> img2)

Parameters

img2 Image<TColor, TDepth>

The image to be elementwise multiplied to the current image

Returns

Image<TColor, TDepth>

this .* img2

Mul(Image<TColor, TDepth>, double)

Elementwise multiply another image with the current image and the scale

public Image<TColor, TDepth> Mul(Image<TColor, TDepth> img2, double scale)

Parameters

img2 Image<TColor, TDepth>

The image to be elementwise multiplied to the current image

scale double

The scale to be multiplied

Returns

Image<TColor, TDepth>

this .* img2 * scale

Mul(double)

Elementwise multiply the current image with scale

[ExposableMethod(Exposable = true, Category = "Math")]
public Image<TColor, TDepth> Mul(double scale)

Parameters

scale double

The scale to be multiplied

Returns

Image<TColor, TDepth>

The scaled image

Not()

Compute the complement image

public Image<TColor, TDepth> Not()

Returns

Image<TColor, TDepth>

The complement image

Or(Image<TColor, TDepth>)

Perform an elementwise OR operation with another image and return the result

public Image<TColor, TDepth> Or(Image<TColor, TDepth> img2)

Parameters

img2 Image<TColor, TDepth>

The second image for the OR operation

Returns

Image<TColor, TDepth>

The result of the OR operation

Or(Image<TColor, TDepth>, Image<Gray, byte>)

Perform an elementwise OR operation with another image, using a mask, and return the result

public Image<TColor, TDepth> Or(Image<TColor, TDepth> img2, Image<Gray, byte> mask)

Parameters

img2 Image<TColor, TDepth>

The second image for the OR operation

mask Image<Gray, byte>

The mask for the OR operation

Returns

Image<TColor, TDepth>

The result of the OR operation

Or(TColor)

Perform an elementwise OR operation with some color

[ExposableMethod(Exposable = true, Category = "Logic")]
public Image<TColor, TDepth> Or(TColor val)

Parameters

val TColor

The value for the OR operation

Returns

Image<TColor, TDepth>

The result of the OR operation

Or(TColor, Image<Gray, byte>)

Perform an elementwise OR operation with some color using a mask

public Image<TColor, TDepth> Or(TColor val, Image<Gray, byte> mask)

Parameters

val TColor

The color for the OR operation

mask Image<Gray, byte>

The mask for the OR operation

Returns

Image<TColor, TDepth>

The result of the OR operation

Pow(double)

Raises every element of input array to p dst(I)=src(I)^p, if p is integer dst(I)=abs(src(I))^p, otherwise

[ExposableMethod(Exposable = true, Category = "Math")]
public Image<TColor, TDepth> Pow(double power)

Parameters

power double

The exponent of power

Returns

Image<TColor, TDepth>

The power image

PyrDown()

Performs downsampling step of Gaussian pyramid decomposition. First it convolves this image with the specified filter and then downsamples the image by rejecting even rows and columns.

[ExposableMethod(Exposable = true, Category = "Pyramids")]
public Image<TColor, TDepth> PyrDown()

Returns

Image<TColor, TDepth>

The down-sampled image

PyrUp()

Performs up-sampling step of Gaussian pyramid decomposition. First it up-samples this image by injecting even zero rows and columns and then convolves result with the specified filter multiplied by 4 for interpolation. So the resulting image is four times larger than the source image.

[ExposableMethod(Exposable = true, Category = "Pyramids")]
public Image<TColor, TDepth> PyrUp()

Returns

Image<TColor, TDepth>

The up-sampled image

Resize(double, Inter)

Scale the image to the specific size: width *= scale; height *= scale

[ExposableMethod(Exposable = true)]
public Image<TColor, TDepth> Resize(double scale, Inter interpolationType)

Parameters

scale double

The scale to resize

interpolationType Inter

The type of interpolation

Returns

Image<TColor, TDepth>

The scaled image

Resize(int, int, Inter)

Scale the image to the specific size

[ExposableMethod(Exposable = true)]
public Image<TColor, TDepth> Resize(int width, int height, Inter interpolationType)

Parameters

width int

The width of the returned image.

height int

The height of the returned image.

interpolationType Inter

The type of interpolation

Returns

Image<TColor, TDepth>

The resized image

Resize(int, int, Inter, bool)

Scale the image to the specific size

public Image<TColor, TDepth> Resize(int width, int height, Inter interpolationType, bool preserveScale)

Parameters

width int

The width of the returned image.

height int

The height of the returned image.

interpolationType Inter

The type of interpolation

preserveScale bool

if true, the scale is preservered and the resulting image has maximum width(height) possible that is <= width (height), if false, this function is equaivalent to Resize(int width, int height)

Returns

Image<TColor, TDepth>

The resized image

RoiParam(nint, out long, out int, out int, out int, out int)

Return parameters based on ROI

protected static void RoiParam(nint ptr, out long start, out int rows, out int elementCount, out int byteWidth, out int widthStep)

Parameters

ptr nint

The Pointer to the IplImage

start long

The address of the pointer that point to the start of the Bytes taken into consideration ROI

rows int

The number of rows taken into consideration ROI

elementCount int

ROI.Width * ColorType.Dimension

byteWidth int

The number of bytes in a row taken into consideration ROI

widthStep int

The width step required to jump to the next row

Rotate(double, PointF, Inter, TColor, bool)

Rotate this image the specified angle

public Image<TColor, TDepth> Rotate(double angle, PointF center, Inter interpolationMethod, TColor background, bool crop)

Parameters

angle double

The angle of rotation in degrees. Positive means clockwise.

center PointF

The center of rotation

interpolationMethod Inter

The interpolation method

background TColor

The color with with to fill the background

crop bool

If set to true the image is cropped to its original size, possibly losing corners information. If set to false the result image has different size than original and all rotation information is preserved

Returns

Image<TColor, TDepth>

The rotated image

Rotate(double, TColor, bool)

Rotate this image the specified angle

[ExposableMethod(Exposable = true, Category = "Transform")]
public Image<TColor, TDepth> Rotate(double angle, TColor background, bool crop = true)

Parameters

angle double

The angle of rotation in degrees.

background TColor

The color with which to fill the background

crop bool

If set to true the image is cropped to its original size, possibly losing corners information. If set to false the result image has different size than original and all rotation information is preserved

Returns

Image<TColor, TDepth>

The rotated image

Save(string)

Save this image to the specific file.

public override void Save(string fileName)

Parameters

fileName string

The name of the file to be saved to

Remarks

The image format is chosen depending on the filename extension, see cvLoadImage. Only 8-bit single-channel or 3-channel (with 'BGR' channel order) images can be saved using this function. If the format, depth or channel order is different, use cvCvtScale and cvCvtColor to convert it before saving, or use universal cvSave to save the image to XML or YAML format.

SetValue(TColor)

Set every pixel of the image to the specific color

public void SetValue(TColor color)

Parameters

color TColor

The color to be set

SetValue(TColor, Image<Gray, byte>)

Set every pixel of the image to the specific color, using a mask

public void SetValue(TColor color, Image<Gray, byte> mask)

Parameters

color TColor

The color to be set

mask Image<Gray, byte>

The mask for setting color

SmoothBilateral(int, int, int)

Applying bilateral 3x3 filtering

[ExposableMethod(Exposable = true, Category = "Smoothing")]
public Image<TColor, TDepth> SmoothBilateral(int kernelSize, int colorSigma, int spaceSigma)

Parameters

kernelSize int

The size of the bilateral kernel

colorSigma int

Color sigma

spaceSigma int

Space sigma

Returns

Image<TColor, TDepth>

The result of bilateral smooth

SmoothBlur(int, int, bool)

Summation over a pixel param1 x param2 neighborhood. If scale is true, the result is subsequent scaled by 1/(param1 x param2)

[ExposableMethod(Exposable = true, Category = "Smoothing")]
public Image<TColor, TDepth> SmoothBlur(int width, int height, bool scale = true)

Parameters

width int

The width of the window

height int

The height of the window

scale bool

If true, the result is subsequent scaled by 1/(param1 x param2)

Returns

Image<TColor, TDepth>

The result of blur

SmoothGaussian(int)

Perform Gaussian Smoothing in the current image and return the result

public Image<TColor, TDepth> SmoothGaussian(int kernelSize)

Parameters

kernelSize int

The size of the Gaussian kernel (kernelSize x kernelSize)

Returns

Image<TColor, TDepth>

The smoothed image

SmoothGaussian(int, int, double, double)

Perform Gaussian Smoothing in the current image and return the result

[ExposableMethod(Exposable = true, Category = "Smoothing")]
public Image<TColor, TDepth> SmoothGaussian(int kernelWidth, int kernelHeight, double sigma1, double sigma2)

Parameters

kernelWidth int

The width of the Gaussian kernel

kernelHeight int

The height of the Gaussian kernel

sigma1 double

The standard deviation of the Gaussian kernel in the horizontal dimension

sigma2 double

The standard deviation of the Gaussian kernel in the vertical dimension

Returns

Image<TColor, TDepth>

The smoothed image

SmoothMedian(int)

Finding median of sizexsize neighborhood

[ExposableMethod(Exposable = true, Category = "Smoothing")]
public Image<TColor, TDepth> SmoothMedian(int size)

Parameters

size int

The size (width & height) of the window

Returns

Image<TColor, TDepth>

The result of median smooth

Sobel(int, int, int)

Calculates the image derivative by convolving the image with the appropriate kernel The Sobel operators combine Gaussian smoothing and differentiation so the result is more or less robust to the noise. Most often, the function is called with (xorder=1, yorder=0, aperture_size=3) or (xorder=0, yorder=1, aperture_size=3) to calculate first x- or y- image derivative.

[ExposableMethod(Exposable = true, Category = "Gradients, Edges")]
public Image<TColor, float> Sobel(int xorder, int yorder, int apertureSize)

Parameters

xorder int

Order of the derivative x

yorder int

Order of the derivative y

apertureSize int

Size of the extended Sobel kernel, must be 1, 3, 5 or 7. In all cases except 1, aperture_size xaperture_size separable kernel will be used to calculate the derivative.

Returns

Image<TColor, float>

The result of the sobel edge detector

Split()

Split current Image into an array of gray scale images where each element in the array represent a single color channel of the original image

public Image<Gray, TDepth>[] Split()

Returns

Image<Gray, TDepth>[]

An array of gray scale images where each element
in the array represent a single color channel of the original image

Sub(Image<TColor, TDepth>)

Elementwise subtract another image from the current image

public Image<TColor, TDepth> Sub(Image<TColor, TDepth> img2)

Parameters

img2 Image<TColor, TDepth>

The second image to be subtracted from the current image

Returns

Image<TColor, TDepth>

The result of elementwise subtracting img2 from the current image

Sub(Image<TColor, TDepth>, Image<Gray, byte>)

Elementwise subtract another image from the current image, using a mask

public Image<TColor, TDepth> Sub(Image<TColor, TDepth> img2, Image<Gray, byte> mask)

Parameters

img2 Image<TColor, TDepth>

The image to be subtracted from the current image

mask Image<Gray, byte>

The mask for the subtract operation

Returns

Image<TColor, TDepth>

The result of elementwise subtracting img2 from the current image, using the specific mask

Sub(TColor)

Elementwise subtract a color from the current image

[ExposableMethod(Exposable = true, Category = "Math")]
public Image<TColor, TDepth> Sub(TColor val)

Parameters

val TColor

The color value to be subtracted from the current image

Returns

Image<TColor, TDepth>

The result of elementwise subtracting color 'val' from the current image

SubR(TColor)

result = val - this

[ExposableMethod(Exposable = true, Category = "Math")]
public Image<TColor, TDepth> SubR(TColor val)

Parameters

val TColor

the value which subtract this image

Returns

Image<TColor, TDepth>

val - this

SubR(TColor, Image<Gray, byte>)

result = val - this, using a mask

public Image<TColor, TDepth> SubR(TColor val, Image<Gray, byte> mask)

Parameters

val TColor

The value which subtract this image

mask Image<Gray, byte>

The mask for subtraction

Returns

Image<TColor, TDepth>

val - this, with mask

ThresholdAdaptive(TColor, AdaptiveThresholdType, ThresholdType, int, TColor)

Transforms grayscale image to binary image. Threshold calculated individually for each pixel. For the method CV_ADAPTIVE_THRESH_MEAN_C it is a mean of blockSize x blockSize pixel neighborhood, subtracted by param1. For the method CV_ADAPTIVE_THRESH_GAUSSIAN_C it is a weighted sum (gaussian) of blockSize x blockSize pixel neighborhood, subtracted by param1.

[ExposableMethod(Exposable = true, Category = "Threshold")]
public Image<TColor, TDepth> ThresholdAdaptive(TColor maxValue, AdaptiveThresholdType adaptiveType, ThresholdType thresholdType, int blockSize, TColor param1)

Parameters

maxValue TColor

Maximum value to use with CV_THRESH_BINARY and CV_THRESH_BINARY_INV thresholding types

adaptiveType AdaptiveThresholdType

Adaptive_method

thresholdType ThresholdType

Thresholding type. must be one of CV_THRESH_BINARY, CV_THRESH_BINARY_INV

blockSize int

The size of a pixel neighborhood that is used to calculate a threshold value for the pixel: 3, 5, 7, ...

param1 TColor

Constant subtracted from mean or weighted mean. It may be negative.

Returns

Image<TColor, TDepth>

The result of the adaptive threshold

ThresholdBinary(TColor, TColor)

Threshold the image such that: dst(x,y) = max_value, if src(x,y)>threshold; 0, otherwise

public Image<TColor, TDepth> ThresholdBinary(TColor threshold, TColor maxValue)

Parameters

threshold TColor

The threshold value

maxValue TColor

The maximum value of the pixel on the result

Returns

Image<TColor, TDepth>

The image such that: dst(x,y) = max_value, if src(x,y)>threshold; 0, otherwise

ThresholdBinaryInv(TColor, TColor)

Threshold the image such that: dst(x,y) = 0, if src(x,y)>threshold; max_value, otherwise

public Image<TColor, TDepth> ThresholdBinaryInv(TColor threshold, TColor maxValue)

Parameters

threshold TColor

The threshold value

maxValue TColor

The maximum value of the pixel on the result

Returns

Image<TColor, TDepth>

The image such that: dst(x,y) = 0, if src(x,y)>threshold; max_value, otherwise

ThresholdToZero(TColor)

Threshold the image such that: dst(x,y) = src(x,y), if src(x,y)>threshold; 0, otherwise

public Image<TColor, TDepth> ThresholdToZero(TColor threshold)

Parameters

threshold TColor

The threshold value

Returns

Image<TColor, TDepth>

dst(x,y) = src(x,y), if src(x,y)>threshold; 0, otherwise

ThresholdToZeroInv(TColor)

Threshold the image such that: dst(x,y) = 0, if src(x,y)>threshold; src(x,y), otherwise

public Image<TColor, TDepth> ThresholdToZeroInv(TColor threshold)

Parameters

threshold TColor

The threshold value

Returns

Image<TColor, TDepth>

The image such that: dst(x,y) = 0, if src(x,y)>threshold; src(x,y), otherwise

ThresholdTrunc(TColor)

Threshold the image such that: dst(x,y) = threshold, if src(x,y)>threshold; src(x,y), otherwise

public Image<TColor, TDepth> ThresholdTrunc(TColor threshold)

Parameters

threshold TColor

The threshold value

Returns

Image<TColor, TDepth>

The image such that: dst(x,y) = threshold, if src(x,y)>threshold; src(x,y), otherwise

ToJpegData(int)

Get the jpeg representation of the image

public byte[] ToJpegData(int quality = 95)

Parameters

quality int

The jpeg quality

Returns

byte[]

An byte array that contains the image as jpeg data

WarpAffine(Mat, Inter, Warp, BorderType, TColor)

Transforms source image using the specified matrix

public Image<TColor, TDepth> WarpAffine(Mat mapMatrix, Inter interpolationType, Warp warpType, BorderType borderMode, TColor backgroundColor)

Parameters

mapMatrix Mat

2x3 transformation matrix

interpolationType Inter

Interpolation type

warpType Warp

Warp type

borderMode BorderType

Pixel extrapolation method

backgroundColor TColor

A value used to fill outliers

Returns

Image<TColor, TDepth>

The result of the transformation

WarpAffine(Mat, int, int, Inter, Warp, BorderType, TColor)

Transforms source image using the specified matrix

public Image<TColor, TDepth> WarpAffine(Mat mapMatrix, int width, int height, Inter interpolationType, Warp warpType, BorderType borderMode, TColor backgroundColor)

Parameters

mapMatrix Mat

2x3 transformation matrix

width int

The width of the resulting image

height int

the height of the resulting image

interpolationType Inter

Interpolation type

warpType Warp

Warp type

borderMode BorderType

Pixel extrapolation method

backgroundColor TColor

A value used to fill outliers

Returns

Image<TColor, TDepth>

The result of the transformation

WarpPerspective<TMapDepth>(Matrix<TMapDepth>, Inter, Warp, BorderType, TColor)

Transforms source image using the specified matrix

public Image<TColor, TDepth> WarpPerspective<TMapDepth>(Matrix<TMapDepth> mapMatrix, Inter interpolationType, Warp warpType, BorderType borderMode, TColor backgroundColor) where TMapDepth : new()

Parameters

mapMatrix Matrix<TMapDepth>

3x3 transformation matrix

interpolationType Inter

Interpolation type

warpType Warp

Warp type

borderMode BorderType

Pixel extrapolation method

backgroundColor TColor

A value used to fill outliers

Returns

Image<TColor, TDepth>

The result of the transformation

Type Parameters

TMapDepth

The depth type of mapMatrix, should be either float or double

WarpPerspective<TMapDepth>(Matrix<TMapDepth>, int, int, Inter, Warp, BorderType, TColor)

Transforms source image using the specified matrix

public Image<TColor, TDepth> WarpPerspective<TMapDepth>(Matrix<TMapDepth> mapMatrix, int width, int height, Inter interpolationType, Warp warpType, BorderType borderType, TColor backgroundColor) where TMapDepth : new()

Parameters

mapMatrix Matrix<TMapDepth>

3x3 transformation matrix

width int

The width of the resulting image

height int

the height of the resulting image

interpolationType Inter

Interpolation type

warpType Warp

Warp type

borderType BorderType

Border type

backgroundColor TColor

A value used to fill outliers

Returns

Image<TColor, TDepth>

The result of the transformation

Type Parameters

TMapDepth

The depth type of mapMatrix, should be either float or double

Xor(Image<TColor, TDepth>)

Perform an elementwise XOR operation with another image and return the result

public Image<TColor, TDepth> Xor(Image<TColor, TDepth> img2)

Parameters

img2 Image<TColor, TDepth>

The second image for the XOR operation

Returns

Image<TColor, TDepth>

The result of the XOR operation

Xor(Image<TColor, TDepth>, Image<Gray, byte>)

Perform an elementwise XOR operation with another image, using a mask, and return the result

public Image<TColor, TDepth> Xor(Image<TColor, TDepth> img2, Image<Gray, byte> mask)

Parameters

img2 Image<TColor, TDepth>

The second image for the XOR operation

mask Image<Gray, byte>

The mask for the XOR operation

Returns

Image<TColor, TDepth>

The result of the XOR operation

Xor(TColor)

Perform an binary XOR operation with some color

[ExposableMethod(Exposable = true, Category = "Logic")]
public Image<TColor, TDepth> Xor(TColor val)

Parameters

val TColor

The value for the XOR operation

Returns

Image<TColor, TDepth>

The result of the XOR operation

Xor(TColor, Image<Gray, byte>)

Perform an binary XOR operation with some color using a mask

public Image<TColor, TDepth> Xor(TColor val, Image<Gray, byte> mask)

Parameters

val TColor

The color for the XOR operation

mask Image<Gray, byte>

The mask for the XOR operation

Returns

Image<TColor, TDepth>

The result of the XOR operation

_Dilate(int)

Dilates this image inplace using a 3x3 rectangular structuring element. Dilation are applied several (iterations) times

[ExposableMethod(Exposable = true, Category = "Morphology")]
public void _Dilate(int iterations)

Parameters

iterations int

The number of dilate iterations

_EqualizeHist()

The algorithm inplace normalizes brightness and increases contrast of the image. For color images, a HSV representation of the image is first obtained and the V (value) channel is histogram normalized

[ExposableMethod(Exposable = true)]
public void _EqualizeHist()

_Erode(int)

Erodes this image inplace using a 3x3 rectangular structuring element. Erosion are applied several (iterations) times

[ExposableMethod(Exposable = true, Category = "Morphology")]
public void _Erode(int iterations)

Parameters

iterations int

The number of erode iterations

_Flip(FlipType)

Inplace flip the image

[ExposableMethod(Exposable = true, Category = "Transform")]
public void _Flip(FlipType flipType)

Parameters

flipType FlipType

The type of the flipping

_GammaCorrect(double)

Gamma corrects this image inplace. The image must have a depth type of Byte.

[ExposableMethod(Exposable = true)]
public void _GammaCorrect(double gamma)

Parameters

gamma double

The gamma value

_MorphologyEx(MorphOp, IInputArray, Point, int, BorderType, MCvScalar)

Perform inplace advanced morphological transformations using erosion and dilation as basic operations.

public void _MorphologyEx(MorphOp operation, IInputArray kernel, Point anchor, int iterations, BorderType borderType, MCvScalar borderValue)

Parameters

operation MorphOp

Type of morphological operation

kernel IInputArray

Structuring element

anchor Point

Anchor position with the kernel. Negative values mean that the anchor is at the kernel center.

iterations int

Number of times erosion and dilation are applied

borderType BorderType

Border type

borderValue MCvScalar

Border value

_SmoothGaussian(int)

Perform Gaussian Smoothing inplace for the current image

public void _SmoothGaussian(int kernelSize)

Parameters

kernelSize int

The size of the Gaussian kernel (kernelSize x kernelSize)

_SmoothGaussian(int, int, double, double)

Perform Gaussian Smoothing inplace for the current image

public void _SmoothGaussian(int kernelWidth, int kernelHeight, double sigma1, double sigma2)

Parameters

kernelWidth int

The width of the Gaussian kernel

kernelHeight int

The height of the Gaussian kernel

sigma1 double

The standard deviation of the Gaussian kernel in the horizontal dimension

sigma2 double

The standard deviation of the Gaussian kernel in the vertical dimension

_ThresholdBinary(TColor, TColor)

Threshold the image inplace such that: dst(x,y) = max_value, if src(x,y)>threshold; 0, otherwise

[ExposableMethod(Exposable = true, Category = "Threshold")]
public void _ThresholdBinary(TColor threshold, TColor maxValue)

Parameters

threshold TColor

The threshold value

maxValue TColor

The maximum value of the pixel on the result

_ThresholdBinaryInv(TColor, TColor)

Threshold the image inplace such that: dst(x,y) = 0, if src(x,y)>threshold; max_value, otherwise

[ExposableMethod(Exposable = true, Category = "Threshold")]
public void _ThresholdBinaryInv(TColor threshold, TColor maxValue)

Parameters

threshold TColor

The threshold value

maxValue TColor

The maximum value of the pixel on the result

_ThresholdToZero(TColor)

Threshold the image inplace such that: dst(x,y) = src(x,y), if src(x,y)>threshold; 0, otherwise

[ExposableMethod(Exposable = true, Category = "Threshold")]
public void _ThresholdToZero(TColor threshold)

Parameters

threshold TColor

The threshold value

_ThresholdToZeroInv(TColor)

Threshold the image inplace such that: dst(x,y) = 0, if src(x,y)>threshold; src(x,y), otherwise

[ExposableMethod(Exposable = true, Category = "Threshold")]
public void _ThresholdToZeroInv(TColor threshold)

Parameters

threshold TColor

The threshold value

_ThresholdTrunc(TColor)

Threshold the image inplace such that: dst(x,y) = threshold, if src(x,y)>threshold; src(x,y), otherwise

[ExposableMethod(Exposable = true, Category = "Threshold")]
public void _ThresholdTrunc(TColor threshold)

Parameters

threshold TColor

The threshold value

Operators

operator +(Image<TColor, TDepth>, Image<TColor, TDepth>)

Element wise add img1 with img2

public static Image<TColor, TDepth> operator +(Image<TColor, TDepth> img1, Image<TColor, TDepth> img2)

Parameters

img1 Image<TColor, TDepth>

The first image to be added

img2 Image<TColor, TDepth>

The second image to be added

Returns

Image<TColor, TDepth>

The sum of the two images

operator +(Image<TColor, TDepth>, double)

Element wise add image with value

public static Image<TColor, TDepth> operator +(Image<TColor, TDepth> image, double value)

Parameters

image Image<TColor, TDepth>

The image to be added

value double

The value to be added

Returns

Image<TColor, TDepth>

The images plus the color

operator +(Image<TColor, TDepth>, TColor)

Element wise add image with value

public static Image<TColor, TDepth> operator +(Image<TColor, TDepth> image, TColor value)

Parameters

image Image<TColor, TDepth>

The image to be added

value TColor

The color to be added

Returns

Image<TColor, TDepth>

The images plus the color

operator +(double, Image<TColor, TDepth>)

Element wise add img1 with val

public static Image<TColor, TDepth> operator +(double val, Image<TColor, TDepth> img1)

Parameters

val double

The value to be added

img1 Image<TColor, TDepth>

The image to be added

Returns

Image<TColor, TDepth>

The images plus the color

operator +(TColor, Image<TColor, TDepth>)

Element wise add image with value

public static Image<TColor, TDepth> operator +(TColor value, Image<TColor, TDepth> image)

Parameters

value TColor

The color to be added

image Image<TColor, TDepth>

The image to be added

Returns

Image<TColor, TDepth>

The images plus the color

operator &(Image<TColor, TDepth>, Image<TColor, TDepth>)

Perform an element wise AND operation on the two images

public static Image<TColor, TDepth> operator &(Image<TColor, TDepth> img1, Image<TColor, TDepth> img2)

Parameters

img1 Image<TColor, TDepth>

The first image to AND

img2 Image<TColor, TDepth>

The second image to AND

Returns

Image<TColor, TDepth>

The result of the AND operation

operator &(Image<TColor, TDepth>, double)

Perform an element wise AND operation using an images and a color

public static Image<TColor, TDepth> operator &(Image<TColor, TDepth> img1, double val)

Parameters

img1 Image<TColor, TDepth>

The first image to AND

val double

The color to AND

Returns

Image<TColor, TDepth>

The result of the AND operation

operator &(Image<TColor, TDepth>, TColor)

Perform an element wise AND operation using an images and a color

public static Image<TColor, TDepth> operator &(Image<TColor, TDepth> img1, TColor val)

Parameters

img1 Image<TColor, TDepth>

The first image to AND

val TColor

The color to AND

Returns

Image<TColor, TDepth>

The result of the AND operation

operator &(double, Image<TColor, TDepth>)

Perform an element wise AND operation using an images and a color

public static Image<TColor, TDepth> operator &(double val, Image<TColor, TDepth> img1)

Parameters

val double

The color to AND

img1 Image<TColor, TDepth>

The first image to AND

Returns

Image<TColor, TDepth>

The result of the AND operation

operator &(TColor, Image<TColor, TDepth>)

Perform an element wise AND operation using an images and a color

public static Image<TColor, TDepth> operator &(TColor val, Image<TColor, TDepth> img1)

Parameters

val TColor

The color to AND

img1 Image<TColor, TDepth>

The first image to AND

Returns

Image<TColor, TDepth>

The result of the AND operation

operator |(Image<TColor, TDepth>, Image<TColor, TDepth>)

Perform an element wise OR operation with another image and return the result

public static Image<TColor, TDepth> operator |(Image<TColor, TDepth> img1, Image<TColor, TDepth> img2)

Parameters

img1 Image<TColor, TDepth>

The first image to apply bitwise OR operation

img2 Image<TColor, TDepth>

The second image to apply bitwise OR operation

Returns

Image<TColor, TDepth>

The result of the OR operation

operator |(Image<TColor, TDepth>, double)

Perform an binary OR operation with some color

public static Image<TColor, TDepth> operator |(Image<TColor, TDepth> img1, double val)

Parameters

img1 Image<TColor, TDepth>

The image to OR

val double

The color to OR

Returns

Image<TColor, TDepth>

The result of the OR operation

operator |(Image<TColor, TDepth>, TColor)

Perform an binary OR operation with some color

public static Image<TColor, TDepth> operator |(Image<TColor, TDepth> img1, TColor val)

Parameters

img1 Image<TColor, TDepth>

The image to OR

val TColor

The color to OR

Returns

Image<TColor, TDepth>

The result of the OR operation

operator |(double, Image<TColor, TDepth>)

Perform an binary OR operation with some color

public static Image<TColor, TDepth> operator |(double val, Image<TColor, TDepth> img1)

Parameters

val double

The color to OR

img1 Image<TColor, TDepth>

The image to OR

Returns

Image<TColor, TDepth>

The result of the OR operation

operator |(TColor, Image<TColor, TDepth>)

Perform an binary OR operation with some color

public static Image<TColor, TDepth> operator |(TColor val, Image<TColor, TDepth> img1)

Parameters

val TColor

The color to OR

img1 Image<TColor, TDepth>

The image to OR

Returns

Image<TColor, TDepth>

The result of the OR operation

operator /(Image<TColor, TDepth>, double)

image / scale

public static Image<TColor, TDepth> operator /(Image<TColor, TDepth> image, double scale)

Parameters

image Image<TColor, TDepth>

The image

scale double

The division scale

Returns

Image<TColor, TDepth>

image / scale

operator /(double, Image<TColor, TDepth>)

scale / image

public static Image<TColor, TDepth> operator /(double scale, Image<TColor, TDepth> image)

Parameters

scale double

The scale

image Image<TColor, TDepth>

The image

Returns

Image<TColor, TDepth>

scale / image

operator *(Image<TColor, TDepth>, ConvolutionKernelF)

Perform the convolution with kernel on image

public static Image<TColor, float> operator *(Image<TColor, TDepth> image, ConvolutionKernelF kernel)

Parameters

image Image<TColor, TDepth>

The image

kernel ConvolutionKernelF

The kernel

Returns

Image<TColor, float>

Result of the convolution

operator *(Image<TColor, TDepth>, double)

image * scale

public static Image<TColor, TDepth> operator *(Image<TColor, TDepth> image, double scale)

Parameters

image Image<TColor, TDepth>

The image

scale double

The multiplication scale

Returns

Image<TColor, TDepth>

image * scale

operator *(double, Image<TColor, TDepth>)

scale*image

public static Image<TColor, TDepth> operator *(double scale, Image<TColor, TDepth> image)

Parameters

scale double

The multiplication scale

image Image<TColor, TDepth>

The image

Returns

Image<TColor, TDepth>

scale*image

operator ~(Image<TColor, TDepth>)

Compute the complement image

public static Image<TColor, TDepth> operator ~(Image<TColor, TDepth> image)

Parameters

image Image<TColor, TDepth>

The image to be inverted

Returns

Image<TColor, TDepth>

The complement image

operator -(Image<TColor, TDepth>, Image<TColor, TDepth>)

Element wise subtract another image from the current image

public static Image<TColor, TDepth> operator -(Image<TColor, TDepth> image1, Image<TColor, TDepth> image2)

Parameters

image1 Image<TColor, TDepth>

The image to be subtracted

image2 Image<TColor, TDepth>

The second image to be subtracted from image1

Returns

Image<TColor, TDepth>

The result of element wise subtracting img2 from image1

operator -(Image<TColor, TDepth>, double)

Element wise subtract another image from the current image

public static Image<TColor, TDepth> operator -(Image<TColor, TDepth> image, double value)

Parameters

image Image<TColor, TDepth>

The image to be subtracted

value double

The value to be subtracted

Returns

Image<TColor, TDepth>

image - value

operator -(Image<TColor, TDepth>, TColor)

Element wise subtract another image from the current image

public static Image<TColor, TDepth> operator -(Image<TColor, TDepth> image, TColor value)

Parameters

image Image<TColor, TDepth>

The image to be subtracted

value TColor

The color to be subtracted

Returns

Image<TColor, TDepth>

The result of element wise subtracting value from image

operator -(double, Image<TColor, TDepth>)

value - image

public static Image<TColor, TDepth> operator -(double value, Image<TColor, TDepth> image)

Parameters

value double

The value to be subtracted

image Image<TColor, TDepth>

The image to be subtracted

Returns

Image<TColor, TDepth>

value - image

operator -(TColor, Image<TColor, TDepth>)

Element wise subtract another image from the current image

public static Image<TColor, TDepth> operator -(TColor value, Image<TColor, TDepth> image)

Parameters

value TColor

The color to be subtracted

image Image<TColor, TDepth>

The image to be subtracted

Returns

Image<TColor, TDepth>

value - image