數(shù)字?jǐn)z影測(cè)量實(shí)習(xí)報(bào)告_第1頁
數(shù)字?jǐn)z影測(cè)量實(shí)習(xí)報(bào)告_第2頁
數(shù)字?jǐn)z影測(cè)量實(shí)習(xí)報(bào)告_第3頁
數(shù)字?jǐn)z影測(cè)量實(shí)習(xí)報(bào)告_第4頁
數(shù)字?jǐn)z影測(cè)量實(shí)習(xí)報(bào)告_第5頁
已閱讀5頁,還剩47頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡介

課程編:

課程性:必修數(shù)字?jǐn)z影量實(shí)習(xí)學(xué)院:專業(yè):

測(cè)繪學(xué)院測(cè)繪工程地點(diǎn):

內(nèi)班級(jí):組號(hào):姓名:學(xué)號(hào):

201116110教師:

徐李

芳妍申麗麗20144月10

至20144月30目錄實(shí)習(xí)目的..................................................................................................................................1VirtuoZo實(shí)習(xí)過程..................................................................................................................11、數(shù)據(jù)準(zhǔn)備以及初步處理....................................................................................................1新建測(cè)區(qū)....................................................................................................................1初步處理....................................................................................................................1進(jìn)一步處理................................................................................................................2產(chǎn)品生成....................................................................................................................2DEM編輯.............................................................................................................................2DEM拼接.............................................................................................................................3圖像鑲嵌............................................................................................................................4IGS數(shù)字化測(cè)圖.................................................................................................................4空中三角測(cè)量....................................................................................................................5數(shù)據(jù)準(zhǔn)備及預(yù)處理....................................................................................................5交互式編輯................................................................................................................6三角測(cè)量....................................................................................................................7DEM拼接和正射影像作.........................................................................................7三、GeoWay實(shí)習(xí)過程..................................................................................................................81、交互式編輯........................................................................................................................8新建工程并設(shè)置相關(guān)參數(shù)........................................................................................8生成內(nèi)圖廓................................................................................................................8交互式編輯................................................................................................................92、空三加密..........................................................................................................................10數(shù)據(jù)準(zhǔn)備及檢查......................................................................................................1控制網(wǎng)平差..............................................................................................................1精確匹配并查看匹配結(jié)果......................................................................................1刺點(diǎn)..........................................................................................................................13、立體測(cè)圖..........................................................................................................................12新建方案和數(shù)據(jù)準(zhǔn)備..............................................................................................12初步處理..................................................................................................................12批處理......................................................................................................................1地物采集..................................................................................................................1DEM編輯...................................................................................................................1TIN網(wǎng)編輯...............................................................................................................1質(zhì)量檢查..................................................................................................................1四、編程........................................................................................................................................17空間后方交會(huì)..................................................................................................................17特征匹配..........................................................................................................................21同名核線提取..................................................................................................................25五、心得體會(huì)................................................................................................................................28、實(shí)習(xí)的通過對(duì)數(shù)字?jǐn)z影測(cè)軟件的操作,熟數(shù)字?jǐn)z影測(cè)量系,掌握數(shù)字?jǐn)z影測(cè)量軟件的作業(yè)程,加深對(duì)數(shù)字影測(cè)量過程的理。通過編程實(shí)習(xí),加深對(duì)數(shù)字?jǐn)z影測(cè)學(xué)相關(guān)方法原理理解,提高編程手能力。、VirtuoZo實(shí)過1、數(shù)據(jù)備以及步處理1)新建測(cè)區(qū)設(shè)置區(qū)參數(shù),新建模設(shè)置模型參數(shù)設(shè)置相機(jī)參數(shù)設(shè)置控制點(diǎn)數(shù)據(jù)導(dǎo)入影像數(shù)據(jù),此,準(zhǔn)備工作完;圖1

設(shè)置測(cè)區(qū)參數(shù)

圖2

設(shè)置模型參數(shù)圖3

導(dǎo)入控制點(diǎn)

圖4

導(dǎo)入相機(jī)參數(shù)圖5

導(dǎo)入影像2)內(nèi)定向相對(duì)定絕對(duì)定向,至影像定向完成;0圖6

內(nèi)定向圖7

相對(duì)定向相對(duì)定向做完之后統(tǒng)會(huì)自動(dòng)進(jìn)行絕定向,我們可以主界面查看絕對(duì)定向的結(jié)果:下是模型157-156絕對(duì)定向結(jié)果圖圖8157-156絕對(duì)定向果然后點(diǎn)擊處理核重采樣影像匹,做完這些就可準(zhǔn)備生成產(chǎn)品;然后點(diǎn)擊產(chǎn)品,可生成需要的產(chǎn)品如DEM,DOM,高線等;2、DEM輯由于生成的DEM含有房屋,樹木等地物,所以并不是真意義上的數(shù)字高程模型,而應(yīng)該DTM(數(shù)字表模型下圖:1圖9

數(shù)字表面模型圖中的紅色方框所圍的可以很容易出來是房屋而不地形。所以需要對(duì)上上述DEM進(jìn)行編輯,生成正真意義上的DEM。擊“高級(jí)DEM輯入DEM編輯界面。圖10

編輯后的DEM圖中的紅色部分就我們編輯的范圍經(jīng)過編輯后加載DEM顯示立體圖,可以看出其中的房高度已經(jīng)貼合地了。3、DEM接由于每一個(gè)DEM只是兩張影像形成的,一測(cè)區(qū)有多個(gè)DEM,因需要經(jīng)過拼接才能形成個(gè)測(cè)區(qū)的DEM。點(diǎn)“高級(jí)-->DEM拼接”出DEM拼接界面,加載需拼接的DEM,用標(biāo)劃定拼接范圍接下來就可以執(zhí)拼接。2圖11圖12DEM拼接4、圖像嵌生成整個(gè)測(cè)區(qū)的DEM后,我們就可以生成整個(gè)測(cè)的正射影像了。次點(diǎn)擊“高級(jí)正射像制作”彈出制界面,選定DEM以相應(yīng)的影像數(shù)據(jù),然后執(zhí)行,結(jié)如圖圖13

拼接后的正射影像5、IGS字化測(cè)點(diǎn)擊“測(cè)圖IGS數(shù)字化圖”進(jìn)入到數(shù)字化測(cè)界面,然后依次新建VZV矢量文件裝影像數(shù)據(jù)后通過紅綠眼睛對(duì)測(cè)區(qū)行矢量化。3圖14IGS數(shù)字化測(cè)圖圖15

矢量圖形6、空中角測(cè)量1)數(shù)據(jù)準(zhǔn)備和圖像處理打開VirtuozoAAT,依次“建測(cè)區(qū)—設(shè)置參---引入影像”4圖16

輸入影像注意第二條航帶的項(xiàng)要選上相機(jī)旋。然后進(jìn)行“內(nèi)向航帶間偏移量”圖17

航帶間偏移量在圖中選取航帶間同名點(diǎn),系統(tǒng)會(huì)動(dòng)計(jì)算航帶間偏量設(shè)置好航帶間偏移量之后,始提取連接點(diǎn),后運(yùn)行自動(dòng)挑點(diǎn)序。2)交互式編輯打開交互式編輯界,一次在每張圖上選點(diǎn),保證每藍(lán)框周圍至少有3個(gè)點(diǎn)就行。圖18

選點(diǎn)

圖19

使用PATB平差然后加入控制點(diǎn),要在測(cè)區(qū)中加入個(gè)控制點(diǎn),然后用PATB進(jìn)行平差,就可以使“預(yù)測(cè)控制點(diǎn)”測(cè)出其余的控制的位置,然后依次選出控制點(diǎn)坐。5圖20

控制點(diǎn)

圖21

被挑出的點(diǎn)可能一次選擇的點(diǎn)度不夠會(huì)有誤差限的點(diǎn),顯示在圖21中帶有星號(hào),然后對(duì)帶星號(hào)的點(diǎn)從新定,這樣直到?jīng)]有號(hào)的點(diǎn)。至此,交互式編輯完成。3)三角測(cè)量打開VirtuozoNT,打在AAT中建立的測(cè)區(qū),自動(dòng)創(chuàng)建區(qū),之就可以使用批處理功進(jìn)行自動(dòng)化處理至此,三角測(cè)量成。圖224)DEM拼接和正射影制作

批處理界面按照前面的拼接步進(jìn)行DEM拼接和正影像的制作,結(jié)果如:圖23DEM

圖24

正射影像63、GeoWay實(shí)習(xí)流程1、交互編輯1)新建工程,設(shè)相關(guān)參數(shù)(PS:對(duì)照表添加[LAYER][ENDSEC],然后SYM符號(hào)庫文件拷貝到C:\WINDOWS\GeoSymbol)圖1參數(shù)設(shè)置界面2)生成內(nèi)圖廓線圖2生成圖廓線73)交互式地物編1、加載柵格圖層點(diǎn)擊柵格圖層,加載tfw數(shù)據(jù),加入柵格圖,然后生成內(nèi)圖廓,網(wǎng)線圖3加載柵格圖層勾選跨層輸入編輯設(shè)置激活圖層,后點(diǎn)擊相應(yīng)地物設(shè)為輸入地物類。點(diǎn)、單線、雙線編點(diǎn)、線處理。懸掛和偽節(jié)點(diǎn)處理,具—檢查—懸掛節(jié)點(diǎn)進(jìn)行偽節(jié)點(diǎn)檢測(cè)。批理—消除懸掛點(diǎn)偽節(jié)點(diǎn)能夠消除部分錯(cuò)誤,不能消除的部分進(jìn)行工編輯。圖4節(jié)點(diǎn)編輯后的圖5、面處理。新建屋對(duì)照表,在拓?fù)錁?gòu)時(shí)啟用房屋對(duì)照,然后8拓?fù)浠《晤A(yù)處理,后進(jìn)行拓?fù)錁?gòu)建對(duì)于拓?fù)錁?gòu)建中遺漏的要手工處理后再次構(gòu)建圖5拓?fù)錁?gòu)建后的圖2、GEOWAY空三加1)新建工程,數(shù)準(zhǔn)備并檢查依次點(diǎn)擊“新建工選擇數(shù)據(jù)所在目錄初始構(gòu)網(wǎng)”后點(diǎn)擊“生成成果生成單色點(diǎn)”用mashlab開.ply文件,查點(diǎn)云和構(gòu)網(wǎng)結(jié)果圖6點(diǎn)云圖

圖7網(wǎng)形圖92)控制網(wǎng)平差“常規(guī)處理光束平差刪除殘差于域值的點(diǎn)自網(wǎng)平差重復(fù)上述步驟直到小殘差小于閾值60PS:每次刪除的點(diǎn)能太多,以防刪除過多正確點(diǎn))3)精確匹配并查匹配結(jié)果點(diǎn)擊“常規(guī)處理確匹配一步匹配圖8圖94)刺點(diǎn)常規(guī)處理光束法平常規(guī)處理絕定向(GPS)刺點(diǎn)10圖10刺點(diǎn)界面5)空三結(jié)果圖113、立體圖(無機(jī))1)新建方案和數(shù)準(zhǔn)備影像管理加載影模型管理新建模型控制點(diǎn)編輯導(dǎo)入制點(diǎn)像點(diǎn)導(dǎo)入導(dǎo)入像點(diǎn)外方為元素導(dǎo)入入外方位元素2)初步處理內(nèi)定向—相對(duì)定向絕對(duì)定向—核線采樣11圖12相對(duì)定向3)批處理圖134)地物采集新建加工工程,然依次進(jìn)行高程點(diǎn)道路、房屋、比點(diǎn)、等高線的采集圖14地物采集結(jié)果5)DEM編輯點(diǎn)線處理采集特線處理—選擇特征線理面處理—自適應(yīng)內(nèi),量測(cè)點(diǎn)內(nèi)插局置平、水域處理12圖15DEM編輯前6)TIN網(wǎng)處理

圖16DEM編輯后圖17編輯前

圖18編輯后13圖19編輯后7)質(zhì)量檢查1、設(shè)置質(zhì)檢方案制作方案—加入工作案圖20檢查報(bào)告

圖21方案設(shè)置2、新建檢查任務(wù)指定目錄到數(shù)據(jù)所在錄。然后自動(dòng)檢錯(cuò)誤并查看錯(cuò)誤,然后對(duì)量圖進(jìn)行修改14圖22編輯前

圖23編輯后圖24編輯前

圖25編輯后15四、程內(nèi)1、單像間后方會(huì)#include"hfjhdialog.h"#include<opencv.hpp>#include<vector>#include<string>#include<fstream>#include<iostream>#include<QFileDialog>usingnamespaceHFJHDialog::HFJHDialog(QWidget*parent):QDialog(parent),ui(newUi::HFJHDialog){ui->setupUi();char*title=空間后方交會(huì);QStringqtitleQString::fromLocal8Bit(title);setWindowTitle(qtitle);ui->textBrowser->setText("---------------HFJH--------------"http://焦距單位pixelfx=4547.99665;fy=4547.87373;//內(nèi)方位元素pixel0=47.48571;0=12.02756;//畸變參數(shù)k1=-5.00793e-009;k2=1.83462e-016;p1=-2.24419e-008;p2=1.76820e-008;//初始值Xs0=4300.0;Ys0=-150.0;Zs0=-300.0;//單位mmphi0=0.0;omega0=0.0;kappa0=0.0;//單位r}HFJHDialog::~HFJHDialog(){deleteui;}//讀取像點(diǎn)坐標(biāo)intHFJHDialog::readxy(string{intindex=//path="F:\\我的課程\數(shù)字?jǐn)z影測(cè)影像數(shù)據(jù)\\后方交會(huì)\像點(diǎn)坐標(biāo)txt";ifstreamfil;fil.open(path);if(!fil){char*log=打開像點(diǎn)文件失敗<<"ui->textBrowser->append(QString::fromLocal8Bit(log));return-1;}xytmp;while(!fil.eof()){fil>>tmp.index>>tmp.x>>tmp.y;ui->textBrowser->append(QString(x:%2y:%3").arg(index).arg(tmp.x).arg(tmp.y));index++;pic.push_back(tmp);}fil.close();return0;}//讀取物方點(diǎn)坐標(biāo)intHFJHDialog::readXYZ(string{intindex=16ifstreamfil;fil.open(path);if(!fil){char*log=打開控制點(diǎn)文件失敗<<";ui->textBrowser->append(QString::fromLocal8Bit(log));return-1;}XYZtmp;stringhead;for(i=0;i<++i){fil>>head;}while(!fil.eof()){fil>>tmp.index>>tmp.X>>tmp.Y>>tmp.Z;ui->textBrowser->append(QString(X:%2Y:%3Z:%3").arg(index).arg(tmp.X).arg(tmp.Y).arg(tmp.Z));index++;obj.push_back(tmp);}fil.close();return0;}//讀取相機(jī)參數(shù)文件intHFJHDialog::readcamera(string{intindex=//path="F:\\我的課程\數(shù)字?jǐn)z影測(cè)影像數(shù)據(jù)\\后方交會(huì)\像點(diǎn)坐標(biāo)txt";ifstreamfil;fil.open(path);if(!fil){char*log=打開相機(jī)文件失敗<<"ui->textBrowser->append(QString::fromLocal8Bit(log));return-1;}fil.close();return0;}//空間后方交會(huì)算法體函數(shù)voidHFJHDialog::HFJH(){//結(jié)果值doubleXs=Xs0,Ys=Ys0,Zs=Zs0;//定義doubleomega=omega0,kappa=kappa0;//定義doublex,y,X,Y,Z;//定義X,Y,Zdoublea1,a2,a3,b1,b2,b3,c1,c2,c3;doubleX_,Y_,Z_;doublea11,a12,a13,a14,a15,a16;doublea21,a22,a23,a24,a25,a26;doublelx,ly;doubler_r,dy;cv::MatL,dX;//,A0,A1;//迭代終止閾值doublee=/206265;//單位權(quán)中誤差doublem0;intindex=//求取主點(diǎn)坐標(biāo)doubleW=5344.0;doubleH=4008.0;0=W/2x0;0=H/2y0;do{for(size_t=0;ipic.size();{17=pic[i].x;=pic[i].y;=0;=0;=0;for(size_t=0;j<obj.size();{if(obj[j].indexpic[i].index){=obj[j].X;=obj[j].Y;=obj[j].Z;break}}if(abs(x)1){char*arg1"像點(diǎn)";char*arg2"沒有找到對(duì)應(yīng)的制點(diǎn)";ui->textBrowser->append(QString().arg(QString::fromLocal8Bit(arg1)).arg(pic[i].index).arg(QString::fromLocal8Bit(arg2)));continue}//求觀測(cè)值的改正r_r=(x-x0)*(xx0)+(y-y0)*(yy0);dx=(x-x0)*(k1*r_r+k2*r_r*r_r)+p1*(r_r+2*(x-x0)*(x-x0))-2*p2*(xx0)*(y-y0);dy=-(y-y0)*(k1*r_rk2*r_r*r_r)p2*(r_r2*-y0)*(y-y0))-2*p1*(xx0)*(y-y0);//經(jīng)過畸變改正后的點(diǎn)坐標(biāo)觀測(cè)值=(x-x0)dx;=-(y-y0)dy;//求矩陣各元素的值a1=cos(phi)*cos(kappa)sin(phi)*sin(omega)*sin(kappa);a2=-cos(phi)*sin(kappa)sin(phi)*sin(omega)*cos(kappa);3=-sin(phi)*cos(omega);1=cos(omega)*sin(kappa);b2=cos(omega)*cos(kappa);3=-sin(omega);1=sin(phi)*cos(kappa)cos(phi)*sin(omega)*sin(kappa);c2=-sin(phi)*sin(kappa)cos(phi)*sin(omega)*cos(kappa);c3=cos(phi)*cos(omega);//求X,Y_,_=a1*(XXs)+b1*(YYs)+c1*(ZZs);_=a2*(XXs)+b2*(YYs)+c2*(ZZs);_=a3*(XXs)+b3*(YYs)+c3*(ZZs);//求x,的近似值doublex_=-fx*X_Z_;doubley_=-fy*Y_Z_;//求矩陣各元素的值lx=x-x_;ly=y-y_;//求矩陣各元素的值a11=1/Z_*(a1*fxa3*x);a12=1/Z_*(b1*fxb3*x);a13=1/Z_*(c1*fxc3*x);a21=1/Z_*(a2*fya3*y);a22=1/Z_*(b2*fyb3*y);a23=1/Z_*(c2*fyc3*y);a14=y*sin(omega)-(x/fx*(x*cos(kappa)-y*sin(kappa))+fx*cos(kappa))*cos(omega);a15=-fx*sin(kappa)x/fx*(x*sin(kappa)y*cos(kappa));a16=y;a24=-x*sin(omega)-(y/fy*(x*cos(kappa)-y*sin(kappa))-fy*sin(kappa))*cos(omega);a25=-fy*cos(kappa)y/fy*(x*sin(kappa)y*cos(kappa));a26=-x;//合成矩陣doublea[12]{a11,a12,a14,a15,a16,a21,a23,a24,a25,18a26};doublel[2]{lx,};cv::MatAi(2,CV_64FC1,a);cv::MatLi(2,CV_64FC1,l);A.push_back(Ai);L.push_back(Li);}//計(jì)算dX=(A.t()A).inv()A.t()*s+=dX.at<>(0,0);s+=dX.at<>(1,0);s+=dX.at<>(2,0);phi+=dX.at<>(3,0);omega+=dX.at<>(4,0);kappa+=dX.at<>(5,0);ui->textBrowser->append(QString(%2%3%4%5%6%7").arg(index).arg(dX.at<>(0)).arg(dX.at<double>(1)).arg(dX.at<double>(2)).arg(dX.at<>(3)).arg(dX.at<>(4)).arg(dX.at<>(5)));index++;cv::MatM0=(A*dXL).t()*(A*dXL);m0=sqrt(M0.at<>(0)/(2*pic.size()6));A.release();L.release();if(index>100)}while(fabs(dX.at<double>(0))>0.001||fabs(dX.at<>(3))>e);ui->textBrowser->append(QString());ui->textBrowser->append(QString(Ys:%2Zs:%3phi:%4omega:%5kappa:%6").arg(Xs).arg(Ys).arg(Zs).arg(phi).arg(omega).arg(kappa));char*log=單位權(quán)中誤差:;ui->textBrowser->append(QString().arg(QString::fromLocal8Bit(log)).arg(m0));}voidHFJHDialog::on_pushButton_clicked(){QStringqpathQFileDialog::getOpenFileName();stringpathqpath.toLocal8Bit();if(readxy(path)-1){char*log"讀取像點(diǎn)坐標(biāo)誤XXXXXX";ui->textBrowser->append(QString::fromLocal8Bit(log));return;}char*log=讀取像點(diǎn)坐標(biāo)結(jié)束OOOOO"ui->textBrowser->append(QString::fromLocal8Bit(log));ui->lineEdit->setText(qpath);}voidHFJHDialog::on_pushButton_2_clicked(){QStringqpathQFileDialog::getOpenFileName();stringpathqpath.toLocal8Bit();if(readXYZ(path)-1){char*log=讀取控制點(diǎn)坐標(biāo)錯(cuò)誤XXXXX"ui->textBrowser->append(QString::fromLocal8Bit(log));return;}char*log=讀取控制點(diǎn)坐標(biāo)結(jié)束OOOOO"ui->textBrowser->append(QString::fromLocal8Bit(log));ui->lineEdit_2->setText(qpath);}voidHFJHDialog::on_pushButton_4_clicked(){HFJH();}voidHFJHDialog::on_pushButton_5_clicked(){HFJHDialog::close();}19圖1控件后方交會(huì)2、特征配#include"match.h"#include<opencv.hpp>#include<iostream>#include<fstream>usingnamespaceusingnamespace//構(gòu)造函數(shù)Mmatch::Mmatch(length,intflag){Mlength=length;Mflag=flag;match();}//構(gòu)建子窗體voidMmatch::findsubwin(MatMat&dst,intintj,intlength){dst=Mat::zeros(length,CV_8UC1);intxl=ilength/intyl=jlength/intxr=ilength/intyr=jlength/intxdl=intydl=intxdr=length1;intydr=length1;if(xl<0){xdl=0-xl;xl=0;}if(yl<{ydl=0-yl;yl=0;}if(xr>=src.cols){xdr=(dst.cols(xr-(src.cols-1));20xr=src.cols1;}if(yr>=src.rows){ydr=(dst.rows-1)(yr-(src.rows-1));yr=src.rows1;}MatsROI=src(Range(yl+1,Range(xl+1,xr+1));sROI.copyTo(dst(Range(ydl+1,Range(xdl+1,xdr+1)));}//匹配算法主體函數(shù)intMmatch::match(){stringpath1"E:\\我的程\\數(shù)字?jǐn)z測(cè)量影像數(shù)據(jù)\匹配\\1BAK.bmp"stringpath2"E:\\我的程\\數(shù)字?jǐn)z測(cè)量影像數(shù)據(jù)\匹配\\2BAK.bmp"stringpath"E:\\我的課程\數(shù)字?jǐn)z影量影像數(shù)據(jù)\\匹配\\1BAK_points.txt"ifstreamfil;vector<point>pointssrc;fil.open(path);if(!fil){cout<<"readpoints<<endl;return-1;}intindex;pointpt;while(!fil.eof()){fil>>indexpt.xpt.y;pointssrc.push_back(pt);}Matsrc1=imread(path1,CV_LOAD_IMAGE_GRAYSCALE);Matsrc2=imread(path2,CV_LOAD_IMAGE_GRAYSCALE);if(src1.empty()src2.empty()){cout<<"readimage<<endl;return-1;}vector<point>pointsdst;Matsubwinsrc,subwindst;for(inti0;i<pointssrc.size();{pointtpoint;findsubwin(src1,subwinsrc,pointssrc[i].x,pointssrc[i].y,Mlength);findsamename(src2,subwinsrc,tpoint);pointsdst.push_back(tpoint);}Matdst1,dst2;cvtColor(src1,dst1,CV_GRAY2RGB);cvtColor(src2,dst2,CV_GRAY2RGB);CvFontfont;cvInitFont(&font,CV_FONT_HERSHEY_PLAIN,1.0,1.0);for(inti0;i<pointssrc.size();{charcind[5];sprintf(cind,,i+1);line(dst1,Point(pointssrc[i].x-3,pointssrc[i].y-3),Point(pointssrc[i].x+3,pointssrc[i].y+3),CV_RGB(255,0,0));line(dst1,Point(pointssrc[i].x-3,pointssrc[i].y+3),Point(pointssrc[i].x+3,pointssrc[i].y-3),CV_RGB(255,0));putText(dst1,cind,Point(pointssrc[i].x+4,pointssrc[i].y+5),CV_FONT_HERSHEY_PLAIN,1.0,CV_RGB(255,0,0));line(dst2,Point(pointsdst[i].x-3,pointsdst[i].y-3),Point(pointsdst[i].x+3,pointsdst[i].y+3),CV_RGB(255,0,0));line(dst2,Point(pointsdst[i].x-3,pointsdst[i].y+3),Point(pointsdst[i].x+3,pointsdst[i].y-3),CV_RGB(255,0,0));putText(dst2,cind,Point(pointsdst[i].x+4,pointsdst[i].y+5),CV_FONT_HERSHEY_PLAIN,1.0,CV_RGB(255,0,0));}21imshow(,dst1);imshow(,dst2);waitKey();return0;}//尋找同名點(diǎn)函數(shù)voidMmatch::findsamename(MatMat&subwin,point{Matsubwind;intlengthsubwin.cols;inthelf_lengthlength2;intflag=Mflag;floatrelate0;for(inti0;i<src.cols;{for(intj0;j<src.rows;{findsubwin(src,subwind,j,length);if(i==helf_lengthj==helf_length){relate=compare(subwin,flag);dst.x=dst.y=}floattmp=compare(subwin,flag);if(tmp>relate){relate=tmp;dst.x=dst.y=}}}}//特征向量比較函數(shù)floatMmatch::compare(MatMat&subwind,flag){floatsum=0.0;floatavg10.0,avg20.0;floatsdv10.0,sdv20.0;intnr=subwin.rows;intnc=subwin.cols;if(subwin.isContinuous()&&subwind.isContinuous()){nc=nc*nr;nr=1;}switch(flag){case1://關(guān)函數(shù)法for(inti0;i<nr;{uchar*subwin_ptrsubwin.ptr<uchar>(i);uchar*subwind_ptr=subwind.ptr<uchar>(i);for(intj0;j<nc;{sum+=(float)(*(subwin_ptr+j)*(*(subwind_ptr+j)));}}returnsum;case2:協(xié)方差函數(shù)法for(inti0;i<nr;{uchar*subwin_ptrsubwin.ptr<uchar>(i);uchar*subwind_ptr=subwind.ptr<uchar>(i);for(intj0;j<nc;{avg1+=*(subwin_ptr+j);avg2+=*(subwind_ptr+j);22}}avg1=avg1(subwin.rows*subwin.cols);avg2=avg2(subwind.rows*subwind.cols);for(inti0;i<nr;{uchar*subwin_ptrsubwin.ptr<uchar>(i);uchar*subwind_ptr=subwind.ptr<uchar>(i);for(intj0;j<nc;{sum+=(*(subwin_ptr+j)-avg1)*(*(subwind_ptr+j)-avg2);}}returnsum;case3:相關(guān)系數(shù)法for(inti0;i<nr;{uchar*subwin_ptrsubwin.ptr<uchar>(i);uchar*subwind_ptr=subwind.ptr<uchar>(i);for(intj0;j<nc;{avg1+=*(subwin_ptr+j);avg2+=*(subwind_ptr+j);}}avg1=avg1(subwin.rows*subwin.cols);avg2=avg2(subwind.rows*subwind.cols);for(inti0;i<nr;{uchar*subwin_ptrsubwin.ptr<uchar>(i);uchar*subwind_ptr=subwind.ptr<uchar>(i);for(intj0;j<nc;{sum+=(*(subwin_ptr+j)-avg1)*(*(subwind_ptr+j)-avg2);}}for(inti0;i<nr;{uchar*subwin_ptrsubwin.ptr<uchar>(i);uchar*subwind_ptr=subwind.ptr<uchar>(i);for(intj0;j<nc;{sdv1+=(*(subwin_ptr+j)-avg1)*(*(subwin_ptr+j)-avg1);sdv2+=(*(subwind_ptr+j)-avg2)*(*(subwind_ptr+j)-avg2);}}sum=sum/sqrtf(sdv1*sdv2);returnsum;case4:差平方和法for(inti0;i<nr;{uchar*subwin_ptrsubwin.ptr<uchar>(i);uchar*subwind_ptr=subwind.ptr<uchar>(i);for(intj0;j<nc;{sum+=(float)(*(subwin_ptr+j)-*(subwind_ptr+j))*(*(subwin_ptr+j)-*(subwind_ptr+j));}}return-sum;case5:差絕對(duì)值和法for(inti0;i<nr;{uchar*subwin_ptrsubwin.ptr<uchar>(i);uchar*subwind_ptr=subwind.ptr<uchar>(i);for(intj0;j<nc;{sum+=(float)abs(*(subwin_ptr+j)-*(subwind_ptr+j));}23}

}return-sum;defaultbreak}returnsum;圖2相關(guān)函數(shù)

圖3協(xié)方差圖4相關(guān)系數(shù)

圖5差平方和圖6差絕對(duì)值3、同名線提取#include"hx.h"#include<opencv.hpp>#include<vector>#include<string>#include<fstream>#include<iostream>#include<QFileDialog>usingnamespace//構(gòu)造函數(shù)HXDialog::HXDialog(QWidget*parent):QDialog(parent),ui(newUi::Dialog){ui->setupUi();}HXDialog::~HXDialog(){}voidHXDialog::on_pushButton_clicked(){path1=QFileDialog::getOpenFileName(ui->lineEdit->setText(path1);24}voidHXDialog::on_pushButton_2_clicked(){path2=QFileDialog::getOpenFileName();ui->lineEdit_2->setText(path2);}voidHXDialog::on_pushButton_3_clicked(){tpath1=QFileDialog::getOpenFileName(ui->lineEdit_3->setText(tpath1);}voidHXDialog::on_pushButton_4_clicked(){tpath2=QFileDialog::getOpenFileName(ui->lineEdit_4->setText(tpath2);}//讀取同名點(diǎn)數(shù)據(jù)intHXDialog::readxy(stringp2){intindex=ifstreamfil;xytmp;inthead;//讀取圖像的像點(diǎn)坐標(biāo)fil.open(p1);if(!fil){cout<<"readerror"<<endl;return-1;}fil>>head;while(!fil.eof()){fil>>tmp.indextmp.x>>tmp.y;cout<<"read"<<index<<":"<<tmp.index<<""<<tmp.x<<""<<tmp.y<<endl;index++;pic1.push_back(tmp);}fil.clear();fil.close();//讀取圖像的像點(diǎn)坐標(biāo)index=fil.open(p2);if(!fil){cout<<"readerror"<<endl;return-1;}fil>>head;while(!fil.eof()){fil>>tmp.indextmp.x>>tmp.y;cout<<"read"<<index<<":"<<tmp.index<<""<<tmp.x<<""<<tmp.y<<endl;index++;pic2.push_back(tmp);}cout<<"read<<endl;fil.close();cout<<"closeobjfile..."endl;return0;}classfindxy{publicfindxy(index){indindex;}intind;booloperator(HXDialog::xy&pt){25returnindpt.index;}};//同名核線算法主函voidHXDialog::HX(){stringp1=tpath1.toLocal8Bit();stringp2=tpath2.toLocal8Bit();//讀取同名點(diǎn)坐標(biāo)readxy(p1,p2);//初始值p1=path1.toLocal8Bit();p2=path2.toLocal8Bit();cv::Matimg1cv::imread(p1);cv::Matimg2cv::imread(p2);cv::Matcv::Matif(img1.empty()img2.empty()){cout<<"readimage<<endl;return;}for(inti0;i<pic1.size();{doublex=pic1[i].x;doubley=pic1[i].y;doublex_=pic2[i].x;doubley_=pic2[i].y;cv::MattmpB(cv::Size(8,CV_64FC1);tmpB.at<>(0)=

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論