Пример #1
0
        public void TearDown()
        {
            var result = TestContext.CurrentContext.Result.Outcome.Status.Equals(TestStatus.Failed)
                ? "Failed"
                : "Successful";
            var workingDirectory = Environment.CurrentDirectory;
            var testFullName     = TestContext.CurrentContext.Test.Name;
            var savePath         = workingDirectory + "\\" + result + "Test" + testFullName + ".bmp";

            Console.WriteLine("Tag cloud visualization saved to file " + savePath);
            TagDrawer.Draw(savePath, cloudLayouter);
        }
Пример #2
0
    void Update()
    {
        // Check if the webcam is ready (needed for macOS support)
        if (_webcamRaw.width <= 16)
        {
            return;
        }

        // Check if the webcam is flipped (needed for iOS support)
        if (_webcamRaw.videoVerticallyMirrored)
        {
            _webcamPreview.transform.localScale = new Vector3(1, -1, 1);
        }

        // Webcam image buffering
        _webcamRaw.GetPixels32(_readBuffer);
        Graphics.Blit(_webcamRaw, _webcamBuffer);

        // AprilTag detection
        var fov = GetComponent <Camera>().fieldOfView *Mathf.Deg2Rad;

        _detector.ProcessImage(_readBuffer, fov, _tagSize);

        // Detected tag visualization
        foreach (var tag in _detector.DetectedTags)
        {
            _drawer.Draw(tag.ID, tag.Position, tag.Rotation, _tagSize);
        }

        // Profile data output (with 30 frame interval)
        if (Time.frameCount % 30 == 0)
        {
            _debugText.text = _detector.ProfileData.Aggregate
                                  ("Profile (usec)", (c, n) => $"{c}\n{n.name} : {n.time}");
        }
    }