Beispiel #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;
        }
Beispiel #2
0
        public bool SaveSelectedModelAs()
        {
            SaveFileDialog sf = new SaveFileDialog();

            sf.InitialDirectory = AppDomain.CurrentDomain.BaseDirectory + GLSettings.PathPointClouds;

            if (sf.ShowDialog() == DialogResult.OK)
            {
                string name = sf.FileName;

                if (IOUtils.ExtractExtension(sf.FileName) == null)
                {
                    sf.FileName = sf.FileName + ".obj";
                }


                if (this.GLrender.RenderableObjects.Count > 0)
                {
                    RenderableObject o = null;
                    o = this.GLrender.RenderableObjects[this.GLrender.SelectedModelIndex];

                    if (o != null)
                    {
                        PointCloud pc = o.PointCloud;
                        pc.ToObjFile(sf.FileName);
                    }
                }
                else
                {
                    System.Windows.Forms.MessageBox.Show("please switch to 3D Tab if scanning is in progress - (nothing to save) ");
                    return(false);
                }
            }
            return(true);
        }
Beispiel #3
0
        private void SaveResultCloudAndShow(PointCloud pointCloudResult)
        {
            //-------------------------------------
            //save
            if (pointCloudResult != null)
            {
                string path, fileNameShort;

                IOUtils.ExtractDirectoryAndNameFromFileName(pointCloudResult.FileNameLong, out fileNameShort, out path);
                pointCloudResult.ToObjFile(pointCloudResult.Path, "Result.obj");


                this.pResult = pointCloudResult;
                //pResult.SetColor(new OpenTK.Vector3(1, 0, 0));

                DisplayResultPointCloud();
            }
        }
Beispiel #4
0
        public bool SaveSelectedModel()
        {
            if (this.GLrender.RenderableObjects.Count > 0)
            {
                RenderableObject o = null;
                o = this.GLrender.RenderableObjects[this.GLrender.SelectedModelIndex];

                if (o != null)
                {
                    PointCloud pc = o.PointCloud;
                    pc.ToObjFile(pc.FileNameLong);
                }
            }
            else
            {
                System.Windows.Forms.MessageBox.Show("please switch to 3D Tab if scanning is in progress - (nothing to save) ");
                return(false);
            }
            return(true);
        }