2022年摄影测量学单像空间后方交会程序设计作业 .pdf

上传人:H****o 文档编号:33370087 上传时间:2022-08-10 格式:PDF 页数:6 大小:47.83KB
返回 下载 相关 举报
2022年摄影测量学单像空间后方交会程序设计作业 .pdf_第1页
第1页 / 共6页
2022年摄影测量学单像空间后方交会程序设计作业 .pdf_第2页
第2页 / 共6页
点击查看更多>>
资源描述

《2022年摄影测量学单像空间后方交会程序设计作业 .pdf》由会员分享,可在线阅读,更多相关《2022年摄影测量学单像空间后方交会程序设计作业 .pdf(6页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。

1、using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace 单像空间后方交会 classProgram staticvoid Main( string args) int x0, y0, i, j; double f, m; Console .Write( 请输入像片比例尺:); m = double .Parse( Console.ReadLine(); Console .Write( 请输入像片的内方位元素x0: ); / 均以毫米为单位 x0 = int .

2、Parse( Console.ReadLine(); Console .Write( 请输入像片的内方位元素y0: ); y0 = int .Parse( Console.ReadLine(); Console .Write( 请输入摄影机主距f: ); f = double .Parse( Console.ReadLine(); Console .WriteLine(); / 输入坐标数据double , zuobiao = new double 4, 5; for (i = 0; i 4; i+) for (j = 0; j 5; j+) if (j 3) Console .Write(请

3、输入第 0 个点的第 1 个地面坐标: , i + 1, j + 1); zuobiaoi, j = double .Parse( Console .ReadLine(); else Console .Write(请输入第 0 个点的第 1 个像点坐标: , i + 1, j - 2); zuobiaoi, j = double .Parse( Console .ReadLine(); Console .WriteLine(); / 归算像点坐标for (i = 0; i 4; i+) for (j = 3; j 5; j+) if (j = 3) zuobiaoi, j = zuobiaoi

4、, j - x0; else zuobiaoi, j = zuobiaoi, j - y0; / 计算和确定初值double zs0 = m * f, xs0 = 0, ys0 = 0; for (i = 0; i 4; i+) 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 1 页,共 6 页 - - - - - - - - - xs0 = xs0 + zuobiaoi, 0; ys0 = ys0 + zuobiaoi, 1; xs0 = xs0 / 4; ys0 = ys0 /

5、4; / 逐点计算误差方程系数double , xishu = new double 8, 6; for (i = 0; i 8; i += 2) double x, y; x = zuobiaoi / 2, 3; y = zuobiaoi / 2, 4; xishui, 0 = xishui + 1, 1 = -1 / m; xishui, 1 = xishui + 1, 0 = 0; xishui, 2 = -x / (m * f); xishui, 3 = -f * (1 + x * x / (f * f); xishui, 4 = xishui + 1, 3 = -x * y / f;

6、 xishui, 5 = y; xishui + 1, 2 = -y / (m * f); xishui + 1, 4 = -f * (1 + y * y / (f * f); xishui + 1, 5 = -x; / 计算逆阵double , dMatrix =matrixChe(matrixTrans(xishu), xishu); double , dReturn = ReverseMatrix(dMatrix, 6); Console .WriteLine( 逆矩阵为: ); if (dReturn != null ) matrixOut(dReturn); / 求解过程double

7、 phi0 = 0, omega0 = 0, kappa0 = 0; int q = 0; double , r = new double 3, 3; double , jinsi = new double 4, 2; double chazhi = new double 8; double jieguo = new double 6; double , zhong = matrixChe(dReturn, matrixTrans(xishu); do / 计算旋转矩阵 r r0, 0 = Math.Cos(phi0) * Math.Cos(kappa0) - Math.Sin(phi0) *

8、 Math.Sin(omega0) * Math.Sin(kappa0); r0, 1 = -Math.Cos(phi0) * Math.Sin(kappa0) - Math.Sin(phi0) * Math.Sin(omega0) * Math.Cos(kappa0); r0, 2 = -Math.Sin(phi0) * Math.Cos(omega0); r1, 0 = Math.Cos(omega0) * Math.Sin(kappa0); r1, 1 = Math.Cos(omega0) * Math.Cos(kappa0); r1, 2 = -Math.Sin(omega0); r2

9、, 0 = Math.Sin(phi0) * Math.Cos(kappa0) + Math.Cos(phi0) * Math.Sin(omega0) * Math.Sin(kappa0); r2, 1 = -Math.Sin(phi0) * Math.Sin(kappa0) + Math.Cos(phi0) * Math.Sin(omega0) * Math.Cos(kappa0); r2, 2 = Math.Cos(phi0) * Math.Cos(omega0); / 计算 x,y 的近似值for (i = 0; i 4; i+) jinsii, 0 = -f * (r0, 0 * (z

10、uobiaoi, 0 - xs0) + r1, 0 * (zuobiaoi, 1 - ys0) + r2, 0 * (zuobiaoi, 2 - zs0) / (r0, 2 * (zuobiaoi, 0 - xs0) + r1, 2 * (zuobiaoi, 1 - ys0) + r2, 2 * (zuobiaoi, 2 - zs0); jinsii, 1 = -f * (r0, 1 * (zuobiaoi, 0 - xs0) + r1, 1 * (zuobiaoi, 1 - ys0) + r2, 1 * (zuobiaoi, 2 - zs0) / (r0, 2 * (zuobiaoi, 0

11、- xs0) + r1, 2 * (zuobiaoi, 1 - ys0) + r2, 2 * (zuobiaoi, 2 - zs0); 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 2 页,共 6 页 - - - - - - - - - for (i = 0; i 8; i += 2) chazhii = zuobiaoi / 2, 3 - jinsii / 2, 0; chazhii + 1 = zuobiaoi / 2, 4 - jinsii / 2, 1; for (i =

12、0; i zhong.GetLength(0); i+) double k = 0; for (j = 0; j 1000) break ; while ( Math.Abs(jieguo0) 0.020 | Math.Abs(jieguo1) 0.020) | Math.Abs(jieguo2) 0.020); Console .WriteLine( 共进行了 0 次运算 , q); Console .WriteLine( 旋转矩阵为 ); matrixOut(r); for (i = 0; i jieguo.GetLength(0); i+) Console .Write( 第0 个外方位

13、元素为:1 , i + 1, jieguoi); / 矩阵转置publicstaticdouble , matrixTrans(double , X) double , A = X; double , C = new double A.GetLength(1), A.GetLength(0); for ( int i = 0; i A.GetLength(1); i+) for ( int j = 0; j A.GetLength(0); j+) Ci, j = Aj, i; return C; / 矩阵输出publicstaticvoid matrixOut(double , X) doub

14、le , C = X; for ( int i = 0; i C.GetLength(0); i+) for ( int j = 0; j C.GetLength(1); j+) Console .Write( 0, Ci, j); 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 3 页,共 6 页 - - - - - - - - - Console .Write(n ); / 二维矩阵相乘publicstaticdouble , matrixChe(double , X, doub

15、le , Y) int i, j, n; double m; double , C = X; double , D = Y; double , E = new double C.GetLength(0), C.GetLength(0); for (i = 0; i C.GetLength(0); i+) for (n = 0; n C.GetLength(0); n+) m = 0; for (j = 0; j C.GetLength(1); j+) m = m + Ci, j * Dj, n; Ei, n = m; return E; / 计算行列式的值publicstaticdouble

16、MatrixValue(double , MatrixList, int Level) double , dMatrix = new double Level, Level; for ( int i = 0; i Level; i+) for ( int j = 0; j Level; j+) dMatrixi, j = MatrixListi, j; double c, x; int k = 1; for ( int i = 0, j = 0; i Level & j Level; i+, j+) if (dMatrixi, j = 0) int m = i; for (; dMatrixm

17、, j = 0; m+) ; if (m = Level) return 0; else for ( int n = j; n i; s-) x = dMatrixs, j; for ( int t = j; t Level; t+) 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 4 页,共 6 页 - - - - - - - - - dMatrixs, t -= dMatrixi, t * (x / dMatrixi, j); double sn = 1; for ( int i

18、 = 0; i Level; i+) if (dMatrixi, i != 0) sn *= dMatrixi, i; else return 0; return k * sn; / 计算逆阵publicstaticdouble , ReverseMatrix(double , dMatrix, int Level) double dMatrixValue = MatrixValue(dMatrix, Level); if (dMatrixValue = 0) returnnull ; double , dReverseMatrix = new double Level, 2 * Level;

19、 double x, c; for ( int i = 0; i Level; i+) for ( int j = 0; j 2 * Level; j+) if (j Level) dReverseMatrixi, j = dMatrixi, j; else dReverseMatrixi, j = 0; dReverseMatrixi, Level + i = 1; for ( int i = 0, j = 0; i Level & j Level; i+, j+) if (dReverseMatrixi, j = 0) int m = i; for (; dMatrixm, j = 0;

20、m+) ; if (m = Level) returnnull ; else for ( int n = j; n 2 * Level; n+) dReverseMatrixi, n += dReverseMatrixm, n; x = dReverseMatrixi, j; if (x != 1) for ( int n = j; n i; s-) x = dReverseMatrixs, j; 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 5 页,共 6 页 - - - - -

21、 - - - - for ( int t = j; t = 0; i-) for ( int j = i + 1; j Level; j+) if (dReverseMatrixi, j != 0) c = dReverseMatrixi, j; for ( int n = j; n 2 * Level; n+) dReverseMatrixi, n -= (c * dReverseMatrixj, n); double , dReturn = new double Level, Level; for ( int i = 0; i Level; i+) for ( int j = 0; j Level; j+) dReturni, j = dReverseMatrixi, j + Level; return dReturn; 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 6 页,共 6 页 - - - - - - - - -

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 技术资料 > 技术总结

本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知淘文阁网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

工信部备案号:黑ICP备15003705号© 2020-2023 www.taowenge.com 淘文阁