OpenCV for Unity 3.0.4
Enox Software / Please refer to OpenCV official document ( http://docs.opencv.org/5.0/index.html ) for the details of the argument of the method.
Loading...
Searching...
No Matches
OpenCVForUnity.Extensions.SourceToMat.SourceToMatUtils Class Reference

Static helpers for color-format conversion and Mat geometric transforms used by SourceToMat. More...

Static Public Member Functions

static Mat ApplyMatTransformations (Mat inputMat, Mat rotated90Mat, bool flipVertical, bool flipHorizontal)
 Applies horizontal/vertical flips and an optional 90-degree clockwise rotation to inputMat .
 
static int Channels (SourceToMatColorFormat type)
 Gets the number of channels for the specified color format.
 
static int ColorConversionCodes (SourceToMatColorFormat srcType, SourceToMatColorFormat dstType)
 Gets the OpenCV color conversion code needed for converting between two color formats.
 
static bool TryCopyOrConvertColor (Mat sourceMat, Mat destinationMat, SourceToMatColorFormat sourceFormat, SourceToMatColorFormat destinationFormat)
 Copies sourceMat into destinationMat , converting color when needed.
 

Detailed Description

Static helpers for color-format conversion and Mat geometric transforms used by SourceToMat.

Member Function Documentation

◆ ApplyMatTransformations()

static Mat OpenCVForUnity.Extensions.SourceToMat.SourceToMatUtils.ApplyMatTransformations ( Mat inputMat,
Mat rotated90Mat,
bool flipVertical,
bool flipHorizontal )
static

Applies horizontal/vertical flips and an optional 90-degree clockwise rotation to inputMat .

Parameters
inputMatInput mat to transform.
rotated90MatPre-allocated output for rotation. When null, rotation is skipped. Must be pre-allocated with swapped width/height and the same type as inputMat .
flipVerticalWhether to flip vertically.
flipHorizontalWhether to flip horizontally.
Returns
rotated90Mat when rotation succeeds; otherwise inputMat .

◆ Channels()

static int OpenCVForUnity.Extensions.SourceToMat.SourceToMatUtils.Channels ( SourceToMatColorFormat type)
static

Gets the number of channels for the specified color format.

Parameters
typeThe color format.
Returns
Number of channels. Returns 1 for GRAY, 3 for RGB/BGR, 4 for RGBA/BGRA. Returns 4 for unknown formats.

◆ ColorConversionCodes()

static int OpenCVForUnity.Extensions.SourceToMat.SourceToMatUtils.ColorConversionCodes ( SourceToMatColorFormat srcType,
SourceToMatColorFormat dstType )
static

Gets the OpenCV color conversion code needed for converting between two color formats.

Parameters
srcTypeThe source color format.
dstTypeThe destination color format.
Returns
OpenCV color conversion code. Returns -1 if conversion is not possible.

Supported color format conversions:

  • GRAY ⇔ RGB/BGR/RGBA/BGRA
  • RGB ⇔ GRAY/BGR/RGBA/BGRA
  • BGR ⇔ GRAY/RGB/RGBA/BGRA
  • RGBA ⇔ GRAY/RGB/BGR/BGRA
  • BGRA ⇔ GRAY/RGB/BGR/RGBA

◆ TryCopyOrConvertColor()

static bool OpenCVForUnity.Extensions.SourceToMat.SourceToMatUtils.TryCopyOrConvertColor ( Mat sourceMat,
Mat destinationMat,
SourceToMatColorFormat sourceFormat,
SourceToMatColorFormat destinationFormat )
static

Copies sourceMat into destinationMat , converting color when needed.

Parameters
sourceMatSource mat.
destinationMatDestination mat.
sourceFormatSource color format.
destinationFormatDestination color format.
Returns
true when a same-format copy or supported conversion succeeded; false when conversion is unsupported.

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