示例#1
0
        // Uses VNUtils to calculate the points, just to test the native API
        void ConvertPoints2(VNFaceLandmarkRegion2D landmark, CGRect boundingBox, nuint imgWidth, nuint imgHeight)
        {
            var points             = landmark.Points;
            var faceLandmarkPoints = points.Select(p =>
                                                   VNUtils.GetImagePoint(p, boundingBox, imgWidth, imgHeight)
                                                   );

            DispatchQueue.MainQueue.DispatchAsync(() => {
                Draw(faceLandmarkPoints.ToArray());
            });
        }
        public void GetNormalizedRectTest()
        {
            var normalizedRect = VNUtils.GetImageRect(new CGRect(2, 34, 5, 67), 8, 90, new CGRect(123, 4, 56, 7));

            Assert.That(normalizedRect, Is.Not.EqualTo(CGRect.Empty), "VNNormalizedRectForImageRectUsingRegionOfInterest is not empty");
        }
        public void GetNormalizedPointTest()
        {
            var normalizedPoint = VNUtils.GetNormalizedPoint(new CGPoint(2, 345), 6, 78, new CGRect(90, 12, 34, 56));

            Assert.That(normalizedPoint, Is.Not.EqualTo(CGPoint.Empty), "VNNormalizedPointForImagePointUsingRegionOfInterest is not empty");
        }