Ejemplo n.º 1
0
        protected override void Start()
        {
            // Load global camera benchmark settings.
            int width, height, framerate;

            NatCamWithOpenCVForUnityExample.CameraConfiguration(out width, out height, out framerate);
            NatCamWithOpenCVForUnityExample.ExampleSceneConfiguration(out performImageProcessingEachTime);
            // Create camera source
            cameraSource = new NatCamSource(width, height, framerate, useFrontCamera);
            if (!cameraSource.activeCamera)
            {
                cameraSource = new NatCamSource(width, height, framerate, !useFrontCamera);
            }
            cameraSource.StartPreview(OnStart, OnFrame);
            // Create comic filter
            comicFilter = new ComicFilter();

            exampleTitle      = "[NatCamWithOpenCVForUnity Example] (" + NatCamWithOpenCVForUnityExample.GetNatCamVersion() + ")";
            exampleSceneTitle = "- Integration With NatShare Example";

            fpsMonitor = GetComponent <FpsMonitor>();
            if (fpsMonitor != null)
            {
                fpsMonitor.Add("Name", "IntegrationWithNatShareExample");
                fpsMonitor.Add("performImageProcessingEveryTime", performImageProcessingEachTime.ToString());
                fpsMonitor.Add("onFrameFPS", onFrameFPS.ToString("F1"));
                fpsMonitor.Add("drawFPS", drawFPS.ToString("F1"));
                fpsMonitor.Add("width", "");
                fpsMonitor.Add("height", "");
                fpsMonitor.Add("isFrontFacing", "");
                fpsMonitor.Add("orientation", "");
            }
        }
Ejemplo n.º 2
0
        protected override void Start()
        {
            // Load global camera benchmark settings.
            int width, height, framerate;

            NatCamWithOpenCVForUnityExample.CameraConfiguration(out width, out height, out framerate);
            NatCamWithOpenCVForUnityExample.ExampleSceneConfiguration(out performImageProcessingEachTime);
            // Create camera source
            cameraSource = new NatCamSource(width, height, framerate, useFrontCamera);
            if (cameraSource.activeCamera == null)
            {
                cameraSource = new NatCamSource(width, height, framerate, !useFrontCamera);
            }
            cameraSource.StartPreview(OnStart, OnFrame);
            // Update UI
            imageProcessingTypeDropdown.value = (int)imageProcessingType;
            matCaptureMethodDropdown.value    = (int)matCaptureMethod;

            fpsMonitor = GetComponent <FpsMonitor>();
            if (fpsMonitor != null)
            {
                fpsMonitor.Add("Name", "NatCamPreviewToMatExample");
                fpsMonitor.Add("performImageProcessingEveryTime", performImageProcessingEachTime.ToString());
                fpsMonitor.Add("onFrameFPS", onFrameFPS.ToString("F1"));
                fpsMonitor.Add("drawFPS", drawFPS.ToString("F1"));
                fpsMonitor.Add("width", "");
                fpsMonitor.Add("height", "");
                fpsMonitor.Add("orientation", "");
            }
        }