課程設計 前方交會

2021-10-03 03:22:36 字數 3277 閱讀 7946

以往前面有具體演算法流程介紹,這裡就不多說了。

該演算法程式有個小問題有待解決,就是無法讀取檔案裡的小數部位。

待解決

#include#include#include#include#includeusing namespace std;

using namespace cv;

int main()

; /*ifstream infile;//定義檔案流物件

infile.open("d1.txt", ios::in);//開啟文件

double *ptr = &data[0][0];

while (!infile.eof())

infile.close();*/

file *fp; //讀入同名像點座標檔案

if (fp = fopen("d1.txt", "r"))

fclose(fp);

} else printf("open file error!");

//左右像片的外方位元素

double xs1 = data[0][0];

double ys1 = data[1][0];

double zs1 = data[2][0];

double xs2 = data[3][0];

double ys2 = data[4][0];

double zs2 = data[5][0];

double phi1 = data[0][1];

double omig1 = data[1][1];

double phi2 = data[3][1];

double omig2 = data[4][1];

//同名像點的座標

double x1 = data[6][0];

double y1 = data[6][1];

double x2 = data[7][0];

double y2 = data[7][1];

cout << "zs1=" << zs1 << endl;

//定義基線分量

double bx = xs2 - xs1, by = ys2 - ys1, bz = zs2 - zs1;

cout << "x1=" << x1 << endl;

//兩張像片上的旋轉矩陣

double a3 = -1.0*sin(phi1)*cos(omig1);

double b3 = -1.0*sin(omig1);

double c3 = cos(phi1)*cos(omig1);

//定義旋轉矩陣r1

mat r1(3, 3, cv_64f, 0.0);

r1.at(0, 0) = a1;

r1.at(0, 1) = a2;

r1.at(0, 2) = a3;

r1.at(1, 0) = b1;

r1.at(1, 1) = b2;

r1.at(1, 2) = b3;

r1.at(2, 0) = c1;

r1.at(2, 1) = c2;

r1.at(2, 2) = c3;

//cout << "r1=" << r1 << endl;

double aa3 = -1.0*sin(phi2)*cos(omig2);

double bb3 = -1.0*sin(omig2);

double cc3 = cos(phi2)*cos(omig2);

//定義旋轉矩陣r2

mat r2(3, 3, cv_64f, 0.0);

r2.at(0, 0) = aa1;

r2.at(0, 1) = aa2;

r2.at(0, 2) = aa3;

r2.at(1, 0) = bb1;

r2.at(1, 1) = bb2;

r2.at(1, 2) = bb3;

r2.at(2, 0) = cc1;

r2.at(2, 1) = cc2;

r2.at(2, 2) = cc3;

//定義同名像點的像空間輔助座標系rr1(x1,y1,z1)和rr2(x2,y2,z)

mat rr1(3, 1, cv_64f, 0.0);

mat rr2(3, 1, cv_64f, 0.0);

mat rr11(3, 1, cv_64f, 0.0);

rr11.at(0, 0) = x1;

rr11.at(1, 0) = y1;

rr11.at(2, 0) = -1*f;

mat rr22(3, 1, cv_64f, 0.0);

rr22.at(0, 0) = x2;

rr22.at(1, 0) = y2;

rr22.at(2, 0) = -1*f;

rr1 = r1*rr11;

double x1 = rr1.at(0, 0);

double y1 = rr1.at(1, 0);

double z1 = rr1.at(2, 0);

rr2 = r2*rr22;

double x2 = rr2.at(0, 0);

double y2 = rr2.at(1, 0);

double z2 = rr2.at(2, 0);

//計算左右點投影係數

double n1 = (bx*z2 - bz*x2) / (x1*z2 - z1*x2);

double n2 = (bx*z1 - bz*x1) / (x1*z2 - z1*x2);

//計算模型點座標

double detex = n1*x1;

double detey = 0.5*(n1*y1 + n2*y2 + by);

double detez = n1*z1;

//計算地面點的地面座標(x,y,z)

double xp = xs1 + detex;

double yp = ys1 + detey;

double zp = zs1 + detez;

cout << "地面點座標是:" << endl;

cout << "xp=" << xp << endl;

cout << "yp=" << yp << endl;

cout << "zp=" << zp << endl;

//std::cout << rr1 << std::

system("pause");

return 0;

}

課程設計表

create database drug 藥品表 create table drug did nvarchar 10 primary key,dname nvarchar 50 not null,dimage nvarchar 100 not null,dmodel nvarchar 10 chec...

課程設計總結

課程設計今天終於完了,答辯之後感悟挺多的,一方面,覺得自己的努力獲到了應有的成果,當然也有很多不足及未完成的地方 另一方面,看到很多其他同學好的設計及思想。覺得很多方面都值得自己學習,自己還有很多方面都很欠缺,本次課程設計我和兩個同學共三個人做了聊天程式,仿qq做的。聊天軟體,是我之前一直想完成的乙...

課程設計備份

include include include include define size 100 define increase 10 struct nodel 順序表 typedef struct tree btree,bnode 二叉樹struct stackt 棧int caidan int i...