Esempio n. 1
0
        public MainWindow(string[] args)
        {
            // Set configuration parameters
            InitParameters init_params = new InitParameters();

            init_params.resolution       = RESOLUTION.HD720;
            init_params.cameraFPS        = 60;
            init_params.depthMode        = DEPTH_MODE.ULTRA;
            init_params.coordinateUnits  = UNIT.METER;
            init_params.coordinateSystem = COORDINATE_SYSTEM.RIGHT_HANDED_Y_UP;
            init_params.sdkVerbose       = true;

            parseArgs(args, ref init_params);
            // Open the camera
            zedCamera = new Camera(0);
            ERROR_CODE err = zedCamera.Open(ref init_params);

            if (err != ERROR_CODE.SUCCESS)
            {
                Environment.Exit(-1);
            }

            if (zedCamera.CameraModel != sl.MODEL.ZED2)
            {
                Console.WriteLine(" ERROR : Use ZED2 Camera only");
                return;
            }

            findPlaneStatus = ERROR_CODE.FAILURE;
            tracking_state  = POSITIONAL_TRACKING_STATE.OFF;

            hasIMU     = zedCamera.GetSensorsConfiguration().gyroscope_parameters.isAvailable;
            userAction = new UserAction();
            // Enable tracking
            PositionalTrackingParameters positionalTrackingParameters = new PositionalTrackingParameters();

            zedCamera.EnablePositionalTracking(ref positionalTrackingParameters);

            runtimeParameters = new RuntimeParameters();
            runtimeParameters.measure3DReferenceFrame = REFERENCE_FRAME.WORLD;
            // Create ZED Objects filled in the main loop
            zedMat   = new Mat();
            cam_pose = new Pose();

            //Create mesh.
            planeMeshTriangles = new int[65000];
            planeMeshVertices  = new Vector3[65000];
            plane = new PlaneData();
            int Height = zedCamera.ImageHeight;
            int Width  = zedCamera.ImageWidth;

            Resolution res = new Resolution((uint)Width, (uint)Height);

            zedMat.Create(res, MAT_TYPE.MAT_8U_C4, MEM.CPU);

            // Create OpenGL Viewer
            viewer = new GLViewer(new Resolution((uint)Width, (uint)Height));

            // Create OpenGL window
            CreateWindow();
        }
Esempio n. 2
0
 public void updateMesh(Vector3[] vertices, int[] triangles, int nbVertices, int nbTriangles, PLANE_TYPE type, Vector3[] bounds, UserAction userAction)
 {
     meshObject.updateMesh(vertices, triangles, nbVertices, nbTriangles, bounds);
     meshObject.type = type;
     this.userAction = userAction;
 }