Static helpers for color-format conversion and Mat geometric transforms used by SourceToMat.
More...
Static helpers for color-format conversion and Mat geometric transforms used by SourceToMat.
◆ 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
-
| inputMat | Input mat to transform. |
| rotated90Mat | Pre-allocated output for rotation. When null, rotation is skipped. Must be pre-allocated with swapped width/height and the same type as inputMat . |
| flipVertical | Whether to flip vertically. |
| flipHorizontal | Whether to flip horizontally. |
- Returns
- rotated90Mat when rotation succeeds; otherwise inputMat .
◆ Channels()
Gets the number of channels for the specified color format.
- Parameters
-
- Returns
- Number of channels. Returns 1 for GRAY, 3 for RGB/BGR, 4 for RGBA/BGRA. Returns 4 for unknown formats.
◆ ColorConversionCodes()
Gets the OpenCV color conversion code needed for converting between two color formats.
- Parameters
-
| srcType | The source color format. |
| dstType | The 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()
Copies sourceMat into destinationMat , converting color when needed.
- Parameters
-
| sourceMat | Source mat. |
| destinationMat | Destination mat. |
| sourceFormat | Source color format. |
| destinationFormat | Destination 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: