Allow UMats

This commit is contained in:
Tiago Conceição
2021-09-14 20:05:05 +01:00
parent 60db062e70
commit 90d2f911c1
2 changed files with 24 additions and 1 deletions
+23
View File
@@ -67,6 +67,14 @@ namespace UVtools.Core.Extensions
public static Mat NewBlank(this Mat mat)
=> InitMat(mat.Size, mat.NumberOfChannels, mat.Depth);
/// <summary>
/// Creates a new blanked (All zeros) <see cref="UMat"/> with same size and type of the source
/// </summary>
/// <param name="mat"></param>
/// <returns>Blanked <see cref="Mat"/></returns>
public static UMat NewBlank(this UMat mat)
=> InitUMat(mat.Size, mat.NumberOfChannels, mat.Depth);
/// <summary>
/// Creates a <see cref="Mat"/> with same size and type of the source and set it to a color
/// </summary>
@@ -87,6 +95,21 @@ namespace UVtools.Core.Extensions
public static Mat InitMat(Size size, int channels = 1, DepthType depthType = DepthType.Cv8U)
=> size.IsEmpty ? new() : Mat.Zeros(size.Height, size.Width, depthType, channels);
/// <summary>
/// Creates a new <see cref="UMat"/> and zero it
/// </summary>
/// <param name="size"></param>
/// <param name="channels"></param>
/// <param name="depthType"></param>
/// <returns></returns>
public static UMat InitUMat(Size size, int channels = 1, DepthType depthType = DepthType.Cv8U)
{
if (size.IsEmpty) return new();
var umat = new UMat(size.Height, size.Width, depthType, channels);
umat.SetTo(BlackColor);
return umat;
}
/// <summary>
/// Creates a new <see cref="Mat"/> and set it to a <see cref="MCvScalar"/>
/// </summary>
+1 -1
View File
@@ -775,7 +775,7 @@ namespace UVtools.Core
return true;
}
void GenerateAirMap(Mat input, Mat output, VectorOfVectorOfPoint externals)
void GenerateAirMap(IInputArray input, IInputOutputArray output, VectorOfVectorOfPoint externals)
{
CvInvoke.BitwiseNot(input, output);
if (externals is null || externals.Size == 0) return;