摄影测量作业
空间后方交会的代码
各位小伙伴要用的话 只需修改main函数里边的像点地面点坐标,摄影比例尺分母,焦距等这些已知元素就行。
#include<iostream>
#include <iomanip>
#include<string.h>
#include<math.h>
using namespace std;
void PrintArray(double* a, int b, int c);//打印矩阵
void TranspositionArray(double* a, double* aT, int b, int c);//转置矩阵
void MultiplyArray(double* a, double* b, double* c, int m, int n, int l);//矩阵相乘
void make2array(double**& a, int n);
void deletarray(double**& a, int n);
int ConverseArray(double* ip, double* rp, int n);//矩阵求逆
void SubtratArray(double* a, double* b, double* c, int m, int n);//矩阵相减
int main() {
//像点坐标和地面点坐标
double IroundControl[4][2] = { -86.15,-68.99,
-53.40,82.21,
-14.78,-76.63,
10.46,64.43 };
double GroundControl[4][3] = { 36589.41, 25273.32,2195.17,
37631.08,31324.51,728.69,
39100.97,24934.98,2386.50,
40426.54,30319.81,757.31 };
//摄影比例尺分母
double scale = 40000.0;
double f = 0.15324;
//转换单位
for (int i = 0; i < 4; i++)
{
for (int j = 0; j < 2; j++)
{
IroundControl[i][j] /= 1000.0;
}
}
//定义外方位元素
double Xs = 0.0, Ys = 0.0, Zs = 0.0, pitch = 0.0, roll = 0.0, yaw = 0.0;
//外方位元素的改正数
double delta[6] = { 0.0 };
//定义旋转矩阵
double Rotate[3][3] = { 0.0 };
Xs = (GroundControl[0][0] + GroundControl[1][0] + GroundControl[2][0] + GroundControl[3][0]) / 4.0;
Ys = (GroundControl[0][1] + GroundControl[1][1] + GroundControl[2][1] + GroundControl[3][1]) / 4.0;
Zs = scale * f;
//打印外方位元素的初始值
cout << "外方位元素的初始值为:" << endl;
cout << Xs << " " << Ys << " " << Zs << endl;
cout << pitch << " " << roll << " " << yaw << endl;
double x[4] = { 0 }, y[4] = { 0