C#:C#保存读取点云

1、保存点云

 string CurrentDir = Application.StartupPath;
                        string FileName = CurrentDir + "\\ScanPoint.asc";
                        FileStream of = File.Open(FileName, FileMode.Create);

                        StreamWriter sw = new StreamWriter(of);

                        sw.WriteLine("scan");
                        sw.WriteLine("scan");
                        sw.WriteLine("cloud_start");

                        int ptCount = hv_Pnt_x.TupleLength();
                        int nStep = 5;

                        for (int j = 0; j < ptCount; j += nStep)
                        {
                            string line = hv_Pnt_x[j].D + " " + hv_Pnt_y[j].D + " " + hv_Pnt_z[j].D;
                            sw.WriteLine(line);
                        }

                        sw.WriteLine("cloud_end");
                        int LastPtNum = ptCount - 1;

                        sw.WriteLine("startPoint");
                        string SptStr = hv_Pnt_x[0].D + " " + hv_Pnt_y[0].D + " " + hv_Pnt_z[0].D;
                        sw.WriteLine(SptStr);
                        sw.WriteLine("startPoint_end");

                        sw.WriteLine("endPoint");
                        string EptStr = hv_Pnt_x[LastPtNum].D.ToString() + " " + hv_Pnt_y[LastPtNum].D.ToString() + " " + hv_Pnt_z[LastPtNum].D.ToString();
                        sw.WriteLine(EptStr);
                        sw.WriteLine("endPoint_end");

                        sw.Close();
                        of.Close();

2、读取数据

                string CurrentDir = Application.StartupPath;
                string FileName = CurrentDir + "\\CameraParameter.txt";
                FileStream of = File.Open(FileName, FileMode.Open);               

                StreamReader sr = new StreamReader(of);
                string str1 = sr.ReadLine();
                string str2 = sr.ReadLine();
                string str3 = sr.ReadLine();

                sr.Close();
                of.Close();

                this.hScrollBar_Gain.Value = Convert.ToInt32(str1);
                this.hScrollBar_Exposure.Value = Convert.ToInt32(str2);
                this.hScrollBar_ThresholdValue.Value = Convert.ToInt32(str3);

                this.textBox_Gain.Text = this.hScrollBar_Gain.Value.ToString();
                this.textBox_Exposure.Text = this.hScrollBar_Exposure.Value.ToString();
                this.textBox_ThresholdValue.Text = this.hScrollBar_ThresholdValue.Value.ToString();
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值