資源簡(jiǎn)介
單像空間后方交會(huì)程序 實(shí)現(xiàn)單張像片像點(diǎn)坐標(biāo)及控制點(diǎn)坐標(biāo)計(jì)算內(nèi)外方位元素 可直接運(yùn)行 結(jié)果同時(shí)寫(xiě)入txt文件

代碼片段和文件信息
//?space_resection.cpp?:?定義控制臺(tái)應(yīng)用程序的入口點(diǎn)。
//
//余大文?2014301580226
//近景攝影測(cè)量實(shí)習(xí)?單像空間后方交會(huì)
//2017年6月2日
#include?“stdafx.h“
#include
#include
#include
#include?
#include
#include
#include?
?
using?namespace?std;
//矩陣轉(zhuǎn)置函數(shù)
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列
}
//矩陣求逆函數(shù)
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];
????????}
??}
}
//矩陣相乘函數(shù)?第一個(gè)矩陣大小m*n第二個(gè)矩陣n*l結(jié)果矩陣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;//結(jié)果矩陣賦初值0
//結(jié)果矩陣i行j列等于矩陣1的i行與矩陣2的j列的對(duì)應(yīng)元素相乘并求和
???for(i=0;?i ?????for(j=0;j ?for(k=0;k ?MResult[i*l+j]+=M1[i*n+k]*M2[k*l+j];
}
//矩陣相加函數(shù)?第一個(gè)矩陣大小m*n第二個(gè)矩陣m*n
void?MatrixAdd(double?*M1?double?*M2int?m?int?n)
{
for(int?i=0;i M2[i]=M2[i]+M1[i];
}
//記錄像點(diǎn)坐標(biāo)
struct?imagecoordinate
{
int?num;
double?x;
double?y;
};
//記錄控制點(diǎn)坐標(biāo)
struct?objectcoordinate
{
int?num;
double?x;
double?y;
double?z;
};
//同時(shí)記錄像點(diǎn)及其對(duì)應(yīng)的控制點(diǎn)坐標(biāo)
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“;//像點(diǎn)坐標(biāo)路徑
char?*s2=“..\\data\\2017年近景控制場(chǎng)-Left-hand?system.txt“;//控制點(diǎn)坐標(biāo)路徑
ifstream?fp1;//像點(diǎn)文件
ifstream?fp2;//控制點(diǎn)文件
double?*temp1=new?double[1000];
double?*temp2=new?double[5000];
//讀入像點(diǎn)文件
int?n1=0;
fp1.open(s1ios::in|ios::out);
for?(n1=0;?fp1.eof()==0;?n1++)
{
fp1>>temp1[n1];
}
fp1.close();
//讀入控制點(diǎn)文件
int?n2=0;
fp2.open(s2ios::in|ios::out);
for?(n2=0;?fp2.eof()==0;?n2++)
{
fp2>>temp2[n2];
}
fp2.close();
//像點(diǎn)個(gè)數(shù)
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\n“imagec[i].y);
}
//控制點(diǎn)個(gè)數(shù)
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<
?屬性????????????大小?????日期????時(shí)間???名稱(chēng)
-----------?---------??----------?-----??----
?????文件???????3184??2017-05-30?17:26??space_resection\data\0600.txt
?????文件???????9338??2017-05-31?22:14??space_resection\data\2017年近景控制場(chǎng)-Left-hand?system.txt
?????文件???????3238??2017-06-14?19:47??space_resection\data\結(jié)果文件.txt
?????文件??????90624??2017-06-05?10:07??space_resection\Debug\space_resection.exe
?????文件????1053104??2017-06-05?10:07??space_resection\Debug\space_resection.ilk
?????文件????1100800??2017-06-05?10:07??space_resection\Debug\space_resection.pdb
?????文件????2359296??2017-06-14?18:56??space_resection\ipch\space_resection-f666ceed\space_resection-24a59d03.ipch
?????文件???????1522??2017-06-05?10:07??space_resection\space_resection\Debug\cl.command.1.tlog
?????文件??????23110??2017-06-05?10:07??space_resection\space_resection\Debug\CL.read.1.tlog
?????文件????????844??2017-06-05?10:07??space_resection\space_resection\Debug\CL.write.1.tlog
?????文件??????????2??2017-06-05?10:07??space_resection\space_resection\Debug\li
?????文件??????????2??2017-06-05?10:07??space_resection\space_resection\Debug\li
?????文件??????????2??2017-06-05?10:07??space_resection\space_resection\Debug\li
?????文件??????????2??2017-06-05?10:07??space_resection\space_resection\Debug\li
?????文件??????????2??2017-06-05?10:07??space_resection\space_resection\Debug\li
?????文件??????????2??2017-06-05?10:07??space_resection\space_resection\Debug\li
?????文件???????1706??2017-06-05?10:07??space_resection\space_resection\Debug\li
?????文件???????3400??2017-06-05?10:07??space_resection\space_resection\Debug\li
?????文件????????906??2017-06-05?10:07??space_resection\space_resection\Debug\li
?????文件????????430??2017-06-05?10:07??space_resection\space_resection\Debug\mt.command.1.tlog
?????文件????????450??2017-06-05?10:07??space_resection\space_resection\Debug\mt.read.1.tlog
?????文件????????346??2017-06-05?10:07??space_resection\space_resection\Debug\mt.write.1.tlog
?????文件????????604??2017-06-02?16:28??space_resection\space_resection\Debug\rc.command.1.tlog
?????文件????????422??2017-06-02?16:28??space_resection\space_resection\Debug\rc.read.1.tlog
?????文件????????326??2017-06-02?16:28??space_resection\space_resection\Debug\rc.write.1.tlog
?????文件????????406??2017-06-02?16:28??space_resection\space_resection\Debug\space_resection.exe.em
?????文件????????472??2017-06-02?16:28??space_resection\space_resection\Debug\space_resection.exe.em
?????文件????????381??2017-06-05?10:07??space_resection\space_resection\Debug\space_resection.exe.intermediate.manifest
?????文件?????????59??2017-06-05?10:07??space_resection\space_resection\Debug\space_resection.lastbuildstate
?????文件???????3024??2017-06-05?10:07??space_resection\space_resection\Debug\space_resection.log
............此處省略27個(gè)文件信息
評(píng)論
共有 條評(píng)論