Example #1
0
        private void testAlignToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            string fileName1 = @"A:\Archiv\3D\_Models\Chair_DifferentAngles\G1.obj";
            string fileName2 = @"A:\Archiv\3D\_Models\Chair_DifferentAngles\G2.obj";


            tabControlImages.SelectTab(0);


            PointCloudRenderable pcr = new PointCloudRenderable();

            pcr.PointCloud = new PointCloud(fileName1);

            IOUtils.ExtractDirectoryAndNameFromFileName(fileName1, out pcr.PointCloud.FileNameLong, out pcr.PointCloud.Path);
            this.OglControl.GLrender.AddRenderableObject(pcr);

            //this.OglControl1.GLrender.ReplaceRenderableObject(pcr, true);


            pcr            = new PointCloudRenderable();
            pcr.PointCloud = new PointCloud(fileName2);
            IOUtils.ExtractDirectoryAndNameFromFileName(fileName2, out pcr.PointCloud.FileNameLong, out pcr.PointCloud.Path);



            this.OglControl.GLrender.AddRenderableObject(pcr);
        }
Example #2
0
        private void UpdateOpenGLControl()
        {
            try
            {
                this.openGLControl.GLrender.AdditionalObjectsToDraw.Clear();
                //this is the most time consuming part - mapping the color frame to depth
                PointCloudRenderable pcr = this.ToPointCloudRenderable(false);
                //filter out only calibration model
                if (PointCloudScannerSettings.ShowOnlyCalibrationPointCloud)
                {
                    pcr.PointCloud = pcr.PointCloud.ExtractCalibrationObject();
                }
                else if//show only face
                (PointCloudScannerSettings.ShowFaceScanEllipse)
                {
                    pcr.PointCloud = pcr.PointCloud.ExtractFace(this.ellipseFace);
                }

                if (pcr != null && pcr.PointCloud.Vectors.Length > 0)
                {
                    this.openGLControl.GLrender.ReplaceRenderableObject(pcr, true);

                    //draw additional objects like axes, Skeleton, ellipse for face scan

                    if (this.kinectSkeleton.BonesAsLines != null && this.kinectSkeleton.BonesAsLines.Count > 0)
                    {
                        if (skeleton == null)
                        {
                            skeleton = new Skeleton(kinectSkeleton.BonesAsLines);
                            skeleton.InitializeGL();
                        }
                        else
                        {
                            skeleton.Update(kinectSkeleton.BonesAsLines);
                        }
                        this.openGLControl.GLrender.AdditionalObjectsToDraw.Add(skeleton);
                    }
                    if (this.pointsFace != null && this.pointsFace.Count > 0)
                    {
                        Face f = this.openGLControl.GLrender.UpdateFace(pointsFace);
                        this.openGLControl.GLrender.AdditionalObjectsToDraw.Add(f);
                    }
                    if (PointCloudScannerSettings.ShowFaceScanEllipse)
                    {
                        //ellipseFace = new Ellipse(0.3f, 0.5f, 0.6f);
                        ellipseFace.InitializeGL();
                        this.openGLControl.GLrender.AdditionalObjectsToDraw.Add(ellipseFace);
                    }
                }
            }
            catch (Exception err)
            {
                //System.Windows.Forms.MessageBox.Show("Error in Update OpenGL window" + err.Message);
                System.Diagnostics.Debug.WriteLine("Error in Update OpenGL window: " + err.Message);
            }
        }
Example #3
0
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string path    = AppDomain.CurrentDomain.BaseDirectory + "TestData";
            Model  myModel = new Model(path + "\\Bunny.obj");

            PointCloud           pgl = myModel.PointCloud;
            PointCloudRenderable pcr = new PointCloudRenderable();

            pcr.PointCloud = pgl;

            ReplaceRenderableObject(pcr);
        }
Example #4
0
 private void UpdateOpenGLControl()
 {
     try
     {
         //this.parentControl.UpdateOpenGLFramesPerSecond();
         PointCloudRenderable pcr = this.ToPointCloudRenderable(true);
         if (pcr != null)
         {
             this.openGLControl.GLrender.ReplaceRenderableObject(pcr, true);
         }
     }
     catch (Exception err)
     {
         //System.Windows.Forms.MessageBox.Show("Error in Update OpenGL window" + err.Message);
         System.Diagnostics.Debug.WriteLine("Error in Update OpenGL window: " + err.Message);
     }
 }
Example #5
0
        public override PointCloudRenderable ToPointCloudRenderable(bool resizeTo1)
        {
            PointCloudRenderable pcr = new PointCloudRenderable();

            this.pointCloudBase = PointCloud.FromListVector3(this.DepthMetaData.Vectors);
            //SetDefaultColorForDepth();

            if (this.pointCloudBase != null && this.pointCloudBase.Vectors.Length > 0)
            {
                if (resizeTo1)
                {
                    pointCloudBase.ResizeTo1();
                }
                pcr.PointCloud = pointCloudBase;
                return(pcr);
            }
            return(null);
        }
Example #6
0
        public override PointCloudRenderable ToPointCloudRenderable(bool resizeTo1)
        {
            //string directory = GLSettings.Path + GLSettings.PathModels + "\\Nick";
            //string[] files = IOUtils.FileNamesSorted(directory, "*.obj");


            //PointCloud pc1 = PointCloud.FromObjFile(files[0]);
            //PointCloudRenderable pcr1 = new PointCloudRenderable();
            //pcr1.PointCloud = pc1;
            //return pcr1;


            if (this.ColorMetaData != null && this.DepthMetaData != null)
            {
                PointCloud pc = MetaDataBase.ToPointCloud(this.ColorMetaData, this.DepthMetaData, this.BodyMetaData, this.coordinateMapper);

                PointCloudRenderable pcr = new PointCloudRenderable();
                pcr.PointCloud = pc;

                return(pcr);
            }
            return(null);
        }
Example #7
0
        private void OpenFilesDialog_SinglePC()
        {
            OpenFileDialog openPointCloud = new OpenFileDialog();

            if (openPointCloud.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            tabControlImages.SelectTab(0);
            PointCloud pc = PointCloud.FromObjFile(openPointCloud.FileName);


            PointCloudRenderable pcr = new PointCloudRenderable();

            pcr.PointCloud = pc;
            IOUtils.ExtractDirectoryAndNameFromFileName(openPointCloud.FileName, out pc.FileNameLong, out pc.Path);

            this.openGLUC.ShowPointCloud_ClearAllOthers(pc);
            this.Refresh();

            //this.OglControl.GLrender.ReplaceRenderableObject(pcr, true);
        }
Example #8
0
        private void OpenFilesDialog_MultiplePC()
        {
            OpenFileDialog openPointCloud = new OpenFileDialog();

            openPointCloud.Multiselect = true;

            if (openPointCloud.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            if (openPointCloud.FileNames != null && openPointCloud.FileNames.Length > 1)
            {
                tabControlImages.SelectTab(0);

                PointCloudRenderable pcr = new PointCloudRenderable();
                pcr.PointCloud = new PointCloud(openPointCloud.FileNames[0]);
                //pcr.PointCloudOpenGL.RotateDegrees(0f, -45f, 0f);
                IOUtils.ExtractDirectoryAndNameFromFileName(openPointCloud.FileNames[0], out pcr.PointCloud.FileNameLong, out pcr.PointCloud.Path);
                //this.OglControl1.GLrender.ReplaceRenderableObject(pcr, true);
                this.OglControl.GLrender.AddRenderableObject(pcr);


                pcr            = new PointCloudRenderable();
                pcr.PointCloud = new PointCloud(openPointCloud.FileNames[1]);
                IOUtils.ExtractDirectoryAndNameFromFileName(openPointCloud.FileNames[1], out pcr.PointCloud.FileNameLong, out pcr.PointCloud.Path);

                // pcr.PointCloudOpenGL.RotateDegrees(0f, -45f, 0f);
                //pcr.PointCloudOpenGL.Translate(-4f, 0f, 2f);

                this.OglControl.GLrender.AddRenderableObject(pcr);
            }
            else
            {
                OpenFilesDialog_SinglePC();
            }
        }