Added Class Library FaceRecognitionDotNet
This commit is contained in:
@ -1,10 +1,11 @@
|
||||
using System.Drawing;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using View_by_Distance.Shared.Models.Methods;
|
||||
|
||||
namespace View_by_Distance.Shared.Models;
|
||||
|
||||
public class Location : Properties.ILocation, ILocation
|
||||
public class Location : Properties.ILocation, ILocation, IEquatable<Location>
|
||||
{
|
||||
|
||||
protected double _Confidence;
|
||||
@ -28,10 +29,47 @@ public class Location : Properties.ILocation, ILocation
|
||||
_Top = top;
|
||||
}
|
||||
|
||||
public Location(int left, int top, int right, int bottom) :
|
||||
this(-1.0d, bottom, left, right, top)
|
||||
{ }
|
||||
|
||||
public Location(Rectangle rectangle, double confidence) :
|
||||
this(-1.0d, rectangle.Bottom, rectangle.Left, rectangle.Right, rectangle.Top)
|
||||
{ }
|
||||
|
||||
public Location(Location location, double confidence) :
|
||||
this(-1.0d, location.Bottom, location.Left, location.Right, location.Top)
|
||||
{ }
|
||||
|
||||
public override bool Equals(object? obj) => Equals(obj as Location);
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true });
|
||||
return result;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
int hashCode = -773114317;
|
||||
hashCode = hashCode * -1521134295 + _Bottom.GetHashCode();
|
||||
hashCode = hashCode * -1521134295 + _Left.GetHashCode();
|
||||
hashCode = hashCode * -1521134295 + _Right.GetHashCode();
|
||||
hashCode = hashCode * -1521134295 + _Top.GetHashCode();
|
||||
return hashCode;
|
||||
}
|
||||
|
||||
public bool Equals(Location? location)
|
||||
{
|
||||
return location is not null
|
||||
&& _Bottom == location.Bottom
|
||||
&& _Left == location.Left
|
||||
&& _Right == location.Right
|
||||
&& _Top == location.Top;
|
||||
}
|
||||
|
||||
public static bool operator ==(Location location1, Location location2) => EqualityComparer<Location>.Default.Equals(location1, location2);
|
||||
|
||||
public static bool operator !=(Location location1, Location location2) => !(location1 == location2);
|
||||
|
||||
}
|
Reference in New Issue
Block a user