Exemple #1
0
        private static void GetParameters()
        {
            double[] cameraparams = new double[(int)CAMERA_Param.CAMERA_PARAMS_MAX];
            if (SeeThrough.SRWork_SeeThrough.b4KImageReady)
            {
                SRWorkModule_API.Get4KCameraParams(cameraparams);
            }
            else
            {
                SRWorkModule_API.GetCameraParams(cameraparams);
            }

            DistortedCx_L = cameraparams[0];
            DistortedCy_L = cameraparams[2];
            DistortedCx_R = cameraparams[1];
            DistortedCy_R = cameraparams[3];
            FocalLength_L = cameraparams[4];
            FocalLength_R = cameraparams[5];

            if (SeeThrough.SRWork_SeeThrough.b4KImageReady)
            {
                SRWorkModule_API.GetSeeThroug4KParameterInt((int)SeeThrough4KParam.OUTPUT_DISTORTED_4K_WIDTH, ref DistortedImageWidth);
                SRWorkModule_API.GetSeeThroug4KParameterInt((int)SeeThrough4KParam.OUTPUT_DISTORTED_4K_HEIGHT, ref DistortedImageHeight);
                SRWorkModule_API.GetSeeThroug4KParameterInt((int)SeeThrough4KParam.OUTPUT_DISTORTED_4K_CHANNEL, ref DistortedImageChannel);

                SRWorkModule_API.GetSeeThroug4KParameterInt((int)SeeThrough4KParam.OUTPUT_UNDISTORTED_4K_WIDTH, ref UndistortedImageWidth);
                SRWorkModule_API.GetSeeThroug4KParameterInt((int)SeeThrough4KParam.OUTPUT_UNDISTORTED_4K_HEIGHT, ref UndistortedImageHeight);
                SRWorkModule_API.GetSeeThroug4KParameterInt((int)SeeThrough4KParam.OUTPUT_UNDISTORTED_4K_CHANNEL, ref UndistortedImageChannel);
            }
            else
            {
                SRWorkModule_API.GetSeeThrougParameterInt((int)SeeThroughParam.OUTPUT_DISTORTED_WIDTH, ref DistortedImageWidth);
                SRWorkModule_API.GetSeeThrougParameterInt((int)SeeThroughParam.OUTPUT_DISTORTED_HEIGHT, ref DistortedImageHeight);
                SRWorkModule_API.GetSeeThrougParameterInt((int)SeeThroughParam.OUTPUT_DISTORTED_CHANNEL, ref DistortedImageChannel);

                SRWorkModule_API.GetSeeThrougParameterInt((int)SeeThroughParam.OUTPUT_UNDISTORTED_WIDTH, ref UndistortedImageWidth);
                SRWorkModule_API.GetSeeThrougParameterInt((int)SeeThroughParam.OUTPUT_UNDISTORTED_HEIGHT, ref UndistortedImageHeight);
                SRWorkModule_API.GetSeeThrougParameterInt((int)SeeThroughParam.OUTPUT_UNDISTORTED_CHANNEL, ref UndistortedImageChannel);
            }

            if (ViveSR.Instance.EnableDepthModule)
            {
                SRWorkModule_API.GetDepthParameterInt((int)DepthParam.OUTPUT_WIDTH, ref DepthImageWidth);
                SRWorkModule_API.GetDepthParameterInt((int)DepthParam.OUTPUT_HEIGHT, ref DepthImageHeight);
                SRWorkModule_API.GetDepthParameterInt((int)DepthParam.OUTPUT_CHAANEL_1, ref DepthImageChannel);
                SRWorkModule_API.GetDepthParameterDouble((int)DepthParam.BASELINE, ref Baseline);
            }

            int undistortionMapSize = 0;

            SRWorkModule_API.GetSeeThrougParameterInt((int)SeeThroughParam.UNDISTORTION_MAP_SIZE, ref undistortionMapSize);

            //Todo : Runtime support structure data passing to client.
            //UndistortionMap_L = new float[undistortionMapSize / sizeof(float)];
            //UndistortionMap_R = new float[undistortionMapSize / sizeof(float)];
            //ViveSR_Framework.GetParameterFloatArray(ViveSR_Framework.MODULE_ID_SEETHROUGH, (int)SeeThroughParam.UNDISTORTION_MAP_L, ref UndistortionMap_L);
            //ViveSR_Framework.GetParameterFloatArray(ViveSR_Framework.MODULE_ID_SEETHROUGH, (int)SeeThroughParam.UNDISTORTION_MAP_R, ref UndistortionMap_R);


            UndistortedCx_L = cameraparams[18];
            UndistortedCy_L = cameraparams[19];
            UndistortedCx_R = cameraparams[20];
            UndistortedCy_R = cameraparams[21];

            //Get offset head to camera from hardware design.
            if (SeeThrough.SRWork_SeeThrough.b4KImageReady)
            {
                SRWorkModule_API.GetSeeThroug4KParameterFloat((int)SeeThrough4KParam.OFFSET_HEAD_TO_4K_CAMERA_x0, ref OffsetHeadToCamera[0]);
                SRWorkModule_API.GetSeeThroug4KParameterFloat((int)SeeThrough4KParam.OFFSET_HEAD_TO_4K_CAMERA_y0, ref OffsetHeadToCamera[1]);
                SRWorkModule_API.GetSeeThroug4KParameterFloat((int)SeeThrough4KParam.OFFSET_HEAD_TO_4K_CAMERA_z0, ref OffsetHeadToCamera[2]);
                SRWorkModule_API.GetSeeThroug4KParameterFloat((int)SeeThrough4KParam.OFFSET_HEAD_TO_4K_CAMERA_x1, ref OffsetHeadToCamera[3]);
                SRWorkModule_API.GetSeeThroug4KParameterFloat((int)SeeThrough4KParam.OFFSET_HEAD_TO_4K_CAMERA_y1, ref OffsetHeadToCamera[4]);
                SRWorkModule_API.GetSeeThroug4KParameterFloat((int)SeeThrough4KParam.OFFSET_HEAD_TO_4K_CAMERA_z1, ref OffsetHeadToCamera[5]);
            }
            else
            {
                SRWorkModule_API.GetSeeThrougParameterFloat((int)SeeThroughParam.OFFSET_HEAD_TO_CAMERA_x0, ref OffsetHeadToCamera[0]);
                SRWorkModule_API.GetSeeThrougParameterFloat((int)SeeThroughParam.OFFSET_HEAD_TO_CAMERA_y0, ref OffsetHeadToCamera[1]);
                SRWorkModule_API.GetSeeThrougParameterFloat((int)SeeThroughParam.OFFSET_HEAD_TO_CAMERA_z0, ref OffsetHeadToCamera[2]);
                SRWorkModule_API.GetSeeThrougParameterFloat((int)SeeThroughParam.OFFSET_HEAD_TO_CAMERA_x1, ref OffsetHeadToCamera[3]);
                SRWorkModule_API.GetSeeThrougParameterFloat((int)SeeThroughParam.OFFSET_HEAD_TO_CAMERA_y1, ref OffsetHeadToCamera[4]);
                SRWorkModule_API.GetSeeThrougParameterFloat((int)SeeThroughParam.OFFSET_HEAD_TO_CAMERA_z1, ref OffsetHeadToCamera[5]);
            }
        }