资源简介

提供四步相移的接口,可用于完整工程。主要利用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 < imgInfoList.count(); 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


评论

共有 条评论