Skip to content

Commit 11114c8

Browse files
Merge branch 'release/1.2.3.8'
2 parents 64c1d4f + 87edd48 commit 11114c8

File tree

10 files changed

+244
-260
lines changed

10 files changed

+244
-260
lines changed

FaceRecognitionDotNet.sln

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -24,85 +24,33 @@ EndProject
2424
Global
2525
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2626
Debug|Any CPU = Debug|Any CPU
27-
DebugLinux|Any CPU = DebugLinux|Any CPU
28-
DebugMac|Any CPU = DebugMac|Any CPU
2927
Release|Any CPU = Release|Any CPU
30-
ReleaseLinux|Any CPU = ReleaseLinux|Any CPU
31-
ReleaseMac|Any CPU = ReleaseMac|Any CPU
3228
EndGlobalSection
3329
GlobalSection(ProjectConfigurationPlatforms) = postSolution
3430
{85AB4F26-48B7-4A21-A6C7-14EA6608B539}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
3531
{85AB4F26-48B7-4A21-A6C7-14EA6608B539}.Debug|Any CPU.Build.0 = Debug|Any CPU
36-
{85AB4F26-48B7-4A21-A6C7-14EA6608B539}.DebugLinux|Any CPU.ActiveCfg = Debug|Any CPU
37-
{85AB4F26-48B7-4A21-A6C7-14EA6608B539}.DebugLinux|Any CPU.Build.0 = Debug|Any CPU
38-
{85AB4F26-48B7-4A21-A6C7-14EA6608B539}.DebugMac|Any CPU.ActiveCfg = Debug|Any CPU
39-
{85AB4F26-48B7-4A21-A6C7-14EA6608B539}.DebugMac|Any CPU.Build.0 = Debug|Any CPU
4032
{85AB4F26-48B7-4A21-A6C7-14EA6608B539}.Release|Any CPU.ActiveCfg = Release|Any CPU
4133
{85AB4F26-48B7-4A21-A6C7-14EA6608B539}.Release|Any CPU.Build.0 = Release|Any CPU
42-
{85AB4F26-48B7-4A21-A6C7-14EA6608B539}.ReleaseLinux|Any CPU.ActiveCfg = Release|Any CPU
43-
{85AB4F26-48B7-4A21-A6C7-14EA6608B539}.ReleaseLinux|Any CPU.Build.0 = Release|Any CPU
44-
{85AB4F26-48B7-4A21-A6C7-14EA6608B539}.ReleaseMac|Any CPU.ActiveCfg = Release|Any CPU
45-
{85AB4F26-48B7-4A21-A6C7-14EA6608B539}.ReleaseMac|Any CPU.Build.0 = Release|Any CPU
4634
{BC72B97F-9631-4550-8DAC-5F96FF7DE9EB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
4735
{BC72B97F-9631-4550-8DAC-5F96FF7DE9EB}.Debug|Any CPU.Build.0 = Debug|Any CPU
48-
{BC72B97F-9631-4550-8DAC-5F96FF7DE9EB}.DebugLinux|Any CPU.ActiveCfg = DebugLinux|Any CPU
49-
{BC72B97F-9631-4550-8DAC-5F96FF7DE9EB}.DebugLinux|Any CPU.Build.0 = DebugLinux|Any CPU
50-
{BC72B97F-9631-4550-8DAC-5F96FF7DE9EB}.DebugMac|Any CPU.ActiveCfg = DebugMac|Any CPU
51-
{BC72B97F-9631-4550-8DAC-5F96FF7DE9EB}.DebugMac|Any CPU.Build.0 = DebugMac|Any CPU
5236
{BC72B97F-9631-4550-8DAC-5F96FF7DE9EB}.Release|Any CPU.ActiveCfg = Release|Any CPU
5337
{BC72B97F-9631-4550-8DAC-5F96FF7DE9EB}.Release|Any CPU.Build.0 = Release|Any CPU
54-
{BC72B97F-9631-4550-8DAC-5F96FF7DE9EB}.ReleaseLinux|Any CPU.ActiveCfg = ReleaseLinux|Any CPU
55-
{BC72B97F-9631-4550-8DAC-5F96FF7DE9EB}.ReleaseLinux|Any CPU.Build.0 = ReleaseLinux|Any CPU
56-
{BC72B97F-9631-4550-8DAC-5F96FF7DE9EB}.ReleaseMac|Any CPU.ActiveCfg = ReleaseMac|Any CPU
57-
{BC72B97F-9631-4550-8DAC-5F96FF7DE9EB}.ReleaseMac|Any CPU.Build.0 = ReleaseMac|Any CPU
5838
{EB355E8B-8070-4221-9CB9-7BD0655DC9A8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
5939
{EB355E8B-8070-4221-9CB9-7BD0655DC9A8}.Debug|Any CPU.Build.0 = Debug|Any CPU
60-
{EB355E8B-8070-4221-9CB9-7BD0655DC9A8}.DebugLinux|Any CPU.ActiveCfg = Debug|Any CPU
61-
{EB355E8B-8070-4221-9CB9-7BD0655DC9A8}.DebugLinux|Any CPU.Build.0 = Debug|Any CPU
62-
{EB355E8B-8070-4221-9CB9-7BD0655DC9A8}.DebugMac|Any CPU.ActiveCfg = Debug|Any CPU
63-
{EB355E8B-8070-4221-9CB9-7BD0655DC9A8}.DebugMac|Any CPU.Build.0 = Debug|Any CPU
6440
{EB355E8B-8070-4221-9CB9-7BD0655DC9A8}.Release|Any CPU.ActiveCfg = Release|Any CPU
6541
{EB355E8B-8070-4221-9CB9-7BD0655DC9A8}.Release|Any CPU.Build.0 = Release|Any CPU
66-
{EB355E8B-8070-4221-9CB9-7BD0655DC9A8}.ReleaseLinux|Any CPU.ActiveCfg = Release|Any CPU
67-
{EB355E8B-8070-4221-9CB9-7BD0655DC9A8}.ReleaseLinux|Any CPU.Build.0 = Release|Any CPU
68-
{EB355E8B-8070-4221-9CB9-7BD0655DC9A8}.ReleaseMac|Any CPU.ActiveCfg = Release|Any CPU
69-
{EB355E8B-8070-4221-9CB9-7BD0655DC9A8}.ReleaseMac|Any CPU.Build.0 = Release|Any CPU
7042
{D0CB4212-16D2-4DE5-8A26-83AF5E24C7D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
7143
{D0CB4212-16D2-4DE5-8A26-83AF5E24C7D3}.Debug|Any CPU.Build.0 = Debug|Any CPU
72-
{D0CB4212-16D2-4DE5-8A26-83AF5E24C7D3}.DebugLinux|Any CPU.ActiveCfg = Debug|Any CPU
73-
{D0CB4212-16D2-4DE5-8A26-83AF5E24C7D3}.DebugLinux|Any CPU.Build.0 = Debug|Any CPU
74-
{D0CB4212-16D2-4DE5-8A26-83AF5E24C7D3}.DebugMac|Any CPU.ActiveCfg = Debug|Any CPU
75-
{D0CB4212-16D2-4DE5-8A26-83AF5E24C7D3}.DebugMac|Any CPU.Build.0 = Debug|Any CPU
7644
{D0CB4212-16D2-4DE5-8A26-83AF5E24C7D3}.Release|Any CPU.ActiveCfg = Release|Any CPU
7745
{D0CB4212-16D2-4DE5-8A26-83AF5E24C7D3}.Release|Any CPU.Build.0 = Release|Any CPU
78-
{D0CB4212-16D2-4DE5-8A26-83AF5E24C7D3}.ReleaseLinux|Any CPU.ActiveCfg = Release|Any CPU
79-
{D0CB4212-16D2-4DE5-8A26-83AF5E24C7D3}.ReleaseLinux|Any CPU.Build.0 = Release|Any CPU
80-
{D0CB4212-16D2-4DE5-8A26-83AF5E24C7D3}.ReleaseMac|Any CPU.ActiveCfg = Release|Any CPU
81-
{D0CB4212-16D2-4DE5-8A26-83AF5E24C7D3}.ReleaseMac|Any CPU.Build.0 = Release|Any CPU
8246
{32599FBF-8E91-43BA-B0B6-38E3C7A02530}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
8347
{32599FBF-8E91-43BA-B0B6-38E3C7A02530}.Debug|Any CPU.Build.0 = Debug|Any CPU
84-
{32599FBF-8E91-43BA-B0B6-38E3C7A02530}.DebugLinux|Any CPU.ActiveCfg = Debug|Any CPU
85-
{32599FBF-8E91-43BA-B0B6-38E3C7A02530}.DebugLinux|Any CPU.Build.0 = Debug|Any CPU
86-
{32599FBF-8E91-43BA-B0B6-38E3C7A02530}.DebugMac|Any CPU.ActiveCfg = Debug|Any CPU
87-
{32599FBF-8E91-43BA-B0B6-38E3C7A02530}.DebugMac|Any CPU.Build.0 = Debug|Any CPU
8848
{32599FBF-8E91-43BA-B0B6-38E3C7A02530}.Release|Any CPU.ActiveCfg = Release|Any CPU
8949
{32599FBF-8E91-43BA-B0B6-38E3C7A02530}.Release|Any CPU.Build.0 = Release|Any CPU
90-
{32599FBF-8E91-43BA-B0B6-38E3C7A02530}.ReleaseLinux|Any CPU.ActiveCfg = Release|Any CPU
91-
{32599FBF-8E91-43BA-B0B6-38E3C7A02530}.ReleaseLinux|Any CPU.Build.0 = Release|Any CPU
92-
{32599FBF-8E91-43BA-B0B6-38E3C7A02530}.ReleaseMac|Any CPU.ActiveCfg = Release|Any CPU
93-
{32599FBF-8E91-43BA-B0B6-38E3C7A02530}.ReleaseMac|Any CPU.Build.0 = Release|Any CPU
9450
{49ED9EF1-7E3E-4959-B152-52545B973906}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
9551
{49ED9EF1-7E3E-4959-B152-52545B973906}.Debug|Any CPU.Build.0 = Debug|Any CPU
96-
{49ED9EF1-7E3E-4959-B152-52545B973906}.DebugLinux|Any CPU.ActiveCfg = Debug|Any CPU
97-
{49ED9EF1-7E3E-4959-B152-52545B973906}.DebugLinux|Any CPU.Build.0 = Debug|Any CPU
98-
{49ED9EF1-7E3E-4959-B152-52545B973906}.DebugMac|Any CPU.ActiveCfg = Debug|Any CPU
99-
{49ED9EF1-7E3E-4959-B152-52545B973906}.DebugMac|Any CPU.Build.0 = Debug|Any CPU
10052
{49ED9EF1-7E3E-4959-B152-52545B973906}.Release|Any CPU.ActiveCfg = Release|Any CPU
10153
{49ED9EF1-7E3E-4959-B152-52545B973906}.Release|Any CPU.Build.0 = Release|Any CPU
102-
{49ED9EF1-7E3E-4959-B152-52545B973906}.ReleaseLinux|Any CPU.ActiveCfg = Release|Any CPU
103-
{49ED9EF1-7E3E-4959-B152-52545B973906}.ReleaseLinux|Any CPU.Build.0 = Release|Any CPU
104-
{49ED9EF1-7E3E-4959-B152-52545B973906}.ReleaseMac|Any CPU.ActiveCfg = Release|Any CPU
105-
{49ED9EF1-7E3E-4959-B152-52545B973906}.ReleaseMac|Any CPU.Build.0 = Release|Any CPU
10654
EndGlobalSection
10755
GlobalSection(SolutionProperties) = preSolution
10856
HideSolutionNode = FALSE

nuget/FaceRecognitionDotNet-CPU.nuspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<package >
33
<metadata>
44
<id>FaceRecognitionDotNet</id>
5-
<version>1.2.3.7</version>
5+
<version>1.2.3.8</version>
66
<title>FaceRecognitionDotNet</title>
77
<authors>Takuya Takeuchi</authors>
88
<owners>Takuya Takeuchi</owners>
@@ -19,7 +19,7 @@ This library is ported from https://github.com/ageitgey/face_recognition by C#.<
1919
<serviceable>true</serviceable>
2020
<dependencies>
2121
<group targetFramework="netstandard2.0">
22-
<dependency id="DlibDotNet" version="[19.16.0.20190115,)" />
22+
<dependency id="DlibDotNet" version="[19.16.0.20190119,)" />
2323
</group>
2424
</dependencies>
2525
</metadata>

nuget/FaceRecognitionDotNet-CUDA.nuspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<package >
33
<metadata>
44
<id>FaceRecognitionDotNet-WithCUDA</id>
5-
<version>1.2.3.7</version>
5+
<version>1.2.3.8</version>
66
<title>FaceRecognitionDotNet (with CUDA)</title>
77
<authors>Takuya Takeuchi</authors>
88
<owners>Takuya Takeuchi</owners>
@@ -19,7 +19,7 @@ This library is ported from https://github.com/ageitgey/face_recognition by C#.<
1919
<serviceable>true</serviceable>
2020
<dependencies>
2121
<group targetFramework="netstandard2.0">
22-
<dependency id="DlibDotNet-WithCUDA" version="[19.16.0.20190115,)" />
22+
<dependency id="DlibDotNet-WithCUDA" version="[19.16.0.20190119,)" />
2323
</group>
2424
</dependencies>
2525
</metadata>
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
using System;
2+
3+
namespace FaceRecognitionDotNet
4+
{
5+
6+
/// <summary>
7+
/// Represents a class which has managed or unmanaged resources.
8+
/// </summary>
9+
public abstract class DisposableObject : IDisposable
10+
{
11+
12+
#region Properties
13+
14+
/// <summary>
15+
/// Gets a value indicating whether this instance has been disposed.
16+
/// </summary>
17+
/// <returns>true if this instance has been disposed; otherwise, false.</returns>
18+
public bool IsDisposed
19+
{
20+
get;
21+
private set;
22+
}
23+
24+
#endregion
25+
26+
#region Methods
27+
28+
/// <summary>
29+
/// If this object is disposed, then <see cref="System.ObjectDisposedException"/> is thrown.
30+
/// </summary>
31+
public void ThrowIfDisposed()
32+
{
33+
if (this.IsDisposed)
34+
throw new ObjectDisposedException(this.GetType().FullName);
35+
}
36+
37+
internal void ThrowIfDisposed(string objectName)
38+
{
39+
if (this.IsDisposed)
40+
throw new ObjectDisposedException(objectName);
41+
}
42+
43+
#region Overrides
44+
45+
/// <summary>
46+
/// Releases all managed resources.
47+
/// </summary>
48+
protected virtual void DisposeManaged()
49+
{
50+
51+
}
52+
53+
/// <summary>
54+
/// Releases all unmanaged resources.
55+
/// </summary>
56+
protected virtual void DisposeUnmanaged()
57+
{
58+
59+
}
60+
61+
#endregion
62+
63+
#endregion
64+
65+
#region IDisposable Members
66+
67+
/// <summary>
68+
/// Releases all resources used by this <see cref="DisposableObject"/>.
69+
/// </summary>
70+
public void Dispose()
71+
{
72+
GC.SuppressFinalize(this);
73+
this.Dispose(true);
74+
}
75+
76+
/// <summary>
77+
/// Releases all resources used by this <see cref="DisposableObject"/>.
78+
/// </summary>
79+
/// <param name="disposing">Indicate value whether <see cref="IDisposable.Dispose"/> method was called.</param>
80+
private void Dispose(bool disposing)
81+
{
82+
if (this.IsDisposed)
83+
{
84+
return;
85+
}
86+
87+
this.IsDisposed = true;
88+
89+
if (disposing)
90+
this.DisposeManaged();
91+
92+
this.DisposeUnmanaged();
93+
}
94+
95+
#endregion
96+
97+
}
98+
99+
}

src/FaceRecognitionDotNet/Dlib/Python/SimpleObjectDetector.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,9 @@ public static IEnumerable<Rectangle> RunDetectorWithUpscale2(FrontalFaceDetector
130130
throw new ArgumentNullException(nameof(detector));
131131
if (image == null)
132132
throw new ArgumentNullException(nameof(image));
133-
if (image.IsDisposed)
134-
throw new ObjectDisposedException(nameof(image));
133+
134+
detector.ThrowIfDisposed();
135+
image.ThrowIfDisposed();
135136

136137
var detectionConfidences = new List<double>();
137138
var weightIndices = new List<ulong>();

src/FaceRecognitionDotNet/FaceEncoding.cs

Lines changed: 10 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace FaceRecognitionDotNet
99
/// Represents a feature data of face. This class cannot be inherited.
1010
/// </summary>
1111
[Serializable]
12-
public sealed class FaceEncoding : IDisposable, ISerializable
12+
public sealed class FaceEncoding : DisposableObject, ISerializable
1313
{
1414

1515
#region Fields
@@ -41,15 +41,6 @@ private FaceEncoding(SerializationInfo info, StreamingContext context)
4141

4242
#region Properties
4343

44-
/// <summary>
45-
/// Gets a value indicating whether this object has been disposed of.
46-
/// </summary>
47-
public bool IsDisposed
48-
{
49-
get;
50-
private set;
51-
}
52-
5344
internal Matrix<double> Encoding => this._Encoding;
5445

5546
/// <summary>
@@ -59,47 +50,30 @@ public int Size
5950
{
6051
get
6152
{
62-
if(this.IsDisposed)
63-
throw new ObjectDisposedException($"{nameof(FaceEncoding)}");
53+
this.ThrowIfDisposed();
6454
return this._Encoding.Size;
6555
}
6656
}
6757

6858
#endregion
6959

70-
#region IDisposable Members
60+
#region Methods
7161

72-
/// <summary>
73-
/// Releases all resources used by this <see cref="FaceEncoding"/>.
74-
/// </summary>
75-
public void Dispose()
76-
{
77-
GC.SuppressFinalize(this);
78-
this.Dispose(true);
79-
}
62+
#region Overrides
8063

8164
/// <summary>
82-
/// Releases all resources used by this <see cref="FaceEncoding"/>.
65+
/// Releases all unmanaged resources.
8366
/// </summary>
84-
/// <param name="disposing">Indicate value whether <see cref="IDisposable.Dispose"/> method was called.</param>
85-
private void Dispose(bool disposing)
67+
protected override void DisposeUnmanaged()
8668
{
87-
if (this.IsDisposed)
88-
{
89-
return;
90-
}
91-
92-
this.IsDisposed = true;
93-
94-
if (disposing)
95-
{
96-
this._Encoding?.Dispose();
97-
}
98-
69+
base.DisposeUnmanaged();
70+
this._Encoding?.Dispose();
9971
}
10072

10173
#endregion
10274

75+
#endregion
76+
10377
#region ISerializable Members
10478

10579
/// <summary>

0 commit comments

Comments
 (0)