コード例 #1
0
        private void toolStripOutliersBatch_Click(object sender, EventArgs e)
        {
            string directory  = GLSettings.Path + GLSettings.PathPointClouds + "\\Nick";
            string pathResult = directory + "\\clean";

            string[] files = IOUtils.FileNamesSorted(directory, "*.obj");

            if (!System.IO.Directory.Exists(pathResult))
            {
                System.IO.Directory.CreateDirectory(pathResult);
            }

            for (int i = 0; i < files.Length; i++)
            {
                PointCloud pointCloudDirty = PointCloud.FromObjFile(files[i]);

                int   thresholdNeighboursCount = 10;
                float thresholdDistance        = 4e-4f;

                PointCloud pcOutliers;
                PointCloud pointCloudClean = OpenTKExtension.Outliers.ByStandardDeviation(pointCloudDirty, thresholdNeighboursCount, thresholdDistance, out pcOutliers);

                // tweaks

                //PointCloud pointCloudClean = tree.RemoveOutliersNeighbour(PointCloudDirty, thresholdDistance, thresholdNeighboursCount);

                pointCloudClean.ToObjFile(pathResult + "\\CleanPointCloudSequence#" + i.ToString() + ".obj");
            }

            //testClouds_FirstIteration();

            return;
        }
コード例 #2
0
ファイル: _OpenGLUC.cs プロジェクト: whigg/PointClouds
        private void toolStripLoadPointCloud_Click(object sender, EventArgs e)
        {
            string     fileName = LoadFileDialog();
            PointCloud pc       = PointCloud.FromObjFile(fileName);

            //PointCloud myPointCloud = new PointCloud(fileName);
            pointCloudFirstAfterLoad = pc;
            //ShowPointCloud(pointCloudFirstAfterLoad);
            ShowPointCloud_ClearAllOthers(pointCloudFirstAfterLoad);
            //ShowPointCloud(myPointCloud);
        }
コード例 #3
0
        public void LoadPointCloudFromFile(string fileName, bool clearOthers)
        {
            PointCloud pc = PointCloud.FromObjFile(fileName);

            if (clearOthers)
            {
                ShowPointCloud_ClearAllOthers(pc);
            }
            else
            {
                ShowPointCloud(pc);
            }
        }
コード例 #4
0
        private void testClouds()
        {
            ICPLib.IterativeClosestPointTransform icp = new ICPLib.IterativeClosestPointTransform();

            pTarget = null;

            for (int i = 0; i < 10; i++)
            {
                //first iteration
                if (pTarget == null)
                {
                    pTarget = PointCloud.FromObjFile(GLSettings.Path + GLSettings.PathPointClouds, "Nick\\PointCloudSequence#" + (i).ToString() + ".obj");
                }



                pSource = PointCloud.FromObjFile(GLSettings.Path + GLSettings.PathPointClouds, "Nick\\PointCloudSequence#" + (i + 1).ToString() + ".obj");

                //------------------
                //ICP

                icp.Reset_RealData();
                //icp.ICPSettings.ThresholdMergedPoints = 0f;
                icp.ICPSettings.MaximumNumberOfIterations = 15;


                pTarget = icp.PerformICP(pSource, this.pTarget);
                System.Diagnostics.Debug.WriteLine("###### ICP for point cloud: " + pTarget.Name + " - points added: " + icp.PointsAdded.ToString());


                //   this.registrationMatrix = icp.Matrix;
                //   registrationMatrix.Save(GLSettings.Path + GLSettings.PathPointClouds, "registrationMatrix.txt");
            }
            GlobalVariables.ShowLastTimeSpan("--> Time for ICP ");

            SaveResultCloudAndShow(pTarget);
        }