コード例 #1
0
        private void buttonDepthErrorEvaluation_Click(object sender, RoutedEventArgs e)
        {
            //以下改造
            MotionDataHandler handler;
            string            path;

            if (openMotionData(out handler, out path))
            {
                CvMat         resultMat    = null;
                List <double> errorVarList = new List <double>();
                int           length       = handler.FrameCount;

                IEnumerable <CvMat> depthImages;
                Utility.LoadImages(handler.GetDepthImagePaths(), out depthImages);

                foreach (CvMat depthMat in depthImages)
                {
                    double errorVar = DepthUndistortionLinearCalibrator.EvaluateUndistortion(ref resultMat, depthMat, _undistortion);
                    errorVarList.Add(errorVar);
                    viewDepthUndistionMat(resultMat, depthMat);
                }
                displayLabels();
                viewDepthUndistionMat(this.UndistortionData.UndistortionDepthMat);
                if (errorVarList.Count > 0)
                {
                    double errorVarAvg = errorVarList.Average();
                    System.Windows.MessageBox.Show(string.Format("誤差分散の平均: {0}", errorVarAvg));
                }
            }
        }
コード例 #2
0
        private void buttonFlatDepthCalib_Click(object sender, RoutedEventArgs e)
        {
            // 改造
            string            path1;
            MotionDataHandler handler1;
            {
                if (openMotionData(out handler1, out path1))
                {
                    IEnumerable <CvMat> depthImages1 = null;
                    Utility.LoadImages(handler1.GetDepthImagePaths(), out depthImages1);

                    List <double> errorVarLog = new List <double>();
                    CvMat         resultMat   = null;

                    if (ProgressData.DoAction(progress =>
                    {
                        int length = handler1.FrameCount;
                        progress.InitProgress("Calculating...", length);
                        DepthUndistortionLinearCalibrator undistort = new DepthUndistortionLinearCalibrator(this.UndistortionData.CameraStruct, 1);
                        CvMat mat = null;

                        foreach (CvMat depthMat in depthImages1)
                        {
                            progress.CurrentValue++;
                            CalcEx.SmoothDepthStep(ref mat, depthMat, 19);
                            undistort.PutDepthImage(ref resultMat, mat, _undistortion);
                            viewDepthUndistionMat(resultMat, depthMat);
                        }

                        this.UndistortionData.SetUndistortionDepthMat(undistort.GetUndistortCoefMat(), path1);
                    }, "Flat Depth Calib", true))
                    {
                        displayLabels();
                        viewDepthUndistionMat(this.UndistortionData.UndistortionDepthMat);
                    }
                }
            }
        }
コード例 #3
0
        private void buttonFlatDepthCalib_Click(object sender, RoutedEventArgs e)
        {
            // 改造
            string path1;
            MotionDataHandler handler1;
            {
                if (openMotionData(out handler1, out path1))
                {
                    IEnumerable<CvMat> depthImages1 = null;
                    Utility.LoadImages(handler1.GetDepthImagePaths(), out depthImages1);

                    List<double> errorVarLog = new List<double>();
                    CvMat resultMat = null;

                    if (ProgressData.DoAction(progress =>
                    {
                        int length = handler1.FrameCount;
                        progress.InitProgress("Calculating...", length);
                        DepthUndistortionLinearCalibrator undistort = new DepthUndistortionLinearCalibrator(this.UndistortionData.CameraStruct, 1);
                        CvMat mat = null;

                        foreach (CvMat depthMat in depthImages1)
                        {
                            progress.CurrentValue++;
                            CalcEx.SmoothDepthStep(ref mat, depthMat, 19);
                            undistort.PutDepthImage(ref resultMat, mat, _undistortion);
                            viewDepthUndistionMat(resultMat, depthMat);
                        }

                        this.UndistortionData.SetUndistortionDepthMat(undistort.GetUndistortCoefMat(), path1);
                    }, "Flat Depth Calib", true))
                    {
                        displayLabels();
                        viewDepthUndistionMat(this.UndistortionData.UndistortionDepthMat);
                    }
                }
            }
        }