public void Draw(Transform screenTransform, ClassificationList handedness, NormalizedLandmarkList handLandmarkList, NormalizedRect handRect, List <Detection> palmDetections, bool isFlipped = false) { handednessAnnotation.GetComponent <ClassificationAnnotationController>().Draw(screenTransform, handedness); handLandmarkListAnnotation.GetComponent <HandLandmarkListAnnotationController>().Draw(screenTransform, handLandmarkList, isFlipped); handRectAnnotation.GetComponent <RectAnnotationController>().Draw(screenTransform, handRect, isFlipped); palmDetectionsAnnotation.GetComponent <DetectionListAnnotationController>().Draw(screenTransform, palmDetections, isFlipped); }
/// <summary> /// Renders a rectangle on a screen. /// It is assumed that the screen is vertical to terrain and not inverted. /// </summary> /// <param name="isFlipped"> /// if true, x axis is oriented from right to left (top-right point is (0, 0) and bottom-left is (1, 1)) /// </param> /// <remarks> /// In <paramref name="rect" />, y-axis is oriented from top to bottom. /// </remarks> public void Draw(Transform screenTransform, NormalizedRect rect, bool isFlipped = false) { var positions = GetPositions(screenTransform, rect, isFlipped); gameObject.GetComponent <LineRenderer>().SetPositions(positions); GameObject parent = GameObject.Find("2DAnnotations"); if (parent) { gameObject.transform.parent = parent.transform; } }
public unsafe static NormalizedRect[] PtrToRectArray(IntPtr ptr, int size) { var rects = new NormalizedRect[size]; NormalizedRect *rectPtr = (NormalizedRect *)ptr; for (var i = 0; i < size; i++) { rects[i] = Marshal.PtrToStructure <NormalizedRect>((IntPtr)rectPtr++); } return(rects); }
public static NormalizedRect[] PtrToRectArray(MpNormalizedRectVector rectVectorPtr) { var rectVector = Marshal.PtrToStructure <NormalizedRectVector>(rectVectorPtr); var rects = new NormalizedRect[rectVector.size]; unsafe { NormalizedRect *rectPtr = (NormalizedRect *)rectVector.rects; for (var i = 0; i < rects.Length; i++) { rects[i] = Marshal.PtrToStructure <NormalizedRect>((IntPtr)rectPtr++); } } return(rects); }
public void Draw(Transform screenTransform, NormalizedLandmarkList landmarkList, NormalizedRect faceRect, List <Detection> faceDetections, bool isFlipped = false) { if (landmarkList == null) { Clear(); return; } var leftIrisLandmarks = GetIrisLandmarks(landmarkList, Side.Left); leftIrisAnnotation.GetComponent <IrisAnnotationController>().Draw(screenTransform, leftIrisLandmarks, isFlipped); var rightIrisLandmarks = GetIrisLandmarks(landmarkList, Side.Right); rightIrisAnnotation.GetComponent <IrisAnnotationController>().Draw(screenTransform, rightIrisLandmarks, isFlipped); faceLandmarkListAnnotation.GetComponent <FaceLandmarkListAnnotationController>().Draw(screenTransform, landmarkList, isFlipped); faceRectAnnotation.GetComponent <RectAnnotationController>().Draw(screenTransform, faceRect, isFlipped); faceDetectionsAnnotation.GetComponent <DetectionListAnnotationController>().Draw(screenTransform, faceDetections, isFlipped); }
protected Vector3[] GetPositions(Transform screenTransform, NormalizedRect rect, bool isFlipped, bool isFiltered) { return(GetPositionsFromNormalizedRect(screenTransform, rect.XCenter, rect.YCenter, rect.Width, rect.Height, rect.Rotation, isFlipped, isFiltered)); }
/// <summary> /// Renders a rectangle on a screen. /// It is assumed that the screen is vertical to terrain and not inverted. /// </summary> /// <param name="isFlipped"> /// if true, x axis is oriented from right to left (top-right point is (0, 0) and bottom-left is (1, 1)) /// </param> /// <remarks> /// In <paramref name="rect" />, y-axis is oriented from top to bottom. /// </remarks> public void Draw(Transform screenTransform, NormalizedRect rect, bool isFlipped = false, bool isFiltered = false) { var positions = GetPositions(screenTransform, rect, isFlipped, isFiltered); gameObject.GetComponent <LineRenderer>().SetPositions(positions); }