单像空间后方交会程序 实现单张像片像点坐标及控制点坐标计算内外方位元素 可直接运行 结果同时写入txt文件


单像空间后方交会程序 实现单张像片像点坐标及控制点坐标计算内外方位元素 可直接运行 结果同时写入txt文件
资源截图
代码片段和文件信息
// space_resection.cpp : 定义控制台应用程序的入口点。
//


//余大文 2014301580226
//近景摄影测量实习 单像空间后方交会
//2017年6月2日

#include “stdafx.h“
#include
#include
#include
#include 
#include
#include
#include 
 
using namespace std;

//矩阵转置函数
void Rotation(double *MOrigin double *MResult int m int n)

int i j;
for(i=0; i for(j=0;j MResult[i*m+j]=MOrigin[j*n+i];
        //新矩阵的i行j列等于原矩阵的j行i列
}

//矩阵求逆函数
void Inverse(double *Metrix int n)
{
int i j k;
  for(k=0; k  {
    for(i=0; i     {
       if(i != k)
       Metrix[i*n+k] = - Metrix[i*n+k] / Metrix[k*n+k];
      }
     Metrix[k*n+k] = 1/Metrix[k*n+k];
     for(i=0; i      {
        if(i != k)
          {
            for(j=0; j            {
              if(j != k)
              Metrix[i*n+j] += Metrix[k*n+j] * Metrix[i*n+k];
            }
          }
       }
       for(j=0; j       {
         if(j != k)
         Metrix[k*n+j]*= Metrix[k*n+k];
        }
  }
}


//矩阵相乘函数 第一个矩阵大小m*n第二个矩阵n*l结果矩阵m*l
void Multiply(double *M1 double *M2 double *MResult int m int n int l)
{
int i j k;
for(i=0; i for(j=0;j  MResult[i*l+j]=0;//结果矩阵赋初值0
//结果矩阵i行j列等于矩阵1的i行与矩阵2的j列的对应元素相乘并求和
   for(i=0; i     for(j=0;j  for(k=0;k  MResult[i*l+j]+=M1[i*n+k]*M2[k*l+j];
}

//矩阵相加函数 第一个矩阵大小m*n第二个矩阵m*n
void MatrixAdd(double *M1 double *M2int m int n)
{
for(int i=0;i M2[i]=M2[i]+M1[i];

}

//记录像点坐标
struct imagecoordinate
{
int num;
double x;
double y;

};
//记录控制点坐标
struct objectcoordinate
{
int num;
double x;
double y;
double z;

};
//同时记录像点及其对应的控制点坐标
struct coordinate
{
int num;
double x;
double y;
double X;
double Y;
double Z;

};


int _tmain(int argc _TCHAR* argv[])
{
char *s1=“..\data\0600.txt“;//像点坐标路径
char *s2=“..\data\2017年近景控制场-Left-hand system.txt“;//控制点坐标路径

ifstream fp1;//像点文件
ifstream fp2;//控制点文件

double *temp1=new double[1000];
double *temp2=new double[5000];

//读入像点文件
int n1=0;
fp1.open(s1ios::in|ios::out);
for (n1=0; fp1.eof()==0; n1++)
{
fp1>>temp1[n1];

}
fp1.close();

//读入控制点文件
int n2=0;
fp2.open(s2ios::in|ios::out);
for (n2=0; fp2.eof()==0; n2++)
{
fp2>>temp2[n2];

}
fp2.close();

//像点个数
int num1=(n1-1)/3;

imagecoordinate *imagec=new imagecoordinate[num1];
for(int i=0;i {
imagec[i].num=temp1[3*i+0];
imagec[i].x =temp1[3*i+1]-4272/2.0;
imagec[i].y =2848/2.0-temp1[3*i+2];
//printf(“%lf
“imagec[i].y);
}

//控制点个数
int num2=(n2)/4;

objectcoordinate *objectc=new objectcoordinate[num2];
for(int i=0;i {
objectc[i].num=temp2[4*i+0];
objectc[i].x = temp2[4*i+1];
objectc[i].y = temp2[4*i+2];
objectc[i].z = temp2[4*i+3];
}

int nn=0;
coordinate *c=new coordinate[num1];
for(int i=0;i<

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       3184  2017-05-30 17:26  space_resectiondata600.txt

     文件       9338  2017-05-31 22:14  space_resectiondata2017年近景控制场-Left-hand system.txt

     文件       3238  2017-06-14 19:47  space_resectiondata结果文件.txt

     文件      90624  2017-06-05 10:07  space_resectionDebugspace_resection.exe

     文件    1053104  2017-06-05 10:07  space_resectionDebugspace_resection.ilk

     文件    1100800  2017-06-05 10:07  space_resectionDebugspace_resection.pdb

     文件    2359296  2017-06-14 18:56  space_resectionipchspace_resection-f666ceedspace_resection-24a59d03.ipch

     文件       1522  2017-06-05 10:07  space_resectionspace_resectionDebugcl.command.1.tlog

     文件      23110  2017-06-05 10:07  space_resectionspace_resectionDebugCL.read.1.tlog

     文件        844  2017-06-05 10:07  space_resectionspace_resectionDebugCL.write.1.tlog

     文件          2  2017-06-05 10:07  space_resectionspace_resectionDebuglink-cvtres.read.1.tlog

     文件          2  2017-06-05 10:07  space_resectionspace_resectionDebuglink-cvtres.write.1.tlog

     文件          2  2017-06-05 10:07  space_resectionspace_resectionDebuglink.6524-cvtres.read.1.tlog

     文件          2  2017-06-05 10:07  space_resectionspace_resectionDebuglink.6524-cvtres.write.1.tlog

     文件          2  2017-06-05 10:07  space_resectionspace_resectionDebuglink.6524.read.1.tlog

     文件          2  2017-06-05 10:07  space_resectionspace_resectionDebuglink.6524.write.1.tlog

     文件       1706  2017-06-05 10:07  space_resectionspace_resectionDebuglink.command.1.tlog

     文件       3400  2017-06-05 10:07  space_resectionspace_resectionDebuglink.read.1.tlog

     文件        906  2017-06-05 10:07  space_resectionspace_resectionDebuglink.write.1.tlog

     文件        430  2017-06-05 10:07  space_resectionspace_resectionDebugmt.command.1.tlog

     文件        450  2017-06-05 10:07  space_resectionspace_resectionDebugmt.read.1.tlog

     文件        346  2017-06-05 10:07  space_resectionspace_resectionDebugmt.write.1.tlog

     文件        604  2017-06-02 16:28  space_resectionspace_resectionDebug
c.command.1.tlog

     文件        422  2017-06-02 16:28  space_resectionspace_resectionDebug
c.read.1.tlog

     文件        326  2017-06-02 16:28  space_resectionspace_resectionDebug
c.write.1.tlog

     文件        406  2017-06-02 16:28  space_resectionspace_resectionDebugspace_resection.exe.embed.manifest

     文件        472  2017-06-02 16:28  space_resectionspace_resectionDebugspace_resection.exe.embed.manifest.res

     文件        381  2017-06-05 10:07  space_resectionspace_resectionDebugspace_resection.exe.intermediate.manifest

     文件         59  2017-06-05 10:07  space_resectionspace_resectionDebugspace_resection.lastbuildstate

     文件       3024  2017-06-05 10:07  space_resectionspace_resectionDebugspace_resection.log

............此处省略27个文件信息

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)