public virtual void TestGetRecognizedFaces()
 {
     Face expResult = new Face(142, 120, 76, 76, "NIELS", new Age(31, 7, 15, 0, 0, 0));
     Face[] result = _panasonicDirectory.GetRecognizedFaces();
     NUnit.Framework.Assert.IsNotNull(result);
     Sharpen.Tests.AreEqual(expResult, result[0]);
 }
 public virtual void TestGetDetectedFaces()
 {
     Face expResult = new Face(142, 120, 76, 76, null, null);
     Face[] result = _panasonicDirectory.GetDetectedFaces();
     NUnit.Framework.Assert.IsNotNull(result);
     Sharpen.Tests.AreEqual(expResult, result[0]);
 }
Beispiel #3
0
 public override bool Equals(object o)
 {
     if (this == o)
     {
         return(true);
     }
     if (o == null || GetType() != o.GetType())
     {
         return(false);
     }
     Com.Drew.Metadata.Face face = (Com.Drew.Metadata.Face)o;
     if (_height != face._height)
     {
         return(false);
     }
     if (_width != face._width)
     {
         return(false);
     }
     if (_x != face._x)
     {
         return(false);
     }
     if (_y != face._y)
     {
         return(false);
     }
     if (_age != null ? !_age.Equals(face._age) : face._age != null)
     {
         return(false);
     }
     if (_name != null ? !_name.Equals(face._name) : face._name != null)
     {
         return(false);
     }
     return(true);
 }
		public virtual Face[] GetRecognizedFaces()
		{
			sbyte[] bytes = GetByteArray(TagFaceRecognitionInfo);
			if (bytes == null)
			{
				return null;
			}
			RandomAccessReader reader = new ByteArrayReader(bytes);
			reader.SetMotorolaByteOrder(false);
			try
			{
				int faceCount = reader.GetUInt16(0);
				if (faceCount == 0)
				{
					return null;
				}
				Face[] faces = new Face[faceCount];
				for (int i = 0; i < faceCount; i++)
				{
					int offset = 4 + i * 44;
					string name = Sharpen.Extensions.Trim(reader.GetString(offset, 20, "ASCII"));
					string age = Sharpen.Extensions.Trim(reader.GetString(offset + 28, 20, "ASCII"));
					faces[i] = new Face(reader.GetUInt16(offset + 20), reader.GetUInt16(offset + 22), reader.GetUInt16(offset + 24), reader.GetUInt16(offset + 26), name, Age.FromPanasonicString(age));
				}
				return faces;
			}
			catch (IOException)
			{
				return null;
			}
		}
		public virtual Face[] GetDetectedFaces()
		{
			sbyte[] bytes = GetByteArray(TagFaceDetectionInfo);
			if (bytes == null)
			{
				return null;
			}
			RandomAccessReader reader = new ByteArrayReader(bytes);
			reader.SetMotorolaByteOrder(false);
			try
			{
				int faceCount = reader.GetUInt16(0);
				if (faceCount == 0)
				{
					return null;
				}
				Face[] faces = new Face[faceCount];
				for (int i = 0; i < faceCount; i++)
				{
					int offset = 2 + i * 8;
					faces[i] = new Face(reader.GetUInt16(offset), reader.GetUInt16(offset + 2), reader.GetUInt16(offset + 4), reader.GetUInt16(offset + 6), null, null);
				}
				return faces;
			}
			catch (IOException)
			{
				return null;
			}
		}