Skip to content

Commit b0f61e6

Browse files
committed
2 parents cb89ac3 + 03d5755 commit b0f61e6

File tree

11 files changed

+131
-21
lines changed

11 files changed

+131
-21
lines changed

src/OpenCvSharp/Cv2/Cv2_calib3d.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,7 @@ public static void SolvePnP(
753753
InputArray distCoeffs,
754754
OutputArray rvec, OutputArray tvec,
755755
bool useExtrinsicGuess = false,
756-
SolvePnPFlags flags = SolvePnPFlags.Iterative)
756+
SolvePnPMethod flags = SolvePnPMethod.Iterative)
757757
{
758758
if (objectPoints is null)
759759
throw new ArgumentNullException(nameof(objectPoints));
@@ -812,7 +812,7 @@ public static void SolvePnP(
812812
ref double[] rvec,
813813
ref double[] tvec,
814814
bool useExtrinsicGuess = false,
815-
SolvePnPFlags flags = SolvePnPFlags.Iterative)
815+
SolvePnPMethod flags = SolvePnPMethod.Iterative)
816816
{
817817
if (objectPoints is null)
818818
throw new ArgumentNullException(nameof(objectPoints));
@@ -880,7 +880,7 @@ public static void SolvePnPRansac(
880880
float reprojectionError = 8.0f,
881881
double confidence = 0.99,
882882
OutputArray? inliers = null,
883-
SolvePnPFlags flags = SolvePnPFlags.Iterative)
883+
SolvePnPMethod flags = SolvePnPMethod.Iterative)
884884
{
885885
if (objectPoints is null)
886886
throw new ArgumentNullException(nameof(objectPoints));
@@ -974,7 +974,7 @@ public static void SolvePnPRansac(
974974
int iterationsCount = 100,
975975
float reprojectionError = 8.0f,
976976
double confidence = 0.99,
977-
SolvePnPFlags flags = SolvePnPFlags.Iterative)
977+
SolvePnPMethod flags = SolvePnPMethod.Iterative)
978978
{
979979
if (objectPoints is null)
980980
throw new ArgumentNullException(nameof(objectPoints));

src/OpenCvSharp/Cv2/Cv2_photo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ static partial class Cv2
1313
/// <param name="inpaintRadius">Radius of a circular neighborhood of each point inpainted that is considered by the algorithm.</param>
1414
/// <param name="flags">Inpainting method that could be cv::INPAINT_NS or cv::INPAINT_TELEA</param>
1515
public static void Inpaint(InputArray src, InputArray inpaintMask,
16-
OutputArray dst, double inpaintRadius, InpaintMethod flags)
16+
OutputArray dst, double inpaintRadius, InpaintTypes flags)
1717
{
1818
if (src is null)
1919
throw new ArgumentNullException(nameof(src));
@@ -248,7 +248,7 @@ public static void Decolor(
248248
/// <param name="flags">Cloning method</param>
249249
public static void SeamlessClone(
250250
InputArray src, InputArray dst, InputArray? mask, Point p,
251-
OutputArray blend, SeamlessCloneMethods flags)
251+
OutputArray blend, SeamlessCloneFlags flags)
252252
{
253253
if (src is null)
254254
throw new ArgumentNullException(nameof(src));

src/OpenCvSharp/Modules/aruco/CvAruco.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ public static void DrawDetectedMarkers(InputArray image, Point2f[][] corners, IE
164164
/// </summary>
165165
/// <param name="name"></param>
166166
/// <returns></returns>
167-
public static Dictionary GetPredefinedDictionary(PredefinedDictionaryName name)
167+
public static Dictionary GetPredefinedDictionary(PredefinedDictionaryType name)
168168
{
169169
NativeMethods.HandleException(
170170
NativeMethods.aruco_getPredefinedDictionary((int) name, out IntPtr p));
@@ -311,7 +311,7 @@ public static void DrawDetectedDiamonds(InputArray image,
311311
/// <param name="markerCorners">output list of detected marker corners.</param>
312312
/// <param name="markerIds">ids of the corners in markerCorners.</param>
313313
public static void DetectCharucoBoard(InputArray image, int squaresX, int squaresY, float squareLength, float markerLength,
314-
PredefinedDictionaryName arucoDictId,
314+
PredefinedDictionaryType arucoDictId,
315315
out Point2f[] charucoCorners, out int[] charucoIds,
316316
out Point2f[][] markerCorners, out int[] markerIds)
317317
{
@@ -352,7 +352,7 @@ public static void DetectCharucoBoard(InputArray image, int squaresX, int square
352352
/// <param name="charucoCorners">output list of detected charuco corners.</param>
353353
/// <param name="charucoIds">ids of the charucos in charucoCorners.</param>
354354
public static void InterpolateCornersCharuco(InputArray image,
355-
int squaresX, int squaresY, float squareLength, float markerLength, PredefinedDictionaryName arucoDictId,
355+
int squaresX, int squaresY, float squareLength, float markerLength, PredefinedDictionaryType arucoDictId,
356356
Point2f[][] markerCorners, IEnumerable<int> markerIds,
357357
out Point2f[] charucoCorners, out int[] charucoIds)
358358
{

src/OpenCvSharp/Modules/aruco/Enum/PredefinedDictionaryName.cs

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
namespace OpenCvSharp.Aruco;
33

44
/// <summary>
5-
/// PredefinedDictionaryName
5+
/// PredefinedDictionaryType
66
/// </summary>
7-
public enum PredefinedDictionaryName
7+
public enum PredefinedDictionaryType
88
{
99
#pragma warning disable 1591
1010
Dict4X4_50 = 0,
@@ -29,3 +29,33 @@ public enum PredefinedDictionaryName
2929
DictAprilTag_36h10,
3030
DictAprilTag_36h11
3131
}
32+
33+
/// <summary>
34+
/// Obsolete: Use PredefinedDictionaryType instead. This enum is kept for backward compatibility.
35+
/// </summary>
36+
[Obsolete("Use PredefinedDictionaryType instead", true)]
37+
public enum PredefinedDictionaryName
38+
{
39+
#pragma warning disable 1591
40+
Dict4X4_50 = 0,
41+
Dict4X4_100,
42+
Dict4X4_250,
43+
Dict4X4_1000,
44+
Dict5X5_50,
45+
Dict5X5_100,
46+
Dict5X5_250,
47+
Dict5X5_1000,
48+
Dict6X6_50,
49+
Dict6X6_100,
50+
Dict6X6_250,
51+
Dict6X6_1000,
52+
Dict7X7_50,
53+
Dict7X7_100,
54+
Dict7X7_250,
55+
Dict7X7_1000,
56+
DictArucoOriginal,
57+
DictAprilTag_16h5,
58+
DictAprilTag_25h9,
59+
DictAprilTag_36h10,
60+
DictAprilTag_36h11
61+
}

src/OpenCvSharp/Modules/calib3d/Enum/SolvePnPFlags.cs

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
/// <summary>
55
/// Method for solving a PnP problem:
66
/// </summary>
7-
public enum SolvePnPFlags
7+
public enum SolvePnPMethod
88
{
99
/// <summary>
1010
/// Iterative method is based on Levenberg-Marquardt optimization.
@@ -34,3 +34,38 @@ public enum SolvePnPFlags
3434
/// </summary>
3535
UPNP = 4,
3636
}
37+
38+
/// <summary>
39+
/// Obsolete: Use SolvePnPMethod instead. This enum is kept for backward compatibility.
40+
/// </summary>
41+
[Obsolete("Use SolvePnPMethod instead", true)]
42+
public enum SolvePnPFlags
43+
{
44+
/// <summary>
45+
/// Iterative method is based on Levenberg-Marquardt optimization.
46+
/// In this case the function finds such a pose that minimizes reprojection error,
47+
/// that is the sum of squared distances between the observed projections imagePoints and the projected (using projectPoints() ) objectPoints .
48+
/// </summary>
49+
Iterative = 0,
50+
51+
/// <summary>
52+
/// Method has been introduced by F.Moreno-Noguer, V.Lepetit and P.Fua in the paper “EPnP: Efficient Perspective-n-Point Camera Pose Estimation”.
53+
/// </summary>
54+
EPNP = 1,
55+
56+
/// <summary>
57+
/// Method is based on the paper of X.S. Gao, X.-R. Hou, J. Tang, H.-F. Chang“Complete Solution Classification for
58+
/// the Perspective-Three-Point Problem”. In this case the function requires exactly four object and image points.
59+
/// </summary>
60+
P3P = 2,
61+
62+
/// <summary>
63+
/// Joel A. Hesch and Stergios I. Roumeliotis. "A Direct Least-Squares (DLS) Method for PnP"
64+
/// </summary>
65+
DLS = 3,
66+
67+
/// <summary>
68+
/// A.Penate-Sanchez, J.Andrade-Cetto, F.Moreno-Noguer. "Exhaustive Linearization for Robust Camera Pose and Focal Length Estimation"
69+
/// </summary>
70+
UPNP = 4,
71+
}

src/OpenCvSharp/Modules/photo/InpaintMethod.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,24 @@
33
/// <summary>
44
/// The inpainting method
55
/// </summary>
6+
public enum InpaintTypes
7+
{
8+
/// <summary>
9+
/// Navier-Stokes based method.
10+
/// </summary>
11+
// ReSharper disable once InconsistentNaming
12+
NS = 0,
13+
14+
/// <summary>
15+
/// The method by Alexandru Telea
16+
/// </summary>
17+
Telea = 1,
18+
}
19+
20+
/// <summary>
21+
/// Obsolete: Use InpaintTypes instead. This enum is kept for backward compatibility.
22+
/// </summary>
23+
[Obsolete("Use InpaintTypes instead", true)]
624
public enum InpaintMethod
725
{
826
/// <summary>

src/OpenCvSharp/Modules/photo/SeamlessCloneMethods.cs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,33 @@ namespace OpenCvSharp;
55
/// <summary>
66
/// SeamlessClone method
77
/// </summary>
8+
public enum SeamlessCloneFlags
9+
{
10+
/// <summary>
11+
/// The power of the method is fully expressed when inserting objects with
12+
/// complex outlines into a new background.
13+
/// </summary>
14+
NormalClone = 1,
15+
16+
/// <summary>
17+
/// The classic method, color-based selection and alpha masking might be time
18+
/// consuming and often leaves an undesirable halo. Seamless cloning, even averaged
19+
/// with the original image, is not effective. Mixed seamless cloning based on a
20+
/// loose selection proves effective.
21+
/// </summary>
22+
MixedClone = 2,
23+
24+
/// <summary>
25+
/// Feature exchange allows the user to easily replace certain features of one
26+
/// object by alternative features.
27+
/// </summary>
28+
MonochromeTransfer = 3
29+
}
30+
31+
/// <summary>
32+
/// Obsolete: Use SeamlessCloneFlags instead. This enum is kept for backward compatibility.
33+
/// </summary>
34+
[Obsolete("Use SeamlessCloneFlags instead", true)]
835
public enum SeamlessCloneMethods
936
{
1037
/// <summary>

test/OpenCvSharp.Tests/aruco/ArucoTest.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public void CreateDetectorParameters()
4949
public void GetPredefinedDictionary()
5050
{
5151
#pragma warning disable CS8605
52-
foreach (PredefinedDictionaryName val in Enum.GetValues(typeof(PredefinedDictionaryName)))
52+
foreach (PredefinedDictionaryType val in Enum.GetValues(typeof(PredefinedDictionaryType)))
5353
#pragma warning restore CS8605
5454
{
5555
var dict = CvAruco.GetPredefinedDictionary(val);
@@ -61,7 +61,7 @@ public void GetPredefinedDictionary()
6161
public void ReadDictionaryFromFile()
6262
{
6363
var dictionaryFile = Path.Combine("_data", "aruco", "Dict6X6_1000.yaml");
64-
var toCompareWith = CvAruco.GetPredefinedDictionary(PredefinedDictionaryName.Dict6X6_1000);
64+
var toCompareWith = CvAruco.GetPredefinedDictionary(PredefinedDictionaryType.Dict6X6_1000);
6565
var dict = CvAruco.ReadDictionary(dictionaryFile);
6666

6767
Assert.Equal(toCompareWith.BytesList.Rows, dict.BytesList.Rows);
@@ -83,7 +83,7 @@ public void ReadDictionaryFromFile()
8383
public void DetectMarkers()
8484
{
8585
using var image = LoadImage("markers_6x6_250.png", ImreadModes.Grayscale);
86-
using var dict = CvAruco.GetPredefinedDictionary(PredefinedDictionaryName.Dict6X6_250);
86+
using var dict = CvAruco.GetPredefinedDictionary(PredefinedDictionaryType.Dict6X6_250);
8787

8888
var param = new DetectorParameters();
8989
CvAruco.DetectMarkers(image, dict, out _, out _, param, out _);
@@ -92,7 +92,7 @@ public void DetectMarkers()
9292
[Fact]
9393
public void DictionaryProperties()
9494
{
95-
var dict = CvAruco.GetPredefinedDictionary(PredefinedDictionaryName.Dict6X6_250);
95+
var dict = CvAruco.GetPredefinedDictionary(PredefinedDictionaryType.Dict6X6_250);
9696
Assert.Equal(250, dict.BytesList.Rows);
9797
Assert.Equal(5, dict.BytesList.Cols); // (6*6 + 7)/8
9898
Assert.Equal(6, dict.MarkerSize);
@@ -109,7 +109,7 @@ public void DrawDetectedMarker()
109109
{
110110
using var image = LoadImage("markers_6x6_250.png", ImreadModes.Grayscale);
111111
using var outputImage = image.CvtColor(ColorConversionCodes.GRAY2RGB);
112-
using var dict = CvAruco.GetPredefinedDictionary(PredefinedDictionaryName.Dict6X6_250);
112+
using var dict = CvAruco.GetPredefinedDictionary(PredefinedDictionaryType.Dict6X6_250);
113113
var param = new DetectorParameters();
114114
CvAruco.DetectMarkers(image, dict, out var corners, out var ids, param, out var rejectedImgPoints);
115115

@@ -129,7 +129,7 @@ public void DrawDetectedMarker()
129129
public void EstimatePoseSingleMarkers()
130130
{
131131
using var image = LoadImage("markers_6x6_250.png", ImreadModes.Grayscale);
132-
using var dict = CvAruco.GetPredefinedDictionary(PredefinedDictionaryName.Dict6X6_250);
132+
using var dict = CvAruco.GetPredefinedDictionary(PredefinedDictionaryType.Dict6X6_250);
133133
var param = new DetectorParameters();
134134
CvAruco.DetectMarkers(image, dict, out var corners, out _, param, out _);
135135

test/OpenCvSharp.Tests/photo/PhotoTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public void Inpaint()
1414

1515
mask.Rectangle(new Rect(65, 15, 130, 30), Scalar.All(255), -1);
1616

17-
Cv2.Inpaint(src, mask, dst, 2, InpaintMethod.Telea);
17+
Cv2.Inpaint(src, mask, dst, 2, InpaintTypes.Telea);
1818

1919
if (Debugger.IsAttached)
2020
Window.ShowImages(src, mask, dst);

test/OpenCvSharp.Tests/system/ExceptionTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public void MedianBlur()
8989
public void ArucoDetectMarkers()
9090
{
9191
using var image = new Mat();
92-
using var dict = OpenCvSharp.Aruco.CvAruco.GetPredefinedDictionary(OpenCvSharp.Aruco.PredefinedDictionaryName.Dict6X6_250);
92+
using var dict = OpenCvSharp.Aruco.CvAruco.GetPredefinedDictionary(OpenCvSharp.Aruco.PredefinedDictionaryType.Dict6X6_250);
9393

9494
var param = new OpenCvSharp.Aruco.DetectorParameters();
9595

0 commit comments

Comments
 (0)