/*POINT CLOUD RENDERING*/ public void preprocess(LoadingWidget progressMonitor) { if (this.clouds == null) { //preprocess condition for when we have a single point cloud to convert into point 3ds pcc = new Point3DCollection(); //iterate over each point and stick it in depthframe points for (int i = 0; i < depthFramePoints.Length; i++) { pcc.Add(prgbs[i].point); } createPointCloud(pcc); render(progressMonitor); } else { if (progressMonitor != null) { progressMonitor.ReportProgress(1, "starting preprocess"); } cloudList = new List <Point3DCollection>(); //create a list of point 3d collections for (int i = 0; i < this.clouds.Count; i++) { Point3DCollection pcc = new Point3DCollection(); depthFramePoints = new Point3D[this.clouds[i].getAllPoints().Length]; ICP.PointRGB[] tmp = clouds[i].getAllPoints(); int progressPerCloud = (int)Math.Round((30 / (decimal)this.clouds.Count), 0); double progressPerPoint = progressPerCloud / (this.clouds[i].getAllPoints().Length); //jam into point cloud collection. for (int j = 0; j < depthFramePoints.Length; j++) { pcc.Add(tmp[j].point); } cloudList.Add(pcc); if (progressMonitor != null) { progressMonitor.ReportProgress((int)(progressPerCloud), "Created point cloud " + (i + 1) + " of " + this.clouds.Count); } } // Render the model! if (progressMonitor != null) { progressMonitor.ReportProgress(10, "Rendering"); } render(progressMonitor); } }
public void processCloudList(List <PointCloud> fcloud, LoadingWidget loadingControl) { preventClose = true; wantKinect = false; this.mode = 0; System.Diagnostics.Debug.WriteLine("Number of items in fcloud list: " + fcloud.Count); this.gv = new GroupVisualiser(fcloud); loadingwidgetcontrol.UpdateProgressBy(2); // Run this as separate 'job' on UI thread this.Dispatcher.Invoke( System.Windows.Threading.DispatcherPriority.Normal, (Action)(() => { this.gv = new GroupVisualiser(fcloud); })); loadingwidgetcontrol.UpdateProgressBy(5); // Run this as lower priority 'job' (on UI thread), // with hope that UI remains a bit responsive this.Dispatcher.Invoke( System.Windows.Threading.DispatcherPriority.Input, (Action)(() => { this.gv.preprocess(loadingwidgetcontrol); })); loadingwidgetcontrol.UpdateProgressBy(5); this.hvpcanvas.DataContext = this.gv; loadingwidgetcontrol.UpdateProgressBy(1); this.hitState = 0; // FINALLY, show the controls. this.hvpcanvas.Visibility = Visibility.Visible; this.loadingwidgetcontrol.Visibility = Visibility.Collapsed; preventClose = false; /* * Scanloaderready(); * if (this.mode == (int)OperationModes.CaptureNewCloud) * { * this.start_scan.Visibility = Visibility.Visible; * this.cancel_scan.Visibility = Visibility.Visible; * } * else * { * this.start_scan.Visibility = Visibility.Collapsed; * this.cancel_scan.Visibility = Visibility.Collapsed; * } */ }
public void processCloudList(List<PointCloud> fcloud, LoadingWidget loadingControl) { preventClose = true; wantKinect = false; this.mode = 0; System.Diagnostics.Debug.WriteLine("Number of items in fcloud list: " + fcloud.Count); this.gv = new GroupVisualiser(fcloud); loadingwidgetcontrol.UpdateProgressBy(2); // Run this as separate 'job' on UI thread this.Dispatcher.Invoke( System.Windows.Threading.DispatcherPriority.Normal, (Action)(() => { this.gv = new GroupVisualiser(fcloud); })); loadingwidgetcontrol.UpdateProgressBy(5); // Run this as lower priority 'job' (on UI thread), // with hope that UI remains a bit responsive this.Dispatcher.Invoke( System.Windows.Threading.DispatcherPriority.Input, (Action)(() => { this.gv.preprocess(loadingwidgetcontrol); })); loadingwidgetcontrol.UpdateProgressBy(5); this.hvpcanvas.DataContext = this.gv; loadingwidgetcontrol.UpdateProgressBy(1); this.hitState = 0; // FINALLY, show the controls. this.hvpcanvas.Visibility = Visibility.Visible; this.loadingwidgetcontrol.Visibility = Visibility.Collapsed; preventClose = false; /* * Scanloaderready(); if (this.mode == (int)OperationModes.CaptureNewCloud) { this.start_scan.Visibility = Visibility.Visible; this.cancel_scan.Visibility = Visibility.Visible; } else { this.start_scan.Visibility = Visibility.Collapsed; this.cancel_scan.Visibility = Visibility.Collapsed; } */ }
public void render(LoadingWidget progressMonitor) { if (this.cloudList == null) { //Rendering method for gradient collection. GradientStopCollection gsc = new GradientStopCollection(4); gsc.Add(new GradientStop(Colors.Red, 0.1)); gsc.Add(new GradientStop(Colors.Green, 0.2)); gsc.Add(new GradientStop(Colors.Blue, 0.3)); gsc.Add(new GradientStop(Colors.Orange, 0.4)); runDemoModel(); this.Model.Geometry = createMesh(); this.Model.Material = this.Model.BackMaterial = new DiffuseMaterial(new LinearGradientBrush(gsc, new Point(0, 0), new Point(100, 100))); //this.Model.Material = this.Model.BackMaterial = new DiffuseMaterial(new SolidColorBrush(Colors.LightSteelBlue)); this.Model.Transform = new TranslateTransform3D(-1, -2, 1); } else { int progressPerCloud = 0; if (this.cloudList.Count == 0) { progressPerCloud = 0; } else { progressPerCloud = (int)Math.Round((30 / (decimal)this.cloudList.Count), 0); } runDemoModel(); for (int i = 0; i < this.cloudList.Count; i++) { if (progressMonitor != null) { progressMonitor.ReportProgress(progressPerCloud, "Rendering model " + i + " of " + this.cloudList.Count); } switch (i) { case 0: createPointCloud(this.cloudList[0]); this.Model.Geometry = createMesh(); this.Model.Material = this.Model.BackMaterial = new DiffuseMaterial(new SolidColorBrush(Colors.Red)); this.Model.Transform = new TranslateTransform3D(-1, -2, 1); this.armLabel.Geometry = createTextLabel("THIS IS AN ARM"); break; case 1: mesh = new MeshGeometry3D(); createPointCloud(this.cloudList[1]); this.Model2.Geometry = createMesh(); this.Model2.Material = this.Model2.BackMaterial = new DiffuseMaterial(new SolidColorBrush(Colors.Blue)); this.Model2.Transform = new TranslateTransform3D(-1, -2, 1); break; case 2: mesh = new MeshGeometry3D(); createPointCloud(this.cloudList[2]); this.Model3.Geometry = createMesh(); this.Model3.Material = this.Model3.BackMaterial = new DiffuseMaterial(new SolidColorBrush(Colors.Green)); this.Model3.Transform = new TranslateTransform3D(-1, -2, 1); break; case 3: mesh = new MeshGeometry3D(); createPointCloud(this.cloudList[3]); this.Model4.Geometry = createMesh(); this.Model4.Material = this.Model4.BackMaterial = new DiffuseMaterial(new SolidColorBrush(Colors.Orange)); this.Model4.Transform = new TranslateTransform3D(-1, -2, 1); break; } } } }
public void render(LoadingWidget progressMonitor) { if (this.cloudList == null) { //Rendering method for gradient collection. GradientStopCollection gsc = new GradientStopCollection(4); gsc.Add(new GradientStop(Colors.Red, 0.1)); gsc.Add(new GradientStop(Colors.Green, 0.2)); gsc.Add(new GradientStop(Colors.Blue, 0.3)); gsc.Add(new GradientStop(Colors.Orange, 0.4)); runDemoModel(); this.Model.Geometry = createMesh(); this.Model.Material = this.Model.BackMaterial = new DiffuseMaterial(new LinearGradientBrush(gsc, new Point(0, 0), new Point(100, 100))); //this.Model.Material = this.Model.BackMaterial = new DiffuseMaterial(new SolidColorBrush(Colors.LightSteelBlue)); this.Model.Transform = new TranslateTransform3D(-1, -2, 1); } else { int progressPerCloud = 0; if (this.cloudList.Count == 0) { progressPerCloud = 0; } else { progressPerCloud = (int)Math.Round((30 / (decimal)this.cloudList.Count), 0); } runDemoModel(); for (int i = 0; i < this.cloudList.Count; i++) { if (progressMonitor != null) progressMonitor.ReportProgress(progressPerCloud, "Rendering model " + i + " of " + this.cloudList.Count); switch (i) { case 0: createPointCloud(this.cloudList[0]); this.Model.Geometry = createMesh(); this.Model.Material = this.Model.BackMaterial = new DiffuseMaterial(new SolidColorBrush(Colors.Red)); this.Model.Transform = new TranslateTransform3D(-1, -2, 1); this.armLabel.Geometry = createTextLabel("THIS IS AN ARM"); break; case 1: mesh = new MeshGeometry3D(); createPointCloud(this.cloudList[1]); this.Model2.Geometry = createMesh(); this.Model2.Material = this.Model2.BackMaterial = new DiffuseMaterial(new SolidColorBrush(Colors.Blue)); this.Model2.Transform = new TranslateTransform3D(-1, -2, 1); break; case 2: mesh = new MeshGeometry3D(); createPointCloud(this.cloudList[2]); this.Model3.Geometry = createMesh(); this.Model3.Material = this.Model3.BackMaterial = new DiffuseMaterial(new SolidColorBrush(Colors.Green)); this.Model3.Transform = new TranslateTransform3D(-1, -2, 1); break; case 3: mesh = new MeshGeometry3D(); createPointCloud(this.cloudList[3]); this.Model4.Geometry = createMesh(); this.Model4.Material = this.Model4.BackMaterial = new DiffuseMaterial(new SolidColorBrush(Colors.Orange)); this.Model4.Transform = new TranslateTransform3D(-1, -2, 1); break; } } } }
/*POINT CLOUD RENDERING*/ public void preprocess(LoadingWidget progressMonitor) { if (this.clouds == null) { //preprocess condition for when we have a single point cloud to convert into point 3ds pcc = new Point3DCollection(); //iterate over each point and stick it in depthframe points for (int i = 0; i < depthFramePoints.Length; i++) { pcc.Add(prgbs[i].point); } createPointCloud(pcc); render(progressMonitor); } else { if (progressMonitor != null) progressMonitor.ReportProgress(1, "starting preprocess"); cloudList = new List<Point3DCollection>(); //create a list of point 3d collections for (int i = 0; i < this.clouds.Count; i++) { Point3DCollection pcc = new Point3DCollection(); depthFramePoints = new Point3D[this.clouds[i].getAllPoints().Length]; ICP.PointRGB[] tmp = clouds[i].getAllPoints(); int progressPerCloud = (int)Math.Round((30 / (decimal)this.clouds.Count), 0); double progressPerPoint = progressPerCloud / (this.clouds[i].getAllPoints().Length); //jam into point cloud collection. for (int j = 0; j < depthFramePoints.Length; j++) { pcc.Add(tmp[j].point); } cloudList.Add(pcc); if (progressMonitor != null) progressMonitor.ReportProgress((int)(progressPerCloud), "Created point cloud " + (i + 1) + " of " + this.clouds.Count); } // Render the model! if (progressMonitor != null) { progressMonitor.ReportProgress(10, "Rendering"); } render(progressMonitor); } }