Skip to content

Commit 10ed0cf

Browse files
committed
CmpTypes
1 parent 003fd08 commit 10ed0cf

File tree

6 files changed

+82
-48
lines changed

6 files changed

+82
-48
lines changed

src/OpenCvSharp/Cv2/Cv2_core.cs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1288,7 +1288,6 @@ public static void BitwiseAnd(InputArray src1, InputArray src2, OutputArray dst,
12881288
GC.KeepAlive(src1);
12891289
GC.KeepAlive(src2);
12901290
GC.KeepAlive(dst);
1291-
dst.Fix();
12921291
GC.KeepAlive(mask);
12931292
}
12941293

@@ -1491,7 +1490,7 @@ public static void InRange(InputArray src, Scalar lowerb, Scalar upperb, OutputA
14911490
/// <param name="dst">output array of type ref CV_8U that has the same size and the same number of channels as the input arrays.</param>
14921491
/// <param name="cmpop">a flag, that specifies correspondence between the arrays (cv::CmpTypes)</param>
14931492
// ReSharper disable once IdentifierTypo
1494-
public static void Compare(InputArray src1, InputArray src2, OutputArray dst, CmpType cmpop)
1493+
public static void Compare(InputArray src1, InputArray src2, OutputArray dst, CmpTypes cmpop)
14951494
{
14961495
if (src1 is null)
14971496
throw new ArgumentNullException(nameof(src1));
@@ -1748,7 +1747,6 @@ public static void Log(InputArray src, OutputArray dst)
17481747

17491748
GC.KeepAlive(src);
17501749
GC.KeepAlive(dst);
1751-
dst.Fix();
17521750
}
17531751

17541752

@@ -2511,7 +2509,7 @@ public static void EigenNonSymmetric(InputArray src, OutputArray eigenvalues, Ou
25112509
/// <param name="samples">samples stored as separate matrices</param>
25122510
/// <param name="covar">output covariance matrix of the type ctype and square size.</param>
25132511
/// <param name="mean">input or output (depending on the flags) array as the average value of the input vectors.</param>
2514-
/// <param name="flags">operation flags as a combination of CovarFlags</param>
2512+
/// <param name="flags">operation flags - see CovarFlags.</param>
25152513
/// <param name="ctype">type of the matrixl; it equals 'CV_64F' by default.</param>
25162514
public static void CalcCovarMatrix(
25172515
Mat[] samples, Mat covar, Mat mean,
@@ -2542,7 +2540,7 @@ public static void CalcCovarMatrix(
25422540
/// <param name="samples">samples stored as rows/columns of a single matrix.</param>
25432541
/// <param name="covar">output covariance matrix of the type ctype and square size.</param>
25442542
/// <param name="mean">input or output (depending on the flags) array as the average value of the input vectors.</param>
2545-
/// <param name="flags">operation flags as a combination of CovarFlags</param>
2543+
/// <param name="flags">operation flags - see CovarFlags.</param>
25462544
/// <param name="ctype">type of the matrixl; it equals 'CV_64F' by default.</param>
25472545
public static void CalcCovarMatrix(
25482546
InputArray samples, OutputArray covar,
@@ -2575,7 +2573,7 @@ public static void CalcCovarMatrix(
25752573
/// <param name="data">input samples stored as the matrix rows or as the matrix columns.</param>
25762574
/// <param name="mean">optional mean value; if the matrix is empty (noArray()), the mean is computed from the data.</param>
25772575
/// <param name="eigenvectors">eigenvectors of the covariation matrix</param>
2578-
/// <param name="maxComponents">maximum number of components that PCA should
2576+
/// <param name="maxComponents">Number of components that PCA should
25792577
/// retain; by default, all the components are retained.</param>
25802578
public static void PCACompute(
25812579
InputArray data, InputOutputArray mean,
@@ -2606,7 +2604,7 @@ public static void PCACompute(
26062604
/// <param name="mean">optional mean value; if the matrix is empty (noArray()), the mean is computed from the data.</param>
26072605
/// <param name="eigenvectors">eigenvectors of the covariation matrix</param>
26082606
/// <param name="eigenvalues">eigenvalues of the covariation matrix</param>
2609-
/// <param name="maxComponents">maximum number of components that PCA should
2607+
/// <param name="maxComponents">Number of components that PCA should
26102608
/// retain; by default, all the components are retained.</param>
26112609
public static void PCACompute(
26122610
InputArray data, InputOutputArray mean,

src/OpenCvSharp/Modules/core/Enum/CmpType.cs

Lines changed: 0 additions & 38 deletions
This file was deleted.
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
namespace OpenCvSharp;
2+
3+
/// <summary>
4+
/// The flag specifying the relation between the elements to be checked
5+
/// </summary>
6+
public enum CmpTypes
7+
{
8+
/// <summary>
9+
/// src1(I) "equal to" src2(I)
10+
/// </summary>
11+
EQ = 0,
12+
13+
/// <summary>
14+
/// src1(I) "greater than" src2(I)
15+
/// </summary>
16+
GT = 1,
17+
18+
/// <summary>
19+
/// src1(I) "greater or equal" src2(I)
20+
/// </summary>
21+
GE = 2,
22+
23+
/// <summary>
24+
/// src1(I) "less than" src2(I)
25+
/// </summary>
26+
LT = 3,
27+
28+
/// <summary>
29+
/// src1(I) "less or equal" src2(I)
30+
/// </summary>
31+
LE = 4,
32+
33+
/// <summary>
34+
/// src1(I) "not equal to" src2(I)
35+
/// </summary>
36+
NE = 5,
37+
}
38+
39+
/// <summary>
40+
/// Obsolete: Use CmpTypes instead. This enum is kept for backward compatibility.
41+
/// </summary>
42+
[Obsolete("Use CmpTypes instead", false)]
43+
public enum CmpType
44+
{
45+
/// <summary>
46+
/// src1(I) "equal to" src2(I)
47+
/// </summary>
48+
EQ = 0,
49+
50+
/// <summary>
51+
/// src1(I) "greater than" src2(I)
52+
/// </summary>
53+
GT = 1,
54+
55+
/// <summary>
56+
/// src1(I) "greater or equal" src2(I)
57+
/// </summary>
58+
GE = 2,
59+
60+
/// <summary>
61+
/// src1(I) "less than" src2(I)
62+
/// </summary>
63+
LT = 3,
64+
65+
/// <summary>
66+
/// src1(I) "less or equal" src2(I)
67+
/// </summary>
68+
LE = 4,
69+
70+
/// <summary>
71+
/// src1(I) "not equal to" src2(I)
72+
/// </summary>
73+
NE = 5,
74+
}

src/OpenCvSharp/Modules/imgproc/ConnectedComponent.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ private Mat GetLabelMask(int label)
180180
using var labels = Mat.FromPixelData(rows, cols, MatType.CV_32SC1, Labels.GetBuffer());
181181
using var cmp = new Mat(rows, cols, MatType.CV_32SC1, Scalar.All(label));
182182
var result = new Mat();
183-
Cv2.Compare(labels, cmp, result, CmpType.EQ);
183+
Cv2.Compare(labels, cmp, result, CmpTypes.EQ);
184184
return result;
185185
}
186186

test/OpenCvSharp.Tests/TestBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ protected static void ImageEquals(Mat img1, Mat img2)
3838
#pragma warning restore CA1062
3939

4040
using var comparison = new Mat();
41-
Cv2.Compare(img1, img2, comparison, CmpType.NE);
41+
Cv2.Compare(img1, img2, comparison, CmpTypes.NE);
4242

4343
if (img1.Channels() == 1)
4444
{

test/OpenCvSharp.Tests/core/CoreTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ public void Compare()
288288
using var src = Mat.FromPixelData(bytes.Length, 1, MatType.CV_8UC1, bytes);
289289
using var dst = new Mat();
290290

291-
Cv2.Compare(src, 3, dst, CmpType.LE);
291+
Cv2.Compare(src, 3, dst, CmpTypes.LE);
292292
Assert.Equal(255, dst.Get<byte>(0));
293293
Assert.Equal(255, dst.Get<byte>(1));
294294
Assert.Equal(255, dst.Get<byte>(2));

0 commit comments

Comments
 (0)