/
ImageFeatures.cs
71 lines (64 loc) · 1.74 KB
/
ImageFeatures.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
using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
namespace OpenCvSharp.Detail;
/// <summary>
/// Structure containing image keypoints and descriptors.
/// </summary>
public class ImageFeatures : IDisposable
{
#pragma warning disable 1591
public int ImgIdx { get; }
public Size ImgSize{ get; }
public IReadOnlyList<KeyPoint> Keypoints{ get; }
public Mat Descriptors{ get; }
#pragma warning restore 1591
/// <summary>
/// Constructor
/// </summary>
/// <param name="imgIdx"></param>
/// <param name="imgSize"></param>
/// <param name="keypoints"></param>
/// <param name="descriptors"></param>
public ImageFeatures(int imgIdx, Size imgSize, IReadOnlyList<KeyPoint> keypoints, Mat descriptors)
{
ImgIdx = imgIdx;
ImgSize = imgSize;
Keypoints = keypoints;
Descriptors = descriptors;
}
/// <summary>
/// Destructor
/// </summary>
~ImageFeatures()
{
Dispose(false);
}
/// <summary>
/// </summary>
/// <param name="disposing"></param>
protected virtual void Dispose(bool disposing)
{
if (disposing)
{
Descriptors.Dispose();
}
}
/// <inheritdoc />
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
}
#pragma warning disable 1591
[StructLayout(LayoutKind.Sequential)]
[SuppressMessage("Design", "CA1051: Do not declare visible instance fields")]
[SuppressMessage("Microsoft.Design", "CA1815: Override equals and operator equals on value types")]
public struct WImageFeatures
{
public int ImgIdx;
public Size ImgSize;
public IntPtr Keypoints;
public IntPtr Descriptors;
}
#pragma warning restore 1591