//计算相对定向元素 private void 计算相对定向元素ToolStripMenuItem1_Click(object sender, EventArgs e) { if (GetStereopair() == false)//从文件读取同名像点坐标 { return; } MyPoint center = new MyPoint(0, 0, 0); EElements leftE = new EElements(center, 0, 0, 0); ro = new RelativeOritation(leftPCoords, rightPCoords, leftE, scale); ro.CalROE(); SaveROE(); }
//初始化 public RelativeOritation(List <MyPoint> leftC, List <MyPoint> rightC, EElements leftE, int s) { scale = s; //左外方位元素 leftEE = leftE; //右外方位元素 RightEE = new EElements(); RightEE.Phi = RightEE.Omega = RightEE.Kappa = 0; RightEE.S = new MyPoint(0, 0, 0); bx = leftC[0].X - rightC[0].X; //获取坐标 leftPCoords = leftC; //左像片的像空间辅助坐标 rightPCoords = rightC; //右像片的像空间坐标 //生成系数矩阵和常数项 A = new double[leftC.Count(), 5]; L = new double[leftC.Count(), 1]; }
//从文件读取绝对定向元素 private void 输入绝对定向元素ToolStripMenuItem_Click(object sender, EventArgs e) { EElements ee = new EElements(); float lamda; float dx, dy, dz; OpenFileDialog dialog = new OpenFileDialog(); dialog.RestoreDirectory = true; dialog.Title = "选择绝对定向元素"; dialog.Filter = "文本文件(*.txt)|*.txt"; DialogResult flag = dialog.ShowDialog(); if (flag == DialogResult.Cancel) { return; } else if (flag == DialogResult.OK) { string filename = dialog.FileName; string[] data; using (StreamReader sr = new StreamReader(filename)) { lamda = float.Parse(sr.ReadLine()); data = sr.ReadLine().Split(','); dx = float.Parse(data[0]); dy = float.Parse(data[1]); dz = float.Parse(data[2]); data = sr.ReadLine().Split(','); ee.Phi = (float)(float.Parse(data[0]) / 180 * Math.PI); ee.Omega = (float)(float.Parse(data[1]) / 180 * Math.PI); ee.Kappa = (float)(float.Parse(data[2]) / 180 * Math.PI); ao = new AbsoluteOrientation(ee, lamda, dx, dy, dz); } } }