/
UsacParams.cs
84 lines (76 loc) · 2.07 KB
/
UsacParams.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
using System.Runtime.InteropServices;
namespace OpenCvSharp;
#pragma warning disable CS1591
public class UsacParams
{
#pragma warning disable CA1805
public double Confidence { get; set; } = 0.99;
public bool IsParallel { get; set; } = false;
public int LoIterations { get; set; } = 5;
public LocalOptimMethod LoMethod { get; set; } = LocalOptimMethod.INNER_LO;
public int LoSampleSize { get; set; } = 14;
public int MaxIterations { get; set; } = 5000;
public NeighborSearchMethod NeighborsSearch { get; set; } = NeighborSearchMethod.GRID;
public int RandomGeneratorState { get; set; } = 0;
public SamplingMethod Sampler { get; set; } = SamplingMethod.UNIFORM;
public ScoreMethod Score { get; set; } = ScoreMethod.MSAC;
public double Threshold { get; set; } = 1.5;
public WUsacParams ToNativeStruct() => new WUsacParams
{
Confidence = Confidence,
IsParallel = IsParallel ? 1 : 0,
LoIterations = LoIterations,
LoMethod = LoMethod,
LoSampleSize = LoSampleSize,
MaxIterations = MaxIterations,
NeighborsSearch = NeighborsSearch,
RandomGeneratorState = RandomGeneratorState,
Sampler = Sampler,
Score = Score,
Threshold = Threshold,
};
}
#pragma warning disable CA1815
[StructLayout(LayoutKind.Sequential)]
public struct WUsacParams
{
public double Confidence;
public int IsParallel;
public int LoIterations;
public LocalOptimMethod LoMethod;
public int LoSampleSize;
public int MaxIterations;
public NeighborSearchMethod NeighborsSearch;
public int RandomGeneratorState;
public SamplingMethod Sampler;
public ScoreMethod Score;
public double Threshold;
}
public enum SamplingMethod : int
{
UNIFORM,
PROGRESSIVE_NAPSAC,
NAPSAC,
PROSAC
}
public enum LocalOptimMethod : int
{
NULL,
INNER_LO,
INNER_AND_ITER_LO,
GC,
SIGMA
}
public enum ScoreMethod : int
{
RANSAC,
MSAC,
MAGSAC,
LMEDS
}
public enum NeighborSearchMethod : int
{
FLANN_KNN,
GRID,
FLANN_RADIUS
}