private float GetIrisRadius(Transform screenTransform, NormalizedLandmark l1, NormalizedLandmark l2, NormalizedLandmark l3, NormalizedLandmark l4)
    {
        var r1 = GetDistance(screenTransform, l1, l3);
        var r2 = GetDistance(screenTransform, l2, l4);

        return((r1 + r2) / 4);
    }
        private float CalculateDistance(UnityEngine.Rect rect, NormalizedLandmark a, NormalizedLandmark b)
        {
            var aPos = rect.GetPoint(a, rotationAngle, isMirrored);
            var bPos = rect.GetPoint(b, rotationAngle, isMirrored);

            aPos.z = 0.0f;
            bPos.z = 0.0f;
            return(Vector3.Distance(aPos, bPos));
        }
Example #3
0
        float CalculateDistance(RectTransform rectTransform, NormalizedLandmark a, NormalizedLandmark b)
        {
            var aPos = rectTransform.GetLocalPosition(a, rotationAngle, isMirrored);
            var bPos = rectTransform.GetLocalPosition(b, rotationAngle, isMirrored);

            aPos.z = 0.0f;
            bPos.z = 0.0f;
            return(Vector3.Distance(aPos, bPos));
        }
Example #4
0
 public void Draw(NormalizedLandmark target, bool visualizeZ = true)
 {
     if (ActivateFor(target))
     {
         var position = GetAnnotationLayer().GetLocalPosition(target, rotationAngle, isMirrored);
         if (!visualizeZ)
         {
             position.z = 0.0f;
         }
         transform.localPosition = position;
     }
 }
Example #5
0
 /// <summary>
 ///   Get the coordinates represented by <paramref name="normalizedLandmark" /> in local coordinate system.
 /// </summary>
 /// <param name="rectTransform">
 ///   <see cref="RectTransform" /> to be used for calculating local coordinates
 /// </param>
 /// <param name="imageRotation">Counterclockwise rotation angle of the input image</param>
 /// <param name="isMirrored">Set to true if the original coordinates is mirrored</param>
 public static Vector3 GetLocalPosition(this RectTransform rectTransform, NormalizedLandmark normalizedLandmark, RotationAngle imageRotation = RotationAngle.Rotation0, bool isMirrored = false)
 {
     return(GetLocalPositionNormalized(rectTransform, normalizedLandmark.X, normalizedLandmark.Y, normalizedLandmark.Z, imageRotation, isMirrored));
 }
 public void Correct(NormalizedLandmark landmark)
 {
     kalmanFilter.Correct(landmark);
 }
 /// <summary>
 ///   Get the coordinates represented by <paramref name="normalizedLandmark" /> in the local coordinate system.
 /// </summary>
 /// <param name="rectangle">Rectangle to get a point inside</param>
 /// <param name="imageRotation">
 ///   Counterclockwise rotation angle of the input image in the image coordinate system.
 ///   In the local coordinate system, this value will often represent a clockwise rotation angle.
 /// </param>
 /// <param name="isMirrored">Set to true if the original coordinates is mirrored</param>
 public static Vector3 GetPoint(this UnityEngine.Rect rectangle, NormalizedLandmark normalizedLandmark,
                                RotationAngle imageRotation = RotationAngle.Rotation0, bool isMirrored = false)
 {
     return(ImageNormalizedToPoint(rectangle, normalizedLandmark.X, normalizedLandmark.Y, normalizedLandmark.Z, imageRotation, isMirrored));
 }