資源簡介
提供四步相移的接口,可用于完整工程。主要利用Opencv::Mat類進行矩陣運算和索引,實現包裹相位的計算提取、多頻解相進行解包裹、濾除噪聲點。

代碼片段和文件信息
#include?“rebuildhandle.h“
#include?
rebuildHandle::rebuildHandle(Qobject?*parent):?Qobject(parent)
{
}
void?rebuildHandle::perform()
{
????readSourceImg();
????performStep4();
}
void?rebuildHandle::readSourceImg()
{
????QDir?sourceImgDir(“../CtrlGUI/cal/after“);
????QStringList?filter(“*.bmp“);
????QFileInfoList?imgInfoList?=?sourceImgDir.entryInfoList(filterQDir::FilesQDir::Time|QDir::Reversed);
????for?(int?i?=?0;?i?????{
????????sourceImgs.append(imread(imgInfoList.at(i).filePath().toStdString()0));
????}
}
void?rebuildHandle::performStep4()
{
????Mat_?target(9641292CV_64FC1);//最終相位
//????求出三個頻率的相位主值
????for(int?i=0;i<964;i++)
????{
????????for(int?j=0;j<1292;j++)
????????{
????????????double?indexHigh=0;double?indexMid=0;double?indexLow=0;
????????????indexHigh?=?atan2((sourceImgs.at(3).ptr(i)[j]-sourceImgs.at(1).ptr(i)[j])
??????????????????????????????(sourceImgs.at(2).ptr(i)[j]-sourceImgs.at(0).ptr(i)[j]));
????????????indexMid?=?atan2((sourceImgs.at(7).ptr(i)[j]-sourceImgs.at(5).ptr(i)[j])
??????????????????????????????(sourceImgs.at(6).ptr(i)[j]-sourceImgs.at(4).ptr(i)[j]));
????????????indexLow?=?atan2((sourceImgs.at(11).ptr(i)[j]-sourceImgs.at(9).ptr(i)[j])
??????????????????????????????(sourceImgs.at(10).ptr(i)[j]-sourceImgs.at(8).ptr(i)[j]));
????????????QCoreApplication::processEvents();
????????????indexHigh?+=?3.14159;
????????????indexMid?+=?3.14159;
????????????indexLow?+=?3.14159;
????????????double?indexTmp1=0;double?indexTmp2=0;
????????????indexTmp1=round((indexMid*5-indexHigh)/(2*3.14159));
????????????indexTmp2=indexHigh+indexTmp1*2*3.14159;
????????????double?indexTarget1=0;double?indexTarget2=0;
????????????indexTarget1=round((indexLow*20-indexTmp2)/(10*3.14159));
????????????indexTarget2=indexTmp2+indexTarget1*10*3.14159;
????????????target.ptr(i)[j]?=?indexTarget2;
????????}
????}
????fitPhase(target);
}
void?rebuildHandle::fitPhase(Mat?&sourceMat)
{
????Mat?height(sourceMat.rowssourceMat.colsCV_8UC1);//最終顯示結果
????QFile?dataFile(“../CtrlGUI/cal/pointCloud.txt“);
????QTextStream?stream;
????stream.setDevice(&dataFile);
????dataFile.open(QIODevice::Text|QIODevice::ReadWrite);
????for(int?i=0;i ????{
????????for(int?j=0;j ????????{
????????????double?tmpa?=?pow((sourceImgs.at(3).ptr(i)[j]-sourceImgs.at(1).ptr(i)[j])2);
????????????double?tmpb?=?pow((sourceImgs.at(2).ptr(i)[j]-sourceImgs.at(0).ptr(i)[j])2);
????????????if(sqrt(tmpa+tmpb)<=30)
????????????{
????????????????height.ptr(i)[j]?=?0;
????????????}
????????????else
????????????{
????????????????height.ptr(i)[j]?=?5-sourceMat.ptr(i)[j];
????????????????stream<????????????}
????????}
????}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????592??2020-04-25?07:27??rebuildhandle.h
?????文件???????3155??2020-04-25?07:38??rebuildhandle.cpp
-----------?---------??----------?-----??----
?????????????????3747????????????????????2
- 上一篇:前推回代潮流計算
- 下一篇:多界面切換2.rar
評論
共有 條評論