Merge branch 'RFPC-dev' of http://172.16.0.12:5000/LAMPSARToolSoftware/RasterProcessTool into RFPC-dev
commit
c45fedc513
|
@ -220,10 +220,11 @@
|
|||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
|
||||
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
|
||||
<EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
|
||||
<OpenMPSupport>true</OpenMPSupport>
|
||||
<LanguageStandard>stdcpp14</LanguageStandard>
|
||||
<LanguageStandard_C>stdc11</LanguageStandard_C>
|
||||
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
|
@ -274,11 +275,12 @@
|
|||
<ClInclude Include="BaseTool\GeoOperator.h" />
|
||||
<ClInclude Include="BaseTool\ImageOperatorBase.h" />
|
||||
<ClInclude Include="BaseTool\LogInfoCls.h" />
|
||||
<QtMoc Include="ToolAbstract\QToolAbstract.h" />
|
||||
<QtMoc Include="BaseTool\QToolProcessBarDialog.h" />
|
||||
<ClInclude Include="BaseTool\SARSimulationImageL1.h" />
|
||||
<ClInclude Include="ShowProessAbstract.h" />
|
||||
<QtMoc Include="ToolAbstract\QToolAbstract.h" />
|
||||
<ClInclude Include="BaseTool\PrintMsgToQDebug.h" />
|
||||
<ClInclude Include="BaseTool\RasterToolBase.h" />
|
||||
<ClInclude Include="BaseTool\SARSimulationImageL1.h" />
|
||||
<ClInclude Include="BaseTool\stdafx.h" />
|
||||
<ClInclude Include="framework.h" />
|
||||
<ClInclude Include="pch.h" />
|
||||
|
@ -287,15 +289,20 @@
|
|||
<ClCompile Include="BaseTool\BaseTool.cpp" />
|
||||
<ClCompile Include="BaseTool\EchoDataFormat.cpp" />
|
||||
<ClCompile Include="BaseTool\FileOperator.cpp" />
|
||||
<ClCompile Include="BaseTool\gdalImageComplexOperator.cpp" />
|
||||
<ClCompile Include="BaseTool\gdalImageOperator.cpp" />
|
||||
<ClCompile Include="BaseTool\GeoOperator.cpp" />
|
||||
<ClCompile Include="BaseTool\ImageOperatorBase.cpp" />
|
||||
<ClCompile Include="BaseTool\LogInfoCls.cpp" />
|
||||
<ClCompile Include="BaseTool\MergeRasterOperator.cpp" />
|
||||
<ClCompile Include="BaseTool\PrintMsgToQDebug.cpp" />
|
||||
<ClCompile Include="BaseTool\QToolProcessBarDialog.cpp" />
|
||||
<ClCompile Include="BaseTool\RasterToolBase.cpp" />
|
||||
<ClCompile Include="BaseTool\SARSimulationImageL1.cpp" />
|
||||
<ClCompile Include="BaseTool\ShowProessAbstract.cpp" />
|
||||
<ClCompile Include="BaseTool\stdafx.cpp" />
|
||||
<ClCompile Include="BaseTool\TestImageOperator.cpp" />
|
||||
<ClCompile Include="dllmain.cpp" />
|
||||
<ClCompile Include="ImageOperatorFuntion.cpp" />
|
||||
<ClCompile Include="pch.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">Create</PrecompiledHeader>
|
||||
|
|
|
@ -33,33 +33,36 @@
|
|||
<ClInclude Include="BaseTool\BaseTool.h">
|
||||
<Filter>BaseTool</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="BaseTool\EchoDataFormat.h">
|
||||
<Filter>BaseTool</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="BaseTool\FileOperator.h">
|
||||
<Filter>BaseTool</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="BaseTool\GeoOperator.h">
|
||||
<Filter>BaseTool</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="BaseTool\ImageOperatorBase.h">
|
||||
<Filter>BaseTool</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="BaseTool\LogInfoCls.h">
|
||||
<Filter>BaseTool</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="BaseTool\RasterToolBase.h">
|
||||
<Filter>BaseTool</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="BaseTool\SARSimulationImageL1.h">
|
||||
<Filter>BaseTool</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="BaseTool\stdafx.h">
|
||||
<Filter>BaseTool</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="BaseTool\PrintMsgToQDebug.h">
|
||||
<Filter>BaseTool</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ShowProessAbstract.h">
|
||||
<Filter>BaseTool</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="BaseTool\ImageOperatorBase.h">
|
||||
<Filter>BaseTool</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="BaseTool\EchoDataFormat.h">
|
||||
<Filter>BaseTool</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="BaseTool\SARSimulationImageL1.h">
|
||||
<Filter>BaseTool</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="dllmain.cpp">
|
||||
|
@ -71,30 +74,18 @@
|
|||
<ClCompile Include="BaseTool\BaseTool.cpp">
|
||||
<Filter>BaseTool</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="BaseTool\EchoDataFormat.cpp">
|
||||
<Filter>BaseTool</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="BaseTool\FileOperator.cpp">
|
||||
<Filter>BaseTool</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="BaseTool\GeoOperator.cpp">
|
||||
<Filter>BaseTool</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="BaseTool\ImageOperatorBase.cpp">
|
||||
<Filter>BaseTool</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="BaseTool\LogInfoCls.cpp">
|
||||
<Filter>BaseTool</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="BaseTool\QToolProcessBarDialog.cpp">
|
||||
<Filter>BaseTool</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="BaseTool\RasterToolBase.cpp">
|
||||
<Filter>BaseTool</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="BaseTool\SARSimulationImageL1.cpp">
|
||||
<Filter>BaseTool</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="BaseTool\stdafx.cpp">
|
||||
<Filter>BaseTool</Filter>
|
||||
</ClCompile>
|
||||
|
@ -104,16 +95,45 @@
|
|||
<ClCompile Include="BaseTool\PrintMsgToQDebug.cpp">
|
||||
<Filter>BaseTool</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="BaseTool\ShowProessAbstract.cpp">
|
||||
<Filter>BaseTool</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="BaseTool\gdalImageOperator.cpp">
|
||||
<Filter>BaseTool</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="BaseTool\gdalImageComplexOperator.cpp">
|
||||
<Filter>BaseTool</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ImageOperatorFuntion.cpp">
|
||||
<Filter>BaseTool</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="BaseTool\QToolProcessBarDialog.cpp">
|
||||
<Filter>BaseTool</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="BaseTool\EchoDataFormat.cpp">
|
||||
<Filter>BaseTool</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="BaseTool\SARSimulationImageL1.cpp">
|
||||
<Filter>BaseTool</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="BaseTool\TestImageOperator.cpp">
|
||||
<Filter>BaseTool</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="BaseTool\MergeRasterOperator.cpp">
|
||||
<Filter>BaseTool</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<QtMoc Include="BaseTool\QToolProcessBarDialog.h">
|
||||
<Filter>头文件</Filter>
|
||||
</QtMoc>
|
||||
<QtMoc Include="ToolAbstract\QToolAbstract.h">
|
||||
<Filter>ToolAbstract</Filter>
|
||||
</QtMoc>
|
||||
<QtMoc Include="BaseTool\QToolProcessBarDialog.h">
|
||||
<Filter>BaseTool</Filter>
|
||||
</QtMoc>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<QtUic Include="BaseTool\QToolProcessBarDialog.ui" />
|
||||
<QtUic Include="BaseTool\QToolProcessBarDialog.ui">
|
||||
<Filter>BaseTool</Filter>
|
||||
</QtUic>
|
||||
</ItemGroup>
|
||||
</Project>
|
File diff suppressed because it is too large
Load Diff
|
@ -28,6 +28,9 @@
|
|||
#include <QObject>
|
||||
#include <QList>
|
||||
#include <functional>
|
||||
#include "ShowProessAbstract.h"
|
||||
|
||||
|
||||
|
||||
enum ProjectStripDelta {
|
||||
Strip_6, // 6度带
|
||||
|
@ -76,13 +79,6 @@ enum GDALREADARRCOPYMETHOD {
|
|||
|
||||
|
||||
|
||||
class BASECONSTVARIABLEAPI ShowProessAbstract {
|
||||
|
||||
public:
|
||||
virtual void showProcess(double precent, QString tip);
|
||||
virtual void showToolInfo(QString tip);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -234,7 +230,7 @@ public: // 方法
|
|||
Eigen::MatrixXcd getDataComplex(int start_row, int start_col, int rows_count, int cols_count, int band_ids);
|
||||
std::shared_ptr<std::complex<double>> getDataComplexSharePtr(int start_row, int start_col, int rows_count, int cols_count, int band_ids);
|
||||
|
||||
void saveImage() override;
|
||||
void saveComplexImage();//override;
|
||||
void savePreViewImage();
|
||||
public:
|
||||
Eigen::MatrixXcd data;
|
||||
|
@ -316,6 +312,9 @@ void BASECONSTVARIABLEAPI CreateSARIntensityByLookTable(QString IntensityRaster
|
|||
|
||||
|
||||
//--------------------- 图像文件读写 ------------------------------
|
||||
|
||||
|
||||
|
||||
template<typename T>
|
||||
inline std::shared_ptr<T> readDataArr(gdalImage& imgds, long start_row, long start_col, long& rows_count, long& cols_count, int band_ids, GDALREADARRCOPYMETHOD method)
|
||||
{
|
||||
|
|
|
@ -0,0 +1,488 @@
|
|||
#include "stdafx.h"
|
||||
#include "ImageOperatorBase.h"
|
||||
#include "BaseTool.h"
|
||||
#include "GeoOperator.h"
|
||||
#include <Eigen/Core>
|
||||
#include <Eigen/Dense>
|
||||
#include <omp.h>
|
||||
#include <io.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <gdal.h>
|
||||
#include <gdal_utils.h>
|
||||
#include <gdal_priv.h>
|
||||
#include <gdalwarper.h>
|
||||
#include <proj.h>
|
||||
#include <string.h>
|
||||
#include <memory>
|
||||
#include <iostream>
|
||||
#include "FileOperator.h"
|
||||
#include <opencv2/opencv.hpp>
|
||||
#include <QMessageBox>
|
||||
#include <QDir>
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <QProgressDialog>
|
||||
#include <gdal_priv.h>
|
||||
#include <ogr_spatialref.h> // OGRSpatialReference 用于空间参考转换
|
||||
#include <gdal_alg.h> // 用于 GDALWarp 操作
|
||||
|
||||
ErrorCode MergeRasterProcess(QVector<QString> filepaths, QString outfileptah, QString mainString, MERGEMODE mergecode, bool isENVI, ShowProessAbstract* dia)
|
||||
{
|
||||
// 参数检查
|
||||
if (!isExists(mainString)) {
|
||||
qDebug() << QString::fromStdString(errorCode2errInfo(ErrorCode::FILENOFOUND)) << "\t" << mainString;
|
||||
return ErrorCode::FILENOFOUND;
|
||||
}
|
||||
else {}
|
||||
gdalImage mainimg(mainString);
|
||||
QVector<gdalImage> imgdslist(filepaths.count());
|
||||
for (long i = 0; i < filepaths.count(); i++) {
|
||||
if (!isExists(filepaths[i])) {
|
||||
qDebug() << QString::fromStdString(errorCode2errInfo(ErrorCode::FILENOFOUND)) << "\t" << filepaths[i];
|
||||
return ErrorCode::FILENOFOUND;
|
||||
}
|
||||
else {
|
||||
imgdslist[i] = gdalImage(filepaths[i]);
|
||||
if (imgdslist[i].band_num != mainimg.band_num) {
|
||||
qDebug() << QString::fromStdString(errorCode2errInfo(ErrorCode::RASTERBAND_NOTEQUAL)) << "\t" << imgdslist[i].band_num << " != " << mainimg.band_num;
|
||||
return ErrorCode::RASTERBAND_NOTEQUAL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 检查坐标系是否统一
|
||||
long EPSGCode = GetEPSGFromRasterFile(mainString);
|
||||
long tempCode = 0;
|
||||
for (long i = 0; i < filepaths.count(); i++) {
|
||||
tempCode = GetEPSGFromRasterFile(filepaths[i]);
|
||||
if (EPSGCode != tempCode) {
|
||||
qDebug() << QString::fromStdString(errorCode2errInfo(ErrorCode::EPSGCODE_NOTSAME)) << "\t" << EPSGCode << "!=" << tempCode;
|
||||
return ErrorCode::EPSGCODE_NOTSAME;
|
||||
}
|
||||
}
|
||||
|
||||
// 检查影像类型是否统一
|
||||
GDALDataType mainType = mainimg.getDataType();
|
||||
for (long i = 0; i < imgdslist.count(); i++) {
|
||||
if (mainType != imgdslist[i].getDataType()) {
|
||||
qDebug() << QString::fromStdString(errorCode2errInfo(ErrorCode::RASTER_DATETYPE_NOTSAME)) << "\t" << mainType << "!=" << imgdslist[i].getDataType();
|
||||
return ErrorCode::RASTER_DATETYPE_NOTSAME;
|
||||
}
|
||||
}
|
||||
|
||||
Eigen::MatrixXd maingt = mainimg.getGeoTranslation();
|
||||
Eigen::MatrixXd rgt = Eigen::MatrixXd::Zero(2, 3);
|
||||
RasterExtend mainExtend = mainimg.getExtend();
|
||||
rgt(0, 1) = (mainExtend.max_x - mainExtend.min_x) / (mainimg.width - 1); //dx
|
||||
rgt(1, 2) = -1 * std::abs(((mainExtend.max_y - mainExtend.min_y) / (mainimg.height - 1)));//dy
|
||||
QVector<RasterExtend> extendlist(imgdslist.count());
|
||||
for (long i = 0; i < imgdslist.count(); i++) {
|
||||
extendlist[i] = imgdslist[i].getExtend();
|
||||
mainExtend.min_x = mainExtend.min_x < extendlist[i].min_x ? mainExtend.min_x : extendlist[i].min_x;
|
||||
mainExtend.max_x = mainExtend.max_x > extendlist[i].max_x ? mainExtend.max_x : extendlist[i].max_x;
|
||||
mainExtend.min_y = mainExtend.min_y < extendlist[i].min_y ? mainExtend.min_y : extendlist[i].min_y;
|
||||
mainExtend.max_y = mainExtend.max_y > extendlist[i].max_y ? mainExtend.max_y : extendlist[i].max_y;
|
||||
}
|
||||
|
||||
rgt(0, 0) = mainExtend.min_x;
|
||||
rgt(1, 0) = mainExtend.max_y;
|
||||
|
||||
// 计算数量
|
||||
|
||||
long width = std::ceil((mainExtend.max_x - mainExtend.min_x) / rgt(0, 1) + 1);
|
||||
long height = std::ceil(std::abs((mainExtend.min_y - mainExtend.max_y) / rgt(1, 2)) + 1);
|
||||
OGRSpatialReference oSRS;
|
||||
if (oSRS.importFromEPSG(EPSGCode) != OGRERR_NONE) {
|
||||
qDebug() << QString::fromStdString(errorCode2errInfo(ErrorCode::EPSGCODE_NOTSUPPORT)) << "\t" << EPSGCode;
|
||||
return ErrorCode::EPSGCODE_NOTSUPPORT;
|
||||
}
|
||||
|
||||
gdalImage resultImage = CreategdalImage(outfileptah, height, width, mainimg.band_num, rgt, EPSGCode, mainType, true, true, isENVI);
|
||||
|
||||
QString resultMaskString = addMaskToFileName(outfileptah, QString("_MASK"));
|
||||
gdalImage maskImage = CreategdalImage(resultMaskString, height, width, 1, rgt, EPSGCode, GDT_Int32, true, true, isENVI);
|
||||
|
||||
// 初始化
|
||||
long resultline = Memory1MB * 500 / 8 / resultImage.width;
|
||||
resultline = resultline < 10000 ? resultline : 10000; // 最多100行
|
||||
resultline = resultline > 0 ? resultline : 2;
|
||||
long bandnum = resultImage.band_num + 1;
|
||||
long starti = 0;
|
||||
long rasterCount = imgdslist.count();
|
||||
|
||||
|
||||
|
||||
QProgressDialog progressDialog(u8"初始化影像", u8"终止", 0, resultImage.height);
|
||||
progressDialog.setWindowTitle(u8"初始化影像");
|
||||
progressDialog.setWindowModality(Qt::WindowModal);
|
||||
progressDialog.setAutoClose(true);
|
||||
progressDialog.setValue(0);
|
||||
progressDialog.setMaximum(resultImage.height);
|
||||
progressDialog.setMinimum(0);
|
||||
progressDialog.show();
|
||||
|
||||
|
||||
for (starti = 0; starti < resultImage.height; starti = starti + resultline) {
|
||||
long blocklines = resultline;
|
||||
blocklines = starti + blocklines < resultImage.height ? blocklines : resultImage.height - starti;
|
||||
for (long b = 1; b < bandnum; b++) {
|
||||
Eigen::MatrixXd data = resultImage.getData(starti, 0, blocklines, resultImage.width, b);
|
||||
Eigen::MatrixXi maskdata = maskImage.getDatai(starti, 0, blocklines, resultImage.width, b);
|
||||
data = data.array() * 0;
|
||||
maskdata = maskdata.array() * 0;
|
||||
resultImage.saveImage(data, starti, 0, b);
|
||||
maskImage.saveImage(maskdata, starti, 0, b);
|
||||
}
|
||||
if (nullptr != dia) {
|
||||
dia->showProcess(starti * 1.0 / resultImage.height, u8"初始化影像数据");
|
||||
}
|
||||
progressDialog.setValue(starti + blocklines);
|
||||
}
|
||||
progressDialog.close();
|
||||
|
||||
|
||||
|
||||
switch (mergecode)
|
||||
{
|
||||
case MERGE_GEOCODING:
|
||||
return MergeRasterInGeoCoding(imgdslist, resultImage, maskImage, dia);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return ErrorCode::SUCCESS;
|
||||
}
|
||||
|
||||
ErrorCode MergeRasterInGeoCoding(QVector<gdalImage> imgdslist, gdalImage resultimg, gdalImage maskimg, ShowProessAbstract* dia)
|
||||
{
|
||||
omp_set_num_threads(Paral_num_thread);
|
||||
// 逐点合并计算
|
||||
QVector<RasterExtend> extendlist(imgdslist.count());
|
||||
for (long i = 0; i < imgdslist.count(); i++) {
|
||||
extendlist[i] = imgdslist[i].getExtend();
|
||||
imgdslist[i].InitInv_gt();
|
||||
}
|
||||
|
||||
// 分块计算
|
||||
long resultline = Memory1MB * 1000 / 8 / resultimg.width;
|
||||
resultline = resultline < 300 ? resultline : 300; // 最多100行
|
||||
|
||||
long bandnum = resultimg.band_num + 1;
|
||||
long starti = 0;
|
||||
long rasterCount = imgdslist.count();
|
||||
|
||||
long processNumber = 0;
|
||||
QProgressDialog progressDialog(u8"合并影像", u8"终止", 0, resultimg.height);
|
||||
progressDialog.setWindowTitle(u8"合并影像");
|
||||
progressDialog.setWindowModality(Qt::WindowModal);
|
||||
progressDialog.setAutoClose(true);
|
||||
progressDialog.setValue(0);
|
||||
progressDialog.setMaximum(resultimg.height);
|
||||
progressDialog.setMinimum(0);
|
||||
progressDialog.show();
|
||||
omp_lock_t lock;
|
||||
omp_init_lock(&lock);
|
||||
|
||||
#pragma omp parallel for
|
||||
for (starti = 0; starti < resultimg.height; starti = starti + resultline) {
|
||||
long blocklines = resultline;
|
||||
blocklines = starti + blocklines < resultimg.height ? blocklines : resultimg.height - starti;
|
||||
|
||||
long rid = starti;
|
||||
long cid = 0;
|
||||
|
||||
Landpoint pp = { 0,0,0 };
|
||||
Landpoint lp = { 0,0,0 };
|
||||
|
||||
for (long ir = 0; ir < rasterCount; ir++) {// 影像
|
||||
long minRid = imgdslist[ir].height;
|
||||
long maxRid = 0;
|
||||
|
||||
Eigen::MatrixXd ridlist = resultimg.getData(starti, 0, blocklines, resultimg.width, 1);
|
||||
ridlist = ridlist.array() * 0;
|
||||
Eigen::MatrixXd cidlist = ridlist.array() * 0;
|
||||
|
||||
for (long i = 0; i < blocklines; i++) {// 行号
|
||||
rid = starti + i;
|
||||
for (long j = 0; j < resultimg.width; j++) {// 列号
|
||||
cid = j;
|
||||
resultimg.getLandPoint(rid, cid, 0, pp);
|
||||
lp = imgdslist[ir].getRow_Col(pp.lon, pp.lat); // 获取点坐标
|
||||
ridlist(i, j) = lp.lat;
|
||||
cidlist(i, j) = lp.lon;
|
||||
}
|
||||
}
|
||||
|
||||
//ImageShowDialogClass* dialog = new ImageShowDialogClass;
|
||||
//dialog->show();
|
||||
//dialog->load_double_MatrixX_data(cidlist, u8"");
|
||||
|
||||
//dialog->exec();
|
||||
|
||||
|
||||
if (ridlist.maxCoeff() < 0 || ridlist.minCoeff() >= imgdslist[ir].height) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (cidlist.maxCoeff() < 0 || cidlist.minCoeff() >= imgdslist[ir].width) {
|
||||
continue;
|
||||
}
|
||||
|
||||
minRid = std::floor(ridlist.minCoeff());
|
||||
maxRid = std::ceil(ridlist.maxCoeff());
|
||||
minRid = minRid < 0 ? 0 : minRid;
|
||||
maxRid = maxRid < imgdslist[ir].height ? maxRid : imgdslist[ir].height - 1;
|
||||
|
||||
long rowlen = maxRid - minRid + 1;
|
||||
if (rowlen <= 0) {
|
||||
continue;
|
||||
}
|
||||
// 获取分配代码
|
||||
Landpoint p0{ 0,0,0 }, p11{ 0,0,0 }, p21{ 0,0,0 }, p12{ 0,0,0 }, p22{ 0,0,0 }, p{ 0,0,0 };
|
||||
|
||||
|
||||
long rowcount = 0;
|
||||
long colcount = 0;
|
||||
double ridtemp = 0, cidtemp = 0;
|
||||
|
||||
long lastr = 0, nextr = 0;
|
||||
long lastc = 0, nextc = 0;
|
||||
|
||||
double r0 = 0, c0 = 0;
|
||||
|
||||
for (long b = 1; b < bandnum; b++) {
|
||||
Eigen::MatrixXd resultdata = resultimg.getData(starti, 0, blocklines, resultimg.width, b);
|
||||
Eigen::MatrixXi resultmask = maskimg.getDatai(starti, 0, blocklines, resultimg.width, b);
|
||||
Eigen::MatrixXd data = imgdslist[ir].getData(minRid, 0, rowlen, imgdslist[ir].width, b);
|
||||
|
||||
double nodata = imgdslist[ir].getNoDataValue(b);
|
||||
for (long ii = 0; ii < data.rows(); ii++) {
|
||||
for (long jj = 0; jj < data.cols(); jj++) {
|
||||
if (std::abs(data(ii, jj) - nodata) < 1e-6) {
|
||||
data(ii, jj) = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
rowcount = ridlist.rows();
|
||||
colcount = ridlist.cols();
|
||||
double Bileanervalue = 0;
|
||||
for (long i = 0; i < rowcount; i++) {
|
||||
for (long j = 0; j < colcount; j++) {
|
||||
ridtemp = ridlist(i, j);
|
||||
cidtemp = cidlist(i, j);
|
||||
|
||||
lastr = std::floor(ridtemp);
|
||||
nextr = std::ceil(ridtemp);
|
||||
lastc = std::floor(cidtemp);
|
||||
nextc = std::ceil(cidtemp);
|
||||
|
||||
if (lastr < 0 || lastr >= imgdslist[ir].height
|
||||
|| nextr < 0 || nextr >= imgdslist[ir].height
|
||||
|| lastc < 0 || lastc >= imgdslist[ir].width
|
||||
|| nextc < 0 || nextc >= imgdslist[ir].width) {
|
||||
continue;
|
||||
}
|
||||
else {}
|
||||
|
||||
r0 = ridtemp - std::floor(ridtemp);
|
||||
c0 = cidtemp - std::floor(cidtemp);
|
||||
|
||||
lastr = lastr - minRid;
|
||||
nextr = nextr - minRid;
|
||||
|
||||
p0 = Landpoint{ c0,r0,0 };
|
||||
p11 = Landpoint{ 0,0,data(lastr,lastc) };
|
||||
p21 = Landpoint{ 0,1,data(nextr,lastc) };
|
||||
p12 = Landpoint{ 1,0,data(lastr,nextc) };
|
||||
p22 = Landpoint{ 1,1,data(nextr,nextc) };
|
||||
Bileanervalue = Bilinear_interpolation(p0, p11, p21, p12, p22);
|
||||
if (std::abs(Bileanervalue) < 1e-6 || resultmask(i, j) > 0) {
|
||||
continue;
|
||||
}
|
||||
resultdata(i, j) = resultdata(i, j) + Bileanervalue;
|
||||
resultmask(i, j) = resultmask(i, j) + 1;
|
||||
}
|
||||
}
|
||||
resultimg.saveImage(resultdata, starti, 0, b);
|
||||
maskimg.saveImage(resultmask, starti, 0, b);
|
||||
}
|
||||
}
|
||||
|
||||
omp_set_lock(&lock);
|
||||
processNumber = processNumber + blocklines;
|
||||
qDebug() << "\rprocess bar:\t" << processNumber * 100.0 / resultimg.height << " % " << "\t\t\t";
|
||||
if (nullptr != dia) {
|
||||
dia->showProcess(processNumber * 1.0 / resultimg.height, u8"合并图像");
|
||||
}
|
||||
if (progressDialog.maximum() <= processNumber) {
|
||||
processNumber = progressDialog.maximum() - 1;
|
||||
}
|
||||
progressDialog.setValue(processNumber);
|
||||
omp_unset_lock(&lock);
|
||||
}
|
||||
omp_destroy_lock(&lock);
|
||||
|
||||
progressDialog.setWindowTitle(u8"影像掩膜");
|
||||
progressDialog.setLabelText(u8"影像掩膜");
|
||||
for (starti = 0; starti < resultimg.height; starti = starti + resultline) {
|
||||
long blocklines = resultline;
|
||||
blocklines = starti + blocklines < resultimg.height ? blocklines : resultimg.height - starti;
|
||||
for (long b = 1; b < bandnum; b++) {
|
||||
Eigen::MatrixXd data = resultimg.getData(starti, 0, blocklines, resultimg.width, b);
|
||||
Eigen::MatrixXd maskdata = maskimg.getData(starti, 0, blocklines, maskimg.width, b);
|
||||
|
||||
for (long i = 0; i < data.rows(); i++) {
|
||||
for (long j = 0; j < data.cols(); j++) {
|
||||
if (maskdata(i, j) == 0) {
|
||||
data(i, j) = -9999;
|
||||
continue;
|
||||
}
|
||||
data(i, j) = data(i, j) / maskdata(i, j);
|
||||
}
|
||||
}
|
||||
|
||||
resultimg.saveImage(data, starti, 0, b);
|
||||
maskimg.saveImage(maskdata, starti, 0, b);
|
||||
}
|
||||
if (nullptr != dia) {
|
||||
dia->showProcess((starti + blocklines) * 1.0 / resultimg.height, u8"影像掩膜");
|
||||
}
|
||||
progressDialog.setValue(starti + blocklines);
|
||||
}
|
||||
|
||||
|
||||
progressDialog.close();
|
||||
return ErrorCode::SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
void MergeTiffs(QList<QString> inputFiles, QString outputFile) {
|
||||
GDALAllRegister();
|
||||
|
||||
if (inputFiles.isEmpty()) {
|
||||
fprintf(stderr, "No input files provided.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
// Open the first file to determine the data type and coordinate system
|
||||
GDALDataset* poFirstDS = (GDALDataset*)GDALOpen(inputFiles.first().toUtf8().constData(), GA_ReadOnly);
|
||||
if (poFirstDS == nullptr) {
|
||||
fprintf(stderr, "Failed to open the first file %s\n", inputFiles.first().toUtf8().constData());
|
||||
return;
|
||||
}
|
||||
|
||||
double adfGeoTransform[6];
|
||||
CPLErr eErr = poFirstDS->GetGeoTransform(adfGeoTransform);
|
||||
if (eErr != CE_None) {
|
||||
fprintf(stderr, "Failed to get GeoTransform for the first file %s\n", inputFiles.first().toUtf8().constData());
|
||||
GDALClose(poFirstDS);
|
||||
return;
|
||||
}
|
||||
|
||||
int nXSize = 0;
|
||||
int nYSize = 0;
|
||||
double minX = std::numeric_limits<double>::max();
|
||||
double minY = std::numeric_limits<double>::max();
|
||||
double maxX = std::numeric_limits<double>::lowest();
|
||||
double maxY = std::numeric_limits<double>::lowest();
|
||||
double pixelWidth = adfGeoTransform[1];
|
||||
double pixelHeight = adfGeoTransform[5];
|
||||
|
||||
// Determine the bounding box and size of the output raster
|
||||
for (const QString& inputFile : inputFiles) {
|
||||
GDALDataset* poSrcDS = (GDALDataset*)GDALOpen(inputFile.toUtf8().constData(), GA_ReadOnly);
|
||||
if (poSrcDS == nullptr) {
|
||||
fprintf(stderr, "Failed to open %s\n", inputFile.toUtf8().constData());
|
||||
continue;
|
||||
}
|
||||
|
||||
double adfThisTransform[6];
|
||||
eErr = poSrcDS->GetGeoTransform(adfThisTransform);
|
||||
if (eErr != CE_None) {
|
||||
fprintf(stderr, "Failed to get GeoTransform for %s\n", inputFile.toUtf8().constData());
|
||||
GDALClose(poSrcDS);
|
||||
continue;
|
||||
}
|
||||
|
||||
minX = std::min(minX, adfThisTransform[0]);
|
||||
minY = std::min(minY, adfThisTransform[3] + adfThisTransform[5] * poSrcDS->GetRasterYSize());
|
||||
maxX = std::max(maxX, adfThisTransform[0] + adfThisTransform[1] * poSrcDS->GetRasterXSize());
|
||||
maxY = std::max(maxY, adfThisTransform[3]);
|
||||
|
||||
GDALClose(poSrcDS);
|
||||
}
|
||||
|
||||
nXSize = static_cast<int>(std::ceil((maxX - minX) / pixelWidth));
|
||||
nYSize = static_cast<int>(std::ceil((maxY - minY) / (-pixelHeight)));
|
||||
|
||||
GDALDriver* poDriver = GetGDALDriverManager()->GetDriverByName("GTiff");
|
||||
if (poDriver == nullptr) {
|
||||
fprintf(stderr, "GTiff driver not available.\n");
|
||||
GDALClose(poFirstDS);
|
||||
return;
|
||||
}
|
||||
|
||||
char** papszOptions = nullptr;
|
||||
GDALDataset* poDstDS = poDriver->Create(outputFile.toUtf8().constData(), nXSize, nYSize, 1, poFirstDS->GetRasterBand(1)->GetRasterDataType(), papszOptions);
|
||||
if (poDstDS == nullptr) {
|
||||
fprintf(stderr, "Creation of output file failed.\n");
|
||||
GDALClose(poFirstDS);
|
||||
return;
|
||||
}
|
||||
|
||||
poDstDS->SetGeoTransform(adfGeoTransform);
|
||||
|
||||
const OGRSpatialReference* oSRS = poFirstDS->GetSpatialRef();
|
||||
poDstDS->SetSpatialRef(oSRS);
|
||||
|
||||
float fillValue = std::numeric_limits<float>::quiet_NaN();
|
||||
void* pafScanline = CPLMalloc(GDALGetDataTypeSizeBytes(poFirstDS->GetRasterBand(1)->GetRasterDataType()) * nXSize);
|
||||
memset(pafScanline, 0, GDALGetDataTypeSizeBytes(poFirstDS->GetRasterBand(1)->GetRasterDataType()) * nXSize);
|
||||
|
||||
// Initialize all pixels to NaN
|
||||
for (int iY = 0; iY < nYSize; ++iY) {
|
||||
GDALRasterBand* poBand = poDstDS->GetRasterBand(1);
|
||||
poBand->RasterIO(GF_Write, 0, iY, nXSize, 1, pafScanline, nXSize, 1, poFirstDS->GetRasterBand(1)->GetRasterDataType(), 0, 0);
|
||||
}
|
||||
|
||||
CPLFree(pafScanline);
|
||||
|
||||
// Read each source image and write into the destination image
|
||||
for (const QString& inputFile : inputFiles) {
|
||||
GDALDataset* poSrcDS = (GDALDataset*)GDALOpen(inputFile.toUtf8().constData(), GA_ReadOnly);
|
||||
if (poSrcDS == nullptr) {
|
||||
fprintf(stderr, "Failed to open %s\n", inputFile.toUtf8().constData());
|
||||
continue;
|
||||
}
|
||||
|
||||
double adfThisTransform[6];
|
||||
poSrcDS->GetGeoTransform(adfThisTransform);
|
||||
|
||||
int srcXSize = poSrcDS->GetRasterXSize();
|
||||
int srcYSize = poSrcDS->GetRasterYSize();
|
||||
|
||||
int dstXOffset = static_cast<int>(std::round((adfThisTransform[0] - minX) / pixelWidth));
|
||||
int dstYOffset = static_cast<int>(std::round((maxY - adfThisTransform[3]) / (-pixelHeight)));
|
||||
|
||||
GDALRasterBand* poSrcBand = poSrcDS->GetRasterBand(1);
|
||||
GDALRasterBand* poDstBand = poDstDS->GetRasterBand(1);
|
||||
|
||||
void* pafBuffer = CPLMalloc(GDALGetDataTypeSizeBytes(poFirstDS->GetRasterBand(1)->GetRasterDataType()) * srcXSize * srcYSize);
|
||||
poSrcBand->RasterIO(GF_Read, 0, 0, srcXSize, srcYSize, pafBuffer, srcXSize, srcYSize, poFirstDS->GetRasterBand(1)->GetRasterDataType(), 0, 0);
|
||||
|
||||
poDstBand->RasterIO(GF_Write, dstXOffset, dstYOffset, srcXSize, srcYSize, pafBuffer, srcXSize, srcYSize, poFirstDS->GetRasterBand(1)->GetRasterDataType(), 0, 0);
|
||||
|
||||
CPLFree(pafBuffer);
|
||||
GDALClose(poSrcDS);
|
||||
}
|
||||
|
||||
GDALClose(poDstDS);
|
||||
GDALClose(poFirstDS);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -261,6 +261,9 @@ namespace RasterToolBase {
|
|||
} else if(oSRS.IsProjected()) {
|
||||
return CoordinateSystemType::ProjectCoordinateSystem;
|
||||
}
|
||||
else {
|
||||
return CoordinateSystemType::UNKNOW;
|
||||
}
|
||||
} else {
|
||||
return CoordinateSystemType::UNKNOW;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
#include "stdafx.h"
|
||||
#include "ShowProessAbstract.h"
|
||||
#include "BaseTool.h"
|
||||
#include "GeoOperator.h"
|
||||
#include "FileOperator.h"
|
||||
#include <QString>
|
||||
|
||||
|
||||
void ShowProessAbstract::showProcess(double precent, QString tip)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void ShowProessAbstract::showToolInfo(QString tip)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,146 @@
|
|||
#include "stdafx.h"
|
||||
#include "ImageOperatorBase.h"
|
||||
#include "BaseTool.h"
|
||||
#include "GeoOperator.h"
|
||||
#include <Eigen/Core>
|
||||
#include <Eigen/Dense>
|
||||
#include <omp.h>
|
||||
#include <io.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <gdal.h>
|
||||
#include <gdal_utils.h>
|
||||
#include <gdal_priv.h>
|
||||
#include <gdalwarper.h>
|
||||
#include <proj.h>
|
||||
#include <string.h>
|
||||
#include <memory>
|
||||
#include <iostream>
|
||||
#include "FileOperator.h"
|
||||
#include <opencv2/opencv.hpp>
|
||||
#include <QMessageBox>
|
||||
#include <QDir>
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <QProgressDialog>
|
||||
#include <gdal_priv.h>
|
||||
#include <ogr_spatialref.h> // OGRSpatialReference 用于空间参考转换
|
||||
#include <gdal_alg.h> // 用于 GDALWarp 操作
|
||||
|
||||
|
||||
|
||||
void testOutAmpArr(QString filename, float* amp, long rowcount, long colcount)
|
||||
{
|
||||
|
||||
|
||||
Eigen::MatrixXd h_amp_img = Eigen::MatrixXd::Zero(rowcount, colcount);
|
||||
|
||||
for (long hii = 0; hii < rowcount; hii++) {
|
||||
for (long hjj = 0; hjj < colcount; hjj++) {
|
||||
h_amp_img(hii, hjj) = amp[hii * colcount + hjj];
|
||||
}
|
||||
}
|
||||
QString ampPath = getDebugDataPath(filename);
|
||||
saveEigenMatrixXd2Bin(h_amp_img, ampPath);
|
||||
qDebug() << filename.toLocal8Bit().constData();
|
||||
qDebug() << "max:\t" << h_amp_img.maxCoeff();
|
||||
qDebug() << "min:\t" << h_amp_img.minCoeff();
|
||||
}
|
||||
|
||||
void testOutAmpArr(QString filename, double* amp, long rowcount, long colcount)
|
||||
{
|
||||
|
||||
|
||||
Eigen::MatrixXd h_amp_img = Eigen::MatrixXd::Zero(rowcount, colcount);
|
||||
|
||||
for (long hii = 0; hii < rowcount; hii++) {
|
||||
for (long hjj = 0; hjj < colcount; hjj++) {
|
||||
h_amp_img(hii, hjj) = amp[hii * colcount + hjj];
|
||||
}
|
||||
}
|
||||
QString ampPath = getDebugDataPath(filename);
|
||||
saveEigenMatrixXd2Bin(h_amp_img, ampPath);
|
||||
qDebug() << filename.toLocal8Bit().constData();
|
||||
qDebug() << "max:\t" << h_amp_img.maxCoeff();
|
||||
qDebug() << "min:\t" << h_amp_img.minCoeff();
|
||||
}
|
||||
|
||||
|
||||
void testOutClsArr(QString filename, long* amp, long rowcount, long colcount) {
|
||||
|
||||
Eigen::MatrixXd h_amp_img = Eigen::MatrixXd::Zero(rowcount, colcount);
|
||||
|
||||
for (long hii = 0; hii < rowcount; hii++) {
|
||||
for (long hjj = 0; hjj < colcount; hjj++) {
|
||||
h_amp_img(hii, hjj) = amp[hii * colcount + hjj];
|
||||
}
|
||||
}
|
||||
QString ampPath = getDebugDataPath(filename);
|
||||
saveEigenMatrixXd2Bin(h_amp_img, ampPath);
|
||||
qDebug() << filename.toLocal8Bit().constData();
|
||||
qDebug() << "max:\t" << h_amp_img.maxCoeff();
|
||||
qDebug() << "min:\t" << h_amp_img.minCoeff();
|
||||
|
||||
}
|
||||
|
||||
void testOutComplexDoubleArr(QString filename, std::complex<double>* data, long rowcount, long colcount)
|
||||
{
|
||||
QString ampPath = getDebugDataPath(filename);
|
||||
gdalImageComplex compleximg = CreateEchoComplex(ampPath, rowcount, colcount, 1);
|
||||
compleximg.saveImage(data, 0, 0, rowcount, colcount, 1);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void testOutDataArr(QString filename, double* data, long rowcount, long colcount)
|
||||
{
|
||||
return testOutAmpArr(filename, data, rowcount, colcount);
|
||||
}
|
||||
|
||||
void testOutDataArr(QString filename, float* data, long rowcount, long colcount)
|
||||
{
|
||||
return testOutAmpArr(filename, data, rowcount, colcount);
|
||||
}
|
||||
|
||||
void testOutDataArr(QString filename, long* data, long rowcount, long colcount)
|
||||
{
|
||||
return testOutClsArr(filename, data, rowcount, colcount);
|
||||
}
|
||||
|
||||
void testOutAntPatternTrans(QString antpatternfilename, double* antPatternArr,
|
||||
double starttheta, double deltetheta,
|
||||
double startphi, double deltaphi,
|
||||
long thetanum, long phinum)
|
||||
{
|
||||
|
||||
|
||||
Eigen::MatrixXd antPatternMatrix(thetanum, phinum);
|
||||
for (long t = 0; t < thetanum; ++t) {
|
||||
for (long p = 0; p < phinum; ++p) {
|
||||
long index = t * phinum + p;
|
||||
if (index < thetanum * phinum) {
|
||||
antPatternMatrix(t, p) = static_cast<double>(antPatternArr[index]); // Copy to Eigen matrix
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Eigen::MatrixXd gt(2, 3);
|
||||
gt(0, 0) = startphi;//x
|
||||
gt(0, 1) = deltaphi;
|
||||
gt(0, 2) = 0;
|
||||
|
||||
gt(1, 0) = starttheta;
|
||||
gt(1, 1) = 0;
|
||||
gt(1, 2) = deltetheta;
|
||||
|
||||
QString antpatternfilepath = getDebugDataPath(antpatternfilename);
|
||||
gdalImage ds = CreategdalImageDouble(antpatternfilepath, thetanum, phinum, 1, gt, "", true, true, true);
|
||||
ds.saveImage(antPatternMatrix, 0, 0, 1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,497 @@
|
|||
#include "stdafx.h"
|
||||
#include "ImageOperatorBase.h"
|
||||
#include "BaseTool.h"
|
||||
#include "GeoOperator.h"
|
||||
#include <Eigen/Core>
|
||||
#include <Eigen/Dense>
|
||||
#include <omp.h>
|
||||
#include <io.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <gdal.h>
|
||||
#include <gdal_utils.h>
|
||||
#include <gdal_priv.h>
|
||||
#include <gdalwarper.h>
|
||||
#include <proj.h>
|
||||
#include <string.h>
|
||||
#include <memory>
|
||||
#include <iostream>
|
||||
#include "FileOperator.h"
|
||||
#include <opencv2/opencv.hpp>
|
||||
#include <QMessageBox>
|
||||
#include <QDir>
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <QProgressDialog>
|
||||
#include <gdal_priv.h>
|
||||
#include <ogr_spatialref.h> // OGRSpatialReference 用于空间参考转换
|
||||
#include <gdal_alg.h> // 用于 GDALWarp 操作
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
gdalImageComplex::gdalImageComplex(const QString& raster_path)
|
||||
{
|
||||
omp_lock_t lock;
|
||||
omp_init_lock(&lock);
|
||||
omp_set_lock(&lock);
|
||||
this->img_path = raster_path;
|
||||
|
||||
GDALAllRegister();
|
||||
CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES");
|
||||
GDALDataset* rasterDataset = (GDALDataset*)(GDALOpen(
|
||||
raster_path.toUtf8().constData(), GA_ReadOnly));
|
||||
this->width = rasterDataset->GetRasterXSize();
|
||||
this->height = rasterDataset->GetRasterYSize();
|
||||
this->band_num = rasterDataset->GetRasterCount();
|
||||
|
||||
double* gt = new double[6];
|
||||
rasterDataset->GetGeoTransform(gt);
|
||||
this->gt = Eigen::MatrixXd(2, 3);
|
||||
this->gt << gt[0], gt[1], gt[2], gt[3], gt[4], gt[5];
|
||||
|
||||
double a = this->gt(0, 0);
|
||||
double b = this->gt(0, 1);
|
||||
double c = this->gt(0, 2);
|
||||
double d = this->gt(1, 0);
|
||||
double e = this->gt(1, 1);
|
||||
double f = this->gt(1, 2);
|
||||
|
||||
this->projection = rasterDataset->GetProjectionRef();
|
||||
|
||||
// 释放投影
|
||||
GDALFlushCache((GDALDatasetH)rasterDataset);
|
||||
GDALClose((GDALDatasetH)rasterDataset);
|
||||
rasterDataset = NULL; // 指矫匡拷
|
||||
this->InitInv_gt();
|
||||
delete[] gt;
|
||||
GDALDestroy(); // or, DllMain at DLL_PROCESS_DETACH
|
||||
omp_unset_lock(&lock); // 锟酵放伙拷斤拷
|
||||
omp_destroy_lock(&lock); // 劫伙拷斤拷
|
||||
}
|
||||
|
||||
gdalImageComplex::~gdalImageComplex() {}
|
||||
|
||||
void gdalImageComplex::setData(Eigen::MatrixXcd data)
|
||||
{
|
||||
this->data = data;
|
||||
}
|
||||
|
||||
void gdalImageComplex::saveImage(Eigen::MatrixXcd data, int start_row, int start_col, int band_ids)
|
||||
{
|
||||
|
||||
|
||||
|
||||
omp_lock_t lock;
|
||||
omp_init_lock(&lock);
|
||||
omp_set_lock(&lock);
|
||||
if (start_row + data.rows() > this->height || start_col + data.cols() > this->width) {
|
||||
QString tip = u8"file path: " + this->img_path;
|
||||
qDebug() << tip;
|
||||
throw std::exception(tip.toUtf8().constData());
|
||||
}
|
||||
GDALAllRegister();
|
||||
CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES");
|
||||
GDALDriver* poDriver = GetGDALDriverManager()->GetDriverByName("ENVI");
|
||||
GDALDataset* poDstDS = nullptr;
|
||||
if (exists_test(this->img_path)) {
|
||||
poDstDS = (GDALDataset*)(GDALOpen(this->img_path.toUtf8().constData(), GA_Update));
|
||||
}
|
||||
else {
|
||||
poDstDS = poDriver->Create(this->img_path.toUtf8().constData(), this->width, this->height,
|
||||
this->band_num, GDT_CFloat64, NULL); // 斤拷锟斤拷
|
||||
poDstDS->SetProjection(this->projection.toUtf8().constData());
|
||||
|
||||
double gt_ptr[6];
|
||||
for (int i = 0; i < this->gt.rows(); i++) {
|
||||
for (int j = 0; j < this->gt.cols(); j++) {
|
||||
gt_ptr[i * 3 + j] = this->gt(i, j);
|
||||
}
|
||||
}
|
||||
poDstDS->SetGeoTransform(gt_ptr);
|
||||
//delete[] gt_ptr;
|
||||
}
|
||||
|
||||
int datarows = data.rows();
|
||||
int datacols = data.cols();
|
||||
|
||||
double* databuffer = new double[data.size() * 2];
|
||||
for (int i = 0; i < data.rows(); i++) {
|
||||
for (int j = 0; j < data.cols(); j++) {
|
||||
databuffer[i * data.cols() * 2 + j * 2] = data(i, j).real();
|
||||
databuffer[i * data.cols() * 2 + j * 2 + 1] = data(i, j).imag();
|
||||
}
|
||||
}
|
||||
|
||||
// poDstDS->RasterIO(GF_Write,start_col, start_row, datacols, datarows, databuffer, datacols,
|
||||
// datarows, GDT_Float32,band_ids, num,0,0,0);
|
||||
poDstDS->GetRasterBand(band_ids)->RasterIO(GF_Write, start_col, start_row, datacols, datarows,
|
||||
databuffer, datacols, datarows, GDT_CFloat64, 0, 0);
|
||||
GDALFlushCache(poDstDS);
|
||||
delete databuffer;
|
||||
GDALClose((GDALDatasetH)poDstDS);
|
||||
GDALDestroy(); // or, DllMain at DLL_PROCESS_DETACH
|
||||
omp_unset_lock(&lock); //
|
||||
omp_destroy_lock(&lock); //
|
||||
}
|
||||
|
||||
void gdalImageComplex::saveImage(std::shared_ptr<std::complex<double>> data, long start_row, long start_col, long rowCount, long colCount, int band_ids)
|
||||
{
|
||||
omp_lock_t lock;
|
||||
omp_init_lock(&lock);
|
||||
omp_set_lock(&lock);
|
||||
if (start_row + rowCount > this->height || start_col + colCount > this->width) {
|
||||
QString tip = u8"file path: " + this->img_path;
|
||||
qDebug() << tip;
|
||||
throw std::exception(tip.toUtf8().constData());
|
||||
return;
|
||||
}
|
||||
GDALAllRegister();
|
||||
CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES");
|
||||
GDALDriver* poDriver = GetGDALDriverManager()->GetDriverByName("ENVI");
|
||||
GDALDataset* poDstDS = nullptr;
|
||||
if (exists_test(this->img_path)) {
|
||||
poDstDS = (GDALDataset*)(GDALOpen(this->img_path.toUtf8().constData(), GA_Update));
|
||||
}
|
||||
else {
|
||||
poDstDS = poDriver->Create(this->img_path.toUtf8().constData(), this->width, this->height,
|
||||
this->band_num, GDT_CFloat64, NULL); // 斤拷锟斤拷
|
||||
poDstDS->SetProjection(this->projection.toUtf8().constData());
|
||||
|
||||
double gt_ptr[6];
|
||||
for (int i = 0; i < this->gt.rows(); i++) {
|
||||
for (int j = 0; j < this->gt.cols(); j++) {
|
||||
gt_ptr[i * 3 + j] = this->gt(i, j);
|
||||
}
|
||||
}
|
||||
poDstDS->SetGeoTransform(gt_ptr);
|
||||
//delete[] gt_ptr;
|
||||
}
|
||||
|
||||
double* databuffer = new double[rowCount * colCount * 2];
|
||||
for (long i = 0; i < rowCount; i++) {
|
||||
for (long j = 0; j < colCount; j++) {
|
||||
databuffer[i * colCount * 2 + j * 2] = data.get()[i * colCount + j].real();
|
||||
databuffer[i * colCount * 2 + j * 2 + 1] = data.get()[i * colCount + j].imag();
|
||||
}
|
||||
}
|
||||
|
||||
// poDstDS->RasterIO(GF_Write,start_col, start_row, datacols, datarows, databuffer, datacols,
|
||||
// datarows, GDT_Float32,band_ids, num,0,0,0);
|
||||
poDstDS->GetRasterBand(band_ids)->RasterIO(GF_Write, start_col, start_row, colCount, rowCount,
|
||||
databuffer, colCount, rowCount, GDT_CFloat64, 0, 0);
|
||||
GDALFlushCache(poDstDS);
|
||||
delete databuffer;
|
||||
GDALClose((GDALDatasetH)poDstDS);
|
||||
GDALDestroy(); // or, DllMain at DLL_PROCESS_DETACH
|
||||
omp_unset_lock(&lock); //
|
||||
omp_destroy_lock(&lock); //
|
||||
|
||||
}
|
||||
|
||||
void gdalImageComplex::saveImage(std::complex<double>* data, long start_row, long start_col, long rowCount, long colCount, int band_ids)
|
||||
{
|
||||
omp_lock_t lock;
|
||||
omp_init_lock(&lock);
|
||||
omp_set_lock(&lock);
|
||||
if (start_row + rowCount > this->height || start_col + colCount > this->width) {
|
||||
QString tip = u8"file path: " + this->img_path;
|
||||
qDebug() << tip;
|
||||
throw std::exception(tip.toUtf8().constData());
|
||||
return;
|
||||
}
|
||||
GDALAllRegister();
|
||||
CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES");
|
||||
GDALDriver* poDriver = GetGDALDriverManager()->GetDriverByName("ENVI");
|
||||
GDALDataset* poDstDS = nullptr;
|
||||
if (exists_test(this->img_path)) {
|
||||
poDstDS = (GDALDataset*)(GDALOpen(this->img_path.toUtf8().constData(), GA_Update));
|
||||
}
|
||||
else {
|
||||
poDstDS = poDriver->Create(this->img_path.toUtf8().constData(), this->width, this->height,
|
||||
this->band_num, GDT_CFloat64, NULL); // 斤拷锟斤拷
|
||||
poDstDS->SetProjection(this->projection.toUtf8().constData());
|
||||
|
||||
double gt_ptr[6];
|
||||
for (int i = 0; i < this->gt.rows(); i++) {
|
||||
for (int j = 0; j < this->gt.cols(); j++) {
|
||||
gt_ptr[i * 3 + j] = this->gt(i, j);
|
||||
}
|
||||
}
|
||||
poDstDS->SetGeoTransform(gt_ptr);
|
||||
//delete[] gt_ptr;
|
||||
}
|
||||
|
||||
double* databuffer = new double[rowCount * colCount * 2];
|
||||
for (long i = 0; i < rowCount; i++) {
|
||||
for (long j = 0; j < colCount; j++) {
|
||||
databuffer[i * colCount * 2 + j * 2] = data[i * colCount + j].real();
|
||||
databuffer[i * colCount * 2 + j * 2 + 1] = data[i * colCount + j].imag();
|
||||
}
|
||||
}
|
||||
|
||||
// poDstDS->RasterIO(GF_Write,start_col, start_row, datacols, datarows, databuffer, datacols,
|
||||
// datarows, GDT_Float32,band_ids, num,0,0,0);
|
||||
poDstDS->GetRasterBand(band_ids)->RasterIO(GF_Write, start_col, start_row, colCount, rowCount,
|
||||
databuffer, colCount, rowCount, GDT_CFloat64, 0, 0);
|
||||
GDALFlushCache(poDstDS);
|
||||
delete databuffer;
|
||||
GDALClose((GDALDatasetH)poDstDS);
|
||||
GDALDestroy(); // or, DllMain at DLL_PROCESS_DETACH
|
||||
omp_unset_lock(&lock); //
|
||||
omp_destroy_lock(&lock); //
|
||||
}
|
||||
|
||||
Eigen::MatrixXcd gdalImageComplex::getDataComplex(int start_row, int start_col, int rows_count,
|
||||
int cols_count, int band_ids)
|
||||
{
|
||||
GDALDataset* poDataset;
|
||||
GDALAllRegister();
|
||||
CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES");
|
||||
|
||||
// 打开TIFF文件
|
||||
poDataset = (GDALDataset*)GDALOpen(this->img_path.toUtf8().constData(), GA_ReadOnly);
|
||||
if (poDataset == nullptr) {
|
||||
QMessageBox::warning(nullptr, u8"错误", u8"无法打开文件:" + this->img_path);
|
||||
qDebug() << u8"无法打开文件:" + this->img_path;
|
||||
}
|
||||
|
||||
// 获取数据集的第一个波段
|
||||
GDALRasterBand* poBand;
|
||||
poBand = poDataset->GetRasterBand(1);
|
||||
|
||||
// 读取波段信息,假设是复数类型
|
||||
int nXSize = cols_count; poBand->GetXSize();
|
||||
int nYSize = rows_count; poBand->GetYSize();
|
||||
|
||||
double* databuffer = new double[nXSize * nYSize * 2];
|
||||
poBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, databuffer, cols_count,
|
||||
rows_count, GDT_CFloat64, 0, 0);
|
||||
GDALClose((GDALDatasetH)poDataset);
|
||||
Eigen::MatrixXcd rasterData(nYSize, nXSize); // 使用Eigen的MatrixXcd
|
||||
for (size_t i = 0; i < nYSize; i++) {
|
||||
for (size_t j = 0; j < nXSize; j++) {
|
||||
rasterData(i, j) = std::complex<double>(databuffer[i * nXSize * 2 + j * 2],
|
||||
databuffer[i * nXSize * 2 + j * 2 + 1]);
|
||||
}
|
||||
}
|
||||
|
||||
delete[] databuffer;
|
||||
return rasterData;
|
||||
}
|
||||
|
||||
std::shared_ptr<std::complex<double>> gdalImageComplex::getDataComplexSharePtr(int start_row, int start_col, int rows_count, int cols_count, int band_ids)
|
||||
{
|
||||
GDALDataset* poDataset;
|
||||
GDALAllRegister();
|
||||
CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES");
|
||||
|
||||
// 打开TIFF文件
|
||||
poDataset = (GDALDataset*)GDALOpen(this->img_path.toUtf8().constData(), GA_ReadOnly);
|
||||
if (poDataset == nullptr) {
|
||||
QMessageBox::warning(nullptr, u8"错误", u8"无法打开文件:" + this->img_path);
|
||||
qDebug() << u8"无法打开文件:" + this->img_path;
|
||||
}
|
||||
|
||||
// 获取数据集的第一个波段
|
||||
GDALRasterBand* poBand;
|
||||
poBand = poDataset->GetRasterBand(1);
|
||||
|
||||
// 读取波段信息,假设是复数类型
|
||||
|
||||
|
||||
double* databuffer = new double[rows_count * cols_count * 2];
|
||||
poBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, databuffer, cols_count,
|
||||
rows_count, GDT_CFloat64, 0, 0);
|
||||
GDALClose((GDALDatasetH)poDataset);
|
||||
|
||||
std::shared_ptr<std::complex<double>> rasterData(new std::complex<double>[rows_count * cols_count], delArrPtr);
|
||||
|
||||
for (size_t i = 0; i < rows_count; i++) {
|
||||
for (size_t j = 0; j < cols_count; j++) {
|
||||
rasterData.get()[i * cols_count + j] = std::complex<double>(databuffer[i * cols_count * 2 + j * 2],
|
||||
databuffer[i * cols_count * 2 + j * 2 + 1]);
|
||||
}
|
||||
}
|
||||
|
||||
delete[] databuffer;
|
||||
return rasterData;
|
||||
}
|
||||
|
||||
void gdalImageComplex::saveComplexImage()
|
||||
{
|
||||
this->saveImage(this->data, this->start_row, this->start_col, this->data_band_ids);
|
||||
}
|
||||
void gdalImageComplex::savePreViewImage()
|
||||
{
|
||||
qDebug() << "void gdalImageComplex::savePreViewImage()";
|
||||
Eigen::MatrixXd data_abs = Eigen::MatrixXd::Zero(this->height, this->width);
|
||||
data_abs = (this->data.array().real().pow(2) + this->data.array().imag().pow(2))
|
||||
.array()
|
||||
.log10() * 10.0; // 计算振幅
|
||||
|
||||
double min_abs = data_abs.minCoeff(); // 最大值
|
||||
double max_abs = data_abs.maxCoeff(); // 最小值
|
||||
double delta = (max_abs - min_abs) / 1000; // 1000分位档
|
||||
Eigen::MatrixX<size_t> data_idx =
|
||||
((data_abs.array() - min_abs).array() / delta).array().floor().cast<size_t>();
|
||||
|
||||
// 初始化
|
||||
double hist[1001];
|
||||
for (size_t i = 0; i < 1001; i++) {
|
||||
hist[i] = 0; // 初始化
|
||||
}
|
||||
for (size_t i = 0; i < this->height; i++) {
|
||||
for (size_t j = 0; j < this->width; j++) {
|
||||
hist[data_idx(i, j)]++;
|
||||
}
|
||||
}
|
||||
|
||||
// 统计
|
||||
size_t count = this->height * this->width;
|
||||
double precent = 0;
|
||||
size_t curCount = 0;
|
||||
double pre2 = 0;
|
||||
bool findprec_2 = true;
|
||||
double pre98 = 0;
|
||||
bool findprec_98 = true;
|
||||
for (size_t i = 0; i < 1001; i++) {
|
||||
precent = precent + hist[i];
|
||||
if (findprec_2 & precent / count > 0.02) {
|
||||
pre2 = i * delta + min_abs;
|
||||
findprec_2 = false;
|
||||
}
|
||||
if (findprec_98 & precent / count > 0.98) {
|
||||
pre98 = (i - 1) * delta + min_abs;
|
||||
findprec_98 = false;
|
||||
}
|
||||
}
|
||||
// 拉伸
|
||||
delta = (pre98 - pre2) / 200;
|
||||
data_idx =
|
||||
((data_abs.array() - pre2).array() / delta).array().floor().cast<size_t>();
|
||||
|
||||
for (size_t i = 0; i < this->height; i++) {
|
||||
for (size_t j = 0; j < this->width; j++) {
|
||||
if (data_idx(i, j) < 0) {
|
||||
data_idx(i, j) = 0;
|
||||
}
|
||||
else if (data_idx(i, j) > 255) {
|
||||
data_idx(i, j) = 255;
|
||||
}
|
||||
else {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 赋值
|
||||
QString filePath = this->img_path;
|
||||
QFile file(filePath);
|
||||
QFileInfo fileInfo(file);
|
||||
|
||||
QString directory = fileInfo.absolutePath();
|
||||
qDebug() << "文件所在目录:" << directory;
|
||||
QString baseName = fileInfo.completeBaseName();
|
||||
qDebug() << "无后缀文件名:" << baseName;
|
||||
|
||||
// 创建文件路径
|
||||
QString previewImagePath = JoinPath(directory, baseName + "_preview.png");
|
||||
cv::Mat img(this->height, this->width, CV_8U, cv::Scalar(0));
|
||||
|
||||
for (size_t i = 0; i < this->height; i++) {
|
||||
for (size_t j = 0; j < this->width; j++) {
|
||||
img.at<uchar>(i, j) = (uchar)(data_idx(i, j));
|
||||
}
|
||||
}
|
||||
//std::string outimgpath=previewImagePath.toUtf8().data();
|
||||
cv::imwrite(previewImagePath.toUtf8().data(), img);
|
||||
}
|
||||
|
||||
|
||||
|
||||
gdalImageComplex CreategdalImageComplex(const QString& img_path, int height, int width,
|
||||
int band_num, Eigen::MatrixXd gt, QString projection,
|
||||
bool need_gt, bool overwrite)
|
||||
{
|
||||
if (exists_test(img_path.toUtf8().constData())) {
|
||||
if (overwrite) {
|
||||
gdalImageComplex result_img(img_path);
|
||||
return result_img;
|
||||
}
|
||||
else {
|
||||
throw "file has exist!!!";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
GDALAllRegister();
|
||||
CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES");
|
||||
GDALDriver* poDriver = GetGDALDriverManager()->GetDriverByName("ENVI");
|
||||
GDALDataset* poDstDS = poDriver->Create(img_path.toUtf8().constData(), width, height, band_num,
|
||||
GDT_CFloat64, NULL);
|
||||
if (need_gt) {
|
||||
poDstDS->SetProjection(projection.toUtf8().constData());
|
||||
|
||||
// 锟斤拷锟斤拷转锟斤拷锟斤拷锟斤拷
|
||||
double gt_ptr[6] = { 0 };
|
||||
for (int i = 0; i < gt.rows(); i++) {
|
||||
for (int j = 0; j < gt.cols(); j++) {
|
||||
gt_ptr[i * 3 + j] = gt(i, j);
|
||||
}
|
||||
}
|
||||
poDstDS->SetGeoTransform(gt_ptr);
|
||||
}
|
||||
//for(int i = 1; i <= band_num; i++) {
|
||||
// poDstDS->GetRasterBand(i)->SetNoDataValue(0); // 回波部分
|
||||
//}
|
||||
GDALFlushCache((GDALDatasetH)poDstDS);
|
||||
GDALClose((GDALDatasetH)poDstDS);
|
||||
GDALDestroy(); // or, DllMain at DLL_PROCESS_DETACH
|
||||
gdalImageComplex result_img(img_path);
|
||||
return result_img;
|
||||
}
|
||||
|
||||
gdalImageComplex CreategdalImageComplexNoProj(const QString& img_path, int height, int width, int band_num, bool overwrite)
|
||||
{
|
||||
|
||||
// 创建新文件
|
||||
omp_lock_t lock;
|
||||
omp_init_lock(&lock);
|
||||
omp_set_lock(&lock);
|
||||
GDALAllRegister();
|
||||
CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES");
|
||||
|
||||
GDALDriver* poDriver = GetGDALDriverManager()->GetDriverByName("ENVI");
|
||||
GDALDataset* poDstDS = (poDriver->Create(img_path.toUtf8().constData(), width, height, band_num, GDT_CFloat64, NULL));
|
||||
GDALFlushCache((GDALDatasetH)poDstDS);
|
||||
GDALClose((GDALDatasetH)poDstDS);
|
||||
//poDstDS.reset();
|
||||
omp_unset_lock(&lock); //
|
||||
omp_destroy_lock(&lock); //
|
||||
|
||||
gdalImageComplex result_img(img_path);
|
||||
return result_img;
|
||||
}
|
||||
|
||||
gdalImageComplex CreateEchoComplex(const QString& img_path, int height, int width, int band_num)
|
||||
{
|
||||
// 创建图像
|
||||
Eigen::MatrixXd gt = Eigen::MatrixXd::Zero(2, 3);
|
||||
//Xgeo = GeoTransform[0] + Xpixel * GeoTransform[1] + Ypixel * GeoTransform[2]
|
||||
//Ygeo = GeoTransform[3] + Xpixel * GeoTransform[4] + Ypixel * GeoTransform[5]
|
||||
// X
|
||||
gt(0, 0) = 0; gt(0, 2) = 1; gt(0, 2) = 0;
|
||||
gt(1, 0) = 0; gt(1, 1) = 0; gt(1, 2) = 1;
|
||||
// Y
|
||||
QString projection = "";
|
||||
gdalImageComplex echodata = CreategdalImageComplex(img_path, height, width, 1, gt, projection, false, true);
|
||||
return echodata;
|
||||
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,15 @@
|
|||
|
||||
#ifndef __SHOWPROCESSABSTRACT_H__
|
||||
#define __SHOWPROCESSABSTRACT_H__
|
||||
#include "BaseConstVariable.h"
|
||||
#include <QString>
|
||||
|
||||
|
||||
class BASECONSTVARIABLEAPI ShowProessAbstract {
|
||||
|
||||
public:
|
||||
virtual void showProcess(double precent, QString tip);
|
||||
virtual void showToolInfo(QString tip);
|
||||
};
|
||||
|
||||
#endif
|
|
@ -14,6 +14,7 @@
|
|||
#define CUDAMEMORY Memory1MB*100
|
||||
|
||||
#define LAMP_CUDA_PI 3.141592653589793238462643383279
|
||||
#define PI4POW2 157.91367041742973
|
||||
|
||||
// SHAREMEMORY_FLOAT_HALF_STEP * BLOCK_SIZE = SHAREMEMORY_FLOAT_HALF
|
||||
/** CUDA µ÷ÓòÎÊý ************************************************************************************/
|
||||
|
@ -117,8 +118,5 @@ extern "C" GPUBASELIBAPI void shared_complexPtrToHostCuComplex(std::complex<doub
|
|||
extern "C" GPUBASELIBAPI void HostCuComplexToshared_complexPtr(cuComplex* src, std::complex<double>* dst, size_t len);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#include <cuda_runtime.h>
|
||||
#include <cublas_v2.h>
|
||||
#include <cuComplex.h>
|
||||
|
||||
#include <math_functions.h>
|
||||
#include "BaseConstVariable.h"
|
||||
#include "GPURFPC.cuh"
|
||||
|
||||
|
@ -14,9 +14,13 @@
|
|||
/* 机器函数 ****************************************************************************************************************************/
|
||||
|
||||
|
||||
extern __device__ double GPU_getSigma0dB(CUDASigmaParam param, double theta) {//线性值
|
||||
double sigma = param.p1 + param.p2 * exp(-param.p3 * theta) + param.p4 * cos(param.p5 * theta + param.p6);
|
||||
return sigma;
|
||||
__device__ double GPU_getSigma0dB(CUDASigmaParam param, double theta)
|
||||
{
|
||||
return param.p1 + param.p2 * exp(-param.p3 * theta) + param.p4 * cos(param.p5 * theta + param.p6);
|
||||
}
|
||||
|
||||
extern __device__ float GPU_getSigma0dB(CUDASigmaParam param, float theta) {//线性值
|
||||
return param.p1 + param.p2 * expf(-param.p3 * theta) + param.p4 * cosf(param.p5 * theta + param.p6);;
|
||||
}
|
||||
|
||||
|
||||
|
@ -466,7 +470,12 @@ void CUDA_RFPC_MainProcess(
|
|||
|
||||
|
||||
|
||||
|
||||
/* 核函数 ****************************************************************************************************************************/
|
||||
inline double SincTarg(double x) {
|
||||
return 1 - (x * x / 6) + (x * x * x * x / 120) - (x * x * x * x * x * x / 5040);
|
||||
}
|
||||
|
||||
|
||||
__global__ void Kernel_Computer_R_amp_NoAntPattern(
|
||||
SateState* antlist,
|
||||
|
@ -478,32 +487,46 @@ __global__ void Kernel_Computer_R_amp_NoAntPattern(
|
|||
double Pt,
|
||||
double refPhaseRange,
|
||||
double NearR, double FarR,
|
||||
double maxGain,double GainWeight,
|
||||
double* d_temp_R, double* d_temp_amps// 计算输出
|
||||
) {
|
||||
long long idx = blockIdx.x * blockDim.x + threadIdx.x; // 获取当前的线程编码
|
||||
long long prfId = idx / SHAREMEMORY_FLOAT_HALF;
|
||||
long long posId = idx % SHAREMEMORY_FLOAT_HALF + startPosId; // 当前线程对应的影像点
|
||||
|
||||
if (prfId < PRFCount && posId < pixelcount) {
|
||||
double RstX = antlist[prfId].Px - goallist[posId].Tx; // 计算坐标矢量
|
||||
double RstY = antlist[prfId].Py - goallist[posId].Ty;
|
||||
double RstZ = antlist[prfId].Pz - goallist[posId].Tz;
|
||||
//if (prfId > 20000) {
|
||||
// printf("prfid %d,PRFCount : %d\n", prfId, PRFCount);
|
||||
//}
|
||||
|
||||
if (prfId < PRFCount && posId < pixelcount) {
|
||||
SateState antp = antlist[prfId];
|
||||
GoalState gp = goallist[posId];
|
||||
double RstX = antp.Px - gp.Tx; // 计算坐标矢量 T->S
|
||||
double RstY = antp.Py - gp.Ty;
|
||||
double RstZ = antp.Pz - gp.Tz;
|
||||
double RstR = sqrt(RstX * RstX + RstY * RstY + RstZ * RstZ); // 矢量距离
|
||||
|
||||
|
||||
|
||||
if (RstR<NearR || RstR>FarR) {
|
||||
d_temp_R[idx] = 0;
|
||||
d_temp_amps[idx] = 0;
|
||||
return;
|
||||
}
|
||||
else {
|
||||
double slopeX = goallist[posId].TsX;
|
||||
double slopeY = goallist[posId].TsY;
|
||||
double slopeZ = goallist[posId].TsZ;
|
||||
|
||||
RstX = RstX / RstR;
|
||||
RstY = RstY / RstR;
|
||||
RstZ = RstZ / RstR;
|
||||
|
||||
double slopeX = gp.TsX;
|
||||
double slopeY = gp.TsY;
|
||||
double slopeZ = gp.TsZ;
|
||||
|
||||
double slopR = sqrtf(slopeX * slopeX + slopeY * slopeY + slopeZ * slopeZ); //
|
||||
if (abs(slopR - 0) > 1e-3) {
|
||||
double dotAB = RstX * slopeX + RstY * slopeY + RstZ * slopeZ;
|
||||
double localangle = acos(dotAB / (RstR * slopR));
|
||||
|
||||
float localangle = acosf((RstX * slopeX + RstY * slopeY + RstZ * slopeZ) / ( slopR));
|
||||
|
||||
if (localangle < 0 || localangle >= LAMP_CUDA_PI / 2 || isnan(localangle)) {
|
||||
d_temp_R[idx] = 0;
|
||||
|
@ -512,8 +535,27 @@ __global__ void Kernel_Computer_R_amp_NoAntPattern(
|
|||
}
|
||||
else {}
|
||||
|
||||
double ampGain = 1;
|
||||
ampGain = ampGain / (powf(4 * LAMP_CUDA_PI, 2) * powf(RstR, 4)); // 反射强度
|
||||
|
||||
// 计算斜距衰减
|
||||
|
||||
float antDirectR = sqrtf(antp.antDirectX * antp.antDirectX
|
||||
+ antp.antDirectY * antp.antDirectY
|
||||
+ antp.antDirectZ * antp.antDirectZ);
|
||||
|
||||
float diectAngle = -1*(RstX*antp.antDirectX+
|
||||
RstY*antp.antDirectY+
|
||||
RstZ*antp.antDirectZ) / (antDirectR );
|
||||
|
||||
diectAngle = acosf(diectAngle);// 弧度制
|
||||
diectAngle = diectAngle * GainWeight;
|
||||
|
||||
float ampGain = 1;
|
||||
ampGain=2 * maxGain * (1 - (powf(diectAngle,2) / 6)
|
||||
+ (powf(diectAngle, 4) / 120)
|
||||
- (powf(diectAngle, 6) / 5040)); //dB
|
||||
ampGain = powf(10.0, ampGain / 10.0);
|
||||
|
||||
ampGain = ampGain / (PI4POW2 * powf(RstR, 4)); // 反射强度
|
||||
double sigma = GPU_getSigma0dB(sigma0Params, localangle);
|
||||
sigma = powf(10.0, sigma / 10.0);
|
||||
|
||||
|
@ -522,10 +564,9 @@ __global__ void Kernel_Computer_R_amp_NoAntPattern(
|
|||
|
||||
bool isNan = !(isnan(temp_amp) || isnan(temp_R) || isinf(temp_amp) || isinf(temp_R));
|
||||
|
||||
|
||||
d_temp_amps[idx] = temp_amp * isNan;
|
||||
d_temp_R[idx] = temp_R * isNan;
|
||||
//printf("out R amp : %f %e %d %e\n", d_temp_R[idx], d_temp_amps[idx], isNan, sigma);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -533,8 +574,6 @@ __global__ void Kernel_Computer_R_amp_NoAntPattern(
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
__global__ void CUDA_Kernel_Computer_echo_NoAntPattern(
|
||||
double* d_temp_R, double* d_temp_amps, long posNum,
|
||||
double f0, double dfreq,
|
||||
|
@ -570,33 +609,32 @@ __global__ void CUDA_Kernel_Computer_echo_NoAntPattern(
|
|||
|
||||
__syncthreads(); // 确定所有待处理数据都已经进入程序中
|
||||
|
||||
|
||||
|
||||
if (fId < maxfreqnum && prfId < temp_PRF_Count) {
|
||||
|
||||
long echo_ID = prfId * maxfreqnum + fId; // 计算对应的回波位置
|
||||
float factorjTemp = RFPCPIDIVLIGHT * (f0 + fId * dfreq);
|
||||
cuComplex echo = make_cuComplex(0, 0);
|
||||
|
||||
float temp_phi = 0;
|
||||
float temp_amp = 0;
|
||||
|
||||
for (long dataid = 0; dataid < SHAREMEMORY_FLOAT_HALF; dataid++) {
|
||||
|
||||
temp_phi = s_R[dataid] * factorjTemp;
|
||||
temp_amp = 1; s_amp[dataid];
|
||||
temp_amp = s_amp[dataid];
|
||||
echo.x += (temp_amp * cosf(temp_phi));
|
||||
echo.y += (temp_amp * sinf(temp_phi));
|
||||
//if (dataid > 5000) {
|
||||
// printf("echo_ID=%d; dataid=%d;ehodata=(%f,%f);R=%f;amp=%f;\n", echo_ID, dataid, temp_real, temp_imag, s_R[0], s_amp[0]);
|
||||
//}
|
||||
if (isnan(temp_phi) || isnan(temp_amp) || isnan(echo.x) || isnan(echo.y)
|
||||
|| isinf(temp_phi) || isinf(temp_amp) || isinf(echo.x) || isinf(echo.y)
|
||||
) {
|
||||
printf("[amp,phi,real,imag]=[%f,%f,%f,%f];\n", temp_amp, temp_phi, echo.x, echo.y);
|
||||
}
|
||||
//if (isnan(temp_phi) || isnan(temp_amp) || isnan(echo.x) || isnan(echo.y)
|
||||
// || isinf(temp_phi) || isinf(temp_amp) || isinf(echo.x) || isinf(echo.y)
|
||||
// ) {
|
||||
// printf("[amp,phi,real,imag]=[%f,%f,%f,%f];\n", temp_amp, temp_phi, echo.x, echo.y);
|
||||
//}
|
||||
|
||||
}
|
||||
|
||||
|
||||
echodata[echo_ID] = cuCaddf(echodata[echo_ID], echo);
|
||||
|
||||
}
|
||||
|
@ -605,98 +643,73 @@ __global__ void CUDA_Kernel_Computer_echo_NoAntPattern(
|
|||
|
||||
|
||||
|
||||
__global__ void CUDA_Kernel_Computer_echo_NoAntPattern_Optimized(
|
||||
double* d_temp_R, double* d_temp_amps, long posNum,
|
||||
double f0, double dfreq,
|
||||
long FreqPoints, // 当前频率的分块
|
||||
long maxfreqnum, // 最大脉冲值
|
||||
cuComplex* echodata,
|
||||
long temp_PRF_Count
|
||||
) {
|
||||
// 使用动态共享内存,根据线程块大小调整
|
||||
extern __shared__ float s_data[];
|
||||
float* s_R = s_data;
|
||||
float* s_amp = s_data + blockDim.x;
|
||||
|
||||
const int tid = threadIdx.x;
|
||||
const int prfId = blockIdx.x;
|
||||
const int fId = tid; // 每个线程处理一个频率点
|
||||
|
||||
float factorjTemp = RFPCPIDIVLIGHT * (f0 + fId * dfreq);
|
||||
cuComplex echo = make_cuComplex(0.0f, 0.0f);
|
||||
|
||||
// 分块加载数据并计算
|
||||
for (int block_offset = 0; block_offset < posNum; block_offset += blockDim.x) {
|
||||
int psid = block_offset + tid;
|
||||
int pixelId = prfId * posNum + psid;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
__global__ void CUDA_Kernel_RFPC(
|
||||
SateState* antlist,
|
||||
long PRFCount, long Freqcount, // 整体的脉冲数,
|
||||
GoalState* goallist,
|
||||
long demLen,
|
||||
double StartFreqGHz, double FreqStep,
|
||||
double refPhaseRange,
|
||||
double NearR, double FarR,
|
||||
CUDASigmaParam clsSigma0,
|
||||
cuComplex* echodata
|
||||
)
|
||||
{
|
||||
__shared__ GoalState Ts[SHAREMEMORY_DEM_STEP];
|
||||
|
||||
size_t threadid = threadIdx.x;
|
||||
|
||||
size_t idx = blockIdx.x * blockDim.x + threadIdx.x; // 获取当前的线程编码
|
||||
size_t prfid = floorf(idx / Freqcount);
|
||||
size_t freqid = idx % Freqcount;
|
||||
// printf("%d,%d ",prfid,freqid);
|
||||
if (prfid < PRFCount && freqid < Freqcount)
|
||||
{
|
||||
SateState antPos = antlist[prfid];
|
||||
double factorjTemp = RFPCPIDIVLIGHT * (StartFreqGHz + freqid * FreqStep);
|
||||
|
||||
double Tx = 0;
|
||||
double Ty = 0;
|
||||
double Tz = 0;
|
||||
|
||||
double R = 0;
|
||||
double incAngle = 0;
|
||||
|
||||
double echo_real = 0;
|
||||
double echo_imag = 0;
|
||||
|
||||
cuComplex echo = make_cuComplex(0, 0);
|
||||
|
||||
|
||||
|
||||
for (long tid = 0; tid < demLen; tid++) {
|
||||
GoalState p = goallist[tid];
|
||||
Tx = p.Tx;
|
||||
Ty = p.Ty;
|
||||
Tz = p.Tz;
|
||||
|
||||
Tx = antPos.Px - Tx; // T->P
|
||||
Ty = antPos.Py - Ty;
|
||||
Tz = antPos.Pz - Tz;
|
||||
|
||||
R = sqrt(Tx * Tx + Ty * Ty + Tz * Tz);
|
||||
bool isNearFar = (R < NearR || R > FarR) && ((abs(p.TsX) > 1000) || (abs(p.TsY) > 1000) || (abs(p.TsZ) > 1000));
|
||||
|
||||
|
||||
incAngle = sqrt(p.TsX * p.TsX + p.TsY * p.TsY + p.TsZ * p.TsZ);
|
||||
incAngle = acos((Tx * p.TsX + Ty * p.TsY + Tz * p.TsZ) / (R * incAngle));
|
||||
incAngle = GPU_getSigma0dB_params(clsSigma0.p1, clsSigma0.p2, clsSigma0.p3, clsSigma0.p4, clsSigma0.p5, clsSigma0.p6, incAngle); // sigma
|
||||
incAngle = pow(10.0, incAngle / 10.0); // amp
|
||||
incAngle = incAngle / (powf(4 * LAMP_CUDA_PI, 2) * powf(R, 4)); //
|
||||
|
||||
R = (R - refPhaseRange);
|
||||
R = factorjTemp * R;
|
||||
|
||||
echo_real = incAngle * cos(R) * isNearFar;
|
||||
echo_imag = incAngle * sin(R) * isNearFar;
|
||||
echo.x = echo.x + echo_real;
|
||||
echo.y = echo.y + echo_imag;
|
||||
|
||||
if (idx == 0 && tid % (10 * SHAREMEMORY_DEM_STEP) == 0) {
|
||||
printf("Idx:%d , TsID: %d, TSCOUNT: %d \n", idx, tid, demLen);
|
||||
}
|
||||
// 加载当前块到共享内存
|
||||
if (psid < posNum) {
|
||||
s_R[tid] = static_cast<float>(d_temp_R[pixelId]);
|
||||
s_amp[tid] = static_cast<float>(d_temp_amps[pixelId]);
|
||||
}
|
||||
else {
|
||||
s_R[tid] = 0.0f;
|
||||
s_amp[tid] = 0.0f;
|
||||
}
|
||||
__syncthreads();
|
||||
|
||||
echodata[idx] = cuCaddf(echodata[idx], echo);
|
||||
// 计算当前块的贡献
|
||||
for (int dataid = 0; dataid < blockDim.x; ++dataid) {
|
||||
float temp_phi = s_R[dataid] * factorjTemp;
|
||||
float temp_amp = s_amp[dataid];
|
||||
float sin_phi, cos_phi;
|
||||
sincosf(temp_phi, &sin_phi, &cos_phi);
|
||||
echo.x += temp_amp * cos_phi;
|
||||
echo.y += temp_amp * sin_phi;
|
||||
}
|
||||
__syncthreads();
|
||||
}
|
||||
|
||||
// 只处理有效的频率点和PRF
|
||||
if (prfId < temp_PRF_Count && fId < FreqPoints && fId < maxfreqnum) {
|
||||
const int echo_ID = prfId * maxfreqnum + fId;
|
||||
atomicAdd(&echodata[echo_ID].x, echo.x);
|
||||
atomicAdd(&echodata[echo_ID].y, echo.y);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/** 分块处理 ****************************************************************************************************************/
|
||||
extern "C" void ProcessRFPCTask(RFPCTask& task, long devid)
|
||||
{
|
||||
size_t pixelcount = task.prfNum * task.freqNum;
|
||||
size_t grid_size = (pixelcount + BLOCK_SIZE - 1) / BLOCK_SIZE;
|
||||
printf("computer pixelcount goalnum gridsize blocksize %zu,%zu ,%zu,%d\n", pixelcount, task.targetnum, grid_size, BLOCK_SIZE);
|
||||
|
||||
printf("computer pixelcount goalnum gridsize blocksize prfnum %zu,%zu ,%zu,%d ,%d \n", pixelcount, task.targetnum, grid_size, BLOCK_SIZE,task.prfNum);
|
||||
printf("Dev:%d ,freqnum:%d , prfnum:%d ,Rref: %e ,Rnear : %e ,Rfar: %e , StartFreq: %e ,DeletFreq: %e \n",
|
||||
devid, task.freqNum, task.prfNum, task.Rref, task.Rnear, task.Rfar, task.startFreq, task.stepFreq);
|
||||
double* d_R = (double*)mallocCUDADevice(task.prfNum * SHAREMEMORY_FLOAT_HALF * sizeof(double), devid);
|
||||
double* d_amps = (double*)mallocCUDADevice(task.prfNum * SHAREMEMORY_FLOAT_HALF * sizeof(double), devid);
|
||||
|
||||
|
@ -706,12 +719,13 @@ extern "C" void ProcessRFPCTask(RFPCTask& task, long devid)
|
|||
long freqpoints = BLOCK_FREQNUM;
|
||||
|
||||
printf("freqpoints:%d\n", freqpoints);
|
||||
long prfcount = task.prfNum;
|
||||
long process = 0;
|
||||
for (long sTi = 0; sTi < task.targetnum; sTi = sTi + SHAREMEMORY_FLOAT_HALF) {
|
||||
cudaBlocknum = (task.prfNum * SHAREMEMORY_FLOAT_HALF + BLOCK_SIZE - 1) / BLOCK_SIZE;
|
||||
Kernel_Computer_R_amp_NoAntPattern << <cudaBlocknum, BLOCK_SIZE >> >(
|
||||
task.antlist,
|
||||
task.prfNum,
|
||||
prfcount,
|
||||
task.goallist,
|
||||
task.targetnum,
|
||||
sTi, task.targetnum,
|
||||
|
@ -719,28 +733,40 @@ extern "C" void ProcessRFPCTask(RFPCTask& task, long devid)
|
|||
task.Pt,
|
||||
task.Rref,
|
||||
task.Rnear, task.Rfar,
|
||||
task.maxGain,task.GainWeight,
|
||||
d_R, d_amps// 计算输出
|
||||
);
|
||||
PrintLasterError("CUDA_Kernel_Computer_R_amp");
|
||||
cudaDeviceSynchronize();
|
||||
|
||||
cudaBlocknum = (task.prfNum * BLOCK_FREQNUM + BLOCK_SIZE - 1) / BLOCK_SIZE;
|
||||
CUDA_Kernel_Computer_echo_NoAntPattern << <cudaBlocknum, BLOCK_SIZE >> > (
|
||||
d_R, d_amps, SHAREMEMORY_FLOAT_HALF,
|
||||
task.startFreq, task.stepFreq,
|
||||
freqpoints, task.freqNum,
|
||||
task.d_echoData,
|
||||
task.prfNum
|
||||
);
|
||||
PrintLasterError("CUDA_Kernel_Computer_echo");
|
||||
|
||||
dim3 blocks(task.prfNum);
|
||||
dim3 threads(BLOCK_SIZE);
|
||||
|
||||
size_t shared_mem_size = 2 * BLOCK_SIZE * sizeof(float);
|
||||
|
||||
CUDA_Kernel_Computer_echo_NoAntPattern_Optimized << <blocks, threads, shared_mem_size >> > (
|
||||
d_R, d_amps, SHAREMEMORY_FLOAT_HALF,
|
||||
task.startFreq/1e9, task.stepFreq / 1e9,
|
||||
freqpoints, task.freqNum,
|
||||
task.d_echoData,
|
||||
task.prfNum
|
||||
);
|
||||
|
||||
//cudaBlocknum = (task.prfNum * BLOCK_FREQNUM + BLOCK_SIZE - 1) / BLOCK_SIZE;
|
||||
//CUDA_Kernel_Computer_echo_NoAntPattern << <cudaBlocknum, BLOCK_SIZE >> > (
|
||||
// d_R, d_amps, SHAREMEMORY_FLOAT_HALF,
|
||||
// task.startFreq/1e9, task.stepFreq / 1e9,
|
||||
// freqpoints, task.freqNum,
|
||||
// task.d_echoData,
|
||||
// task.prfNum
|
||||
// );
|
||||
//PrintLasterError("CUDA_Kernel_Computer_echo");
|
||||
cudaDeviceSynchronize();
|
||||
if ((sTi * 100.0 / task.targetnum) - process >= 1) {
|
||||
process = sTi * 100.0 / task.targetnum;
|
||||
PRINT("TargetID [%f]: %d / %d finished %d\n", sTi * 100.0 / task.targetnum, sTi, task.targetnum,devid);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -750,7 +776,7 @@ extern "C" void ProcessRFPCTask(RFPCTask& task, long devid)
|
|||
FreeCUDADevice(d_amps);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -17,6 +17,10 @@
|
|||
|
||||
extern "C" struct SateState {
|
||||
double Px, Py, Pz, Vx, Vy, Vz;
|
||||
//double antXaxisX, antXaxisY, antXaxisZ;
|
||||
//double antYaxisX, antYaxisY, antYaxisZ;
|
||||
//double antZaxisX, antZaxisY, antZaxisZ;
|
||||
double antDirectX, antDirectY, antDirectZ;
|
||||
};
|
||||
|
||||
|
||||
|
@ -29,12 +33,12 @@ extern "C" struct GoalState {
|
|||
|
||||
|
||||
extern "C" struct CUDASigmaParam {
|
||||
double p1;
|
||||
double p2;
|
||||
double p3;
|
||||
double p4;
|
||||
double p5;
|
||||
double p6;
|
||||
float p1;
|
||||
float p2;
|
||||
float p3;
|
||||
float p4;
|
||||
float p5;
|
||||
float p6;
|
||||
};
|
||||
|
||||
extern "C" struct SloperDs
|
||||
|
@ -86,7 +90,8 @@ extern "C" struct RFPCTask
|
|||
GoalState* goallist = nullptr;
|
||||
cuComplex* d_echoData = nullptr; // »Ø²¨
|
||||
CUDASigmaParam sigma0_cls;
|
||||
|
||||
double maxGain=48;
|
||||
double GainWeight=20; // 2¶È·¶Î§
|
||||
|
||||
size_t targetnum;
|
||||
|
||||
|
@ -98,6 +103,8 @@ extern __device__ double GPU_getSigma0dB_params(
|
|||
double theta);
|
||||
|
||||
extern __device__ double GPU_getSigma0dB(CUDASigmaParam param, double theta);
|
||||
extern __device__ float GPU_getSigma0dB(CUDASigmaParam param, float theta);
|
||||
|
||||
|
||||
extern __device__ CUDAVectorEllipsoidal GPU_SatelliteAntDirectNormal(
|
||||
double RstX, double RstY, double RstZ,
|
||||
|
|
|
@ -82,7 +82,7 @@ void QImageSARRFPC::onpushButtonEchoClieck()
|
|||
void QImageSARRFPC::onpushButtongpxmlClieck()
|
||||
{
|
||||
// 调用文件选择对话框并选择一个 .tif 文件
|
||||
QString fileName = QFileDialog::getSaveFileName(this,
|
||||
QString fileName = QFileDialog::getOpenFileName(this,
|
||||
u8"GPS xml", // 对话框标题
|
||||
"", // 初始目录,可以设置为路径
|
||||
u8"xml Files (*.xml);;All Files (*)"); // 文件类型过滤器
|
||||
|
@ -98,7 +98,7 @@ void QImageSARRFPC::onpushButtongpxmlClieck()
|
|||
void QImageSARRFPC::onpushButtonTaskxmlClieck()
|
||||
{
|
||||
// 调用文件选择对话框并选择一个 .tif 文件
|
||||
QString fileName = QFileDialog::getSaveFileName(this,
|
||||
QString fileName = QFileDialog::getOpenFileName(this,
|
||||
u8"任务xml", // 对话框标题
|
||||
"", // 初始目录,可以设置为路径
|
||||
u8"xml Files (*.xml);;All Files (*)"); // 文件类型过滤器
|
||||
|
@ -117,7 +117,7 @@ void QImageSARRFPC::onpushButtondemClieck()
|
|||
QString fileName = QFileDialog::getOpenFileName(this,
|
||||
u8"dem文件", // 对话框标题
|
||||
"", // 初始目录,可以设置为路径
|
||||
u8"tif Files (*.tif);;data Files (*.data);;bin Files (*.bin);;All Files (*)"); // 文件类型过滤器
|
||||
u8"All Files (*);;tif Files (*.tif);;data Files (*.dat);;bin Files (*.bin)"); // 文件类型过滤器
|
||||
|
||||
if (!fileName.isEmpty()) {
|
||||
this->ui->demTiffPathEdit->setText(fileName);
|
||||
|
@ -133,7 +133,7 @@ void QImageSARRFPC::onpushButtonSloperClieck()
|
|||
QString fileName = QFileDialog::getOpenFileName(this,
|
||||
u8"sloper文件", // 对话框标题
|
||||
"", // 初始目录,可以设置为路径
|
||||
u8"tif Files (*.tif);;data Files (*.data);;bin Files (*.bin);;All Files (*)"); // 文件类型过滤器
|
||||
u8"All Files (*);;tif Files (*.tif);;data Files (*.dat);;bin Files (*.bin)"); // 文件类型过滤器
|
||||
|
||||
if (!fileName.isEmpty()) {
|
||||
this->ui->sloperPathEdit->setText(fileName);
|
||||
|
@ -149,7 +149,7 @@ void QImageSARRFPC::onpushButtonlandcoverClieck()
|
|||
QString fileName = QFileDialog::getOpenFileName(this,
|
||||
u8"地表覆盖数据", // 对话框标题
|
||||
"", // 初始目录,可以设置为路径
|
||||
u8"tif Files (*.tif);;data Files (*.data);;bin Files (*.bin);;All Files (*)"); // 文件类型过滤器
|
||||
u8"All Files (*);;tif Files (*.tif);;data Files (*.dat);;bin Files (*.bin)"); // 文件类型过滤器
|
||||
|
||||
if (!fileName.isEmpty()) {
|
||||
this->ui->landCoverPathEdit->setText(fileName);
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>LT1B_Simulation</string>
|
||||
<string>LT1B_DQ_165665_Simulation</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -51,7 +51,7 @@
|
|||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>D:/FZSimulation/LT1AB_FZ/Input01/tempEcho</string>
|
||||
<string>D:/FZSimulation/LTDQ/Input/xml/xml/165665/echodata</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -90,7 +90,7 @@
|
|||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>D:/FZSimulation/LT1AB_FZ/Input01/LT1B_Simulation_Setting.xml</string>
|
||||
<string>D:/FZSimulation/LTDQ/Input/xml/xml/165665/LT1_Simulation_Setting.xml</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -103,7 +103,7 @@
|
|||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>D:/FZSimulation/LT1AB_FZ/Input01/landacover_Resample.dat</string>
|
||||
<string>D:/FZSimulation/LTDQ/Input/LandCover.dat</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -142,7 +142,7 @@
|
|||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>D:/FZSimulation/LT1AB_FZ/Input01/LT1B_GPSPoints.xml</string>
|
||||
<string>D:/FZSimulation/LTDQ/Input/xml/xml/165665/LT1_Simulation_GPSNode.xml</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -233,7 +233,7 @@
|
|||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>D:/FZSimulation/LT1AB_FZ/Input01/ASTGTM2_N28E087_dem_XYZ.dat</string>
|
||||
<string>D:/FZSimulation/LTDQ/Input/DEM_XYZ.dat</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -350,7 +350,7 @@
|
|||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>D:/FZSimulation/LT1AB_FZ/Input01/ASTGTM2_N28E087_dem_Sloper.dat</string>
|
||||
<string>D:/FZSimulation/LTDQ/Input/DEM_Sloper.dat</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
@ -929,8 +929,8 @@ ErrorCode RFPCProcessCls::RFPCMainProcess_GPU() {
|
|||
|
||||
ErrorCode RFPCProcessCls::RFPCMainProcess_MultiGPU_NoAntPattern()
|
||||
{
|
||||
int num_devices=1;
|
||||
//cudaGetDeviceCount(&num_devices);
|
||||
int num_devices=0;
|
||||
cudaGetDeviceCount(&num_devices);
|
||||
PRINT("GPU Count : %d \n", num_devices);
|
||||
|
||||
long prfcount = this->EchoSimulationData->getPluseCount();
|
||||
|
@ -971,13 +971,21 @@ ErrorCode RFPCProcessCls::RFPCMainProcess_GPU_NoAntPattern(size_t startprfid, si
|
|||
for (const auto& pair : clssigmaParamsDict) {
|
||||
clsCUDASigmaParamsDict.insert(std::pair<long, CUDASigmaParam>(pair.first,
|
||||
CUDASigmaParam{
|
||||
pair.second.p1,
|
||||
pair.second.p2,
|
||||
pair.second.p3,
|
||||
pair.second.p4,
|
||||
pair.second.p5,
|
||||
pair.second.p6
|
||||
float(pair.second.p1),
|
||||
float(pair.second.p2),
|
||||
float(pair.second.p3),
|
||||
float(pair.second.p4),
|
||||
float(pair.second.p5),
|
||||
float(pair.second.p6)
|
||||
}));
|
||||
printf("clsid:%d, params: %e,%e,%e,%e,%e,%e \n", pair.first,
|
||||
float(pair.second.p1),
|
||||
float(pair.second.p2),
|
||||
float(pair.second.p3),
|
||||
float(pair.second.p4),
|
||||
float(pair.second.p5),
|
||||
float(pair.second.p6)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1089,10 +1097,15 @@ ErrorCode RFPCProcessCls::RFPCMainProcess_GPU_NoAntPattern(size_t startprfid, si
|
|||
h_antlist.get()[i].Vx = antplise.get()[i + startprfid].Vx;
|
||||
h_antlist.get()[i].Vy = antplise.get()[i + startprfid].Vy;
|
||||
h_antlist.get()[i].Vz = antplise.get()[i + startprfid].Vz;
|
||||
h_antlist.get()[i].antDirectX = antplise.get()[i + startprfid].AntDirectX;
|
||||
h_antlist.get()[i].antDirectY = antplise.get()[i + startprfid].AntDirectY;
|
||||
h_antlist.get()[i].antDirectZ = antplise.get()[i + startprfid].AntDirectZ;
|
||||
|
||||
|
||||
}
|
||||
|
||||
task.antlist = (SateState*)mallocCUDADevice(prfcount * sizeof(SateState), devId);
|
||||
HostToDevice(h_antlist.get(), task.antlist, sizeof(double) * prfcount);
|
||||
HostToDevice(h_antlist.get(), task.antlist, sizeof(SateState) * prfcount);
|
||||
|
||||
}
|
||||
|
||||
|
@ -1147,7 +1160,7 @@ ErrorCode RFPCProcessCls::SaveBlockSimulationEchoArr(cuComplex* d_echoData,size_
|
|||
|
||||
qDebug() << "write echo :\t " << "prfcount:\t" << prfcount << " freqnum:\t" << freqNum;
|
||||
|
||||
testOutComplexDoubleArr(QString("testoutEcho.dat"),fileEchoArr.get(), prfcount_read, freqNum);
|
||||
//testOutComplexDoubleArr(QString("testoutEcho.dat"),fileEchoArr.get(), prfcount_read, freqNum);
|
||||
this->EchoSimulationData->saveEchoArr(fileEchoArr, startprfid, prfcount_read);
|
||||
|
||||
|
||||
|
|
|
@ -78,18 +78,23 @@ SigmaDatabase::SigmaDatabase()
|
|||
//this->VH_sigmaParam.insert(std::pair<long, SigmaParam>(90, SigmaParam{ -26.8776515733889, 10.4251866500052, 8.43273666535992, 4.33165922141213, 8.68204389555939, - 2.51718779582920 }));
|
||||
//this->VV_sigmaParam.insert(std::pair<long, SigmaParam>(90, SigmaParam{ -20.1761798059391, 13.2752519275021, 2.74667225608397, 3.63052241744923, 8.99932188120922, 34.8246533269446 }));
|
||||
|
||||
this->HH_sigmaParam.insert(std::pair<long, SigmaParam>(10, SigmaParam{ 28.15,-39.73,0.0986,2.863,4.356,-6.279 }));
|
||||
this->HH_sigmaParam.insert(std::pair<long, SigmaParam>(20, SigmaParam{ 36.13,-48.2,0.1299,-1.838,5.404,-4.015 }));
|
||||
this->HH_sigmaParam.insert(std::pair<long, SigmaParam>(30, SigmaParam{ 183.5,-194.6,0.0167,2.952,-4.1,6.026 }));
|
||||
this->HH_sigmaParam.insert(std::pair<long, SigmaParam>(40, SigmaParam{ 50.97,-62.9,0.0968,1.604,4.637,6.108 }));
|
||||
this->HH_sigmaParam.insert(std::pair<long, SigmaParam>(50, SigmaParam{ -10.31,15.96,37.73,-4.584,4.997,-3.569 }));
|
||||
this->HH_sigmaParam.insert(std::pair<long, SigmaParam>(60, SigmaParam{ -12.45,0.1561,-3.187,-2.482,8.244,0.3632 }));
|
||||
this->HH_sigmaParam.insert(std::pair<long, SigmaParam>(80, SigmaParam{ -19.23,0.3623,-2.209,9.649,0.1292,-0.264 }));
|
||||
this->HH_sigmaParam.insert(std::pair<long, SigmaParam>(100, SigmaParam{ 56.61,-62.29,0.01388,2.767,-3.943,5.995 }));
|
||||
|
||||
|
||||
|
||||
//this->HH_sigmaParam.insert(std::pair<long, SigmaParam>(10, SigmaParam{ 28.15,-39.73,0.0986,2.863,4.356,-6.279 }));
|
||||
//this->HH_sigmaParam.insert(std::pair<long, SigmaParam>(20, SigmaParam{ 36.13,-48.2,0.1299,-1.838,5.404,-4.015 }));
|
||||
//this->HH_sigmaParam.insert(std::pair<long, SigmaParam>(30, SigmaParam{ 183.5,-194.6,0.0167,2.952,-4.1,6.026 }));
|
||||
//this->HH_sigmaParam.insert(std::pair<long, SigmaParam>(40, SigmaParam{ 50.97,-62.9,0.0968,1.604,4.637,6.108 }));
|
||||
//this->HH_sigmaParam.insert(std::pair<long, SigmaParam>(50, SigmaParam{ -10.31,15.96,37.73,-4.584,4.997,-3.569 }));
|
||||
//this->HH_sigmaParam.insert(std::pair<long, SigmaParam>(60, SigmaParam{ -12.45,0.1561,-3.187,-2.482,8.244,0.3632 }));
|
||||
//this->HH_sigmaParam.insert(std::pair<long, SigmaParam>(80, SigmaParam{ -19.23,0.3623,-2.209,9.649,0.1292,-0.264 }));
|
||||
//this->HH_sigmaParam.insert(std::pair<long, SigmaParam>(100, SigmaParam{ 56.61,-62.29,0.01388,2.767,-3.943,5.995 }));
|
||||
|
||||
this->HH_sigmaParam.insert(std::pair<long, SigmaParam>(10, SigmaParam{ -3.296,-0.1284,2.792,-5.418,1.417,-0.7571 })); // DQ
|
||||
this->HH_sigmaParam.insert(std::pair<long, SigmaParam>(20, SigmaParam{ -9.976,-0.00288,4.404,1.875,1.045,6.801 }));
|
||||
this->HH_sigmaParam.insert(std::pair<long, SigmaParam>(30, SigmaParam{ 3.172,-3.725,1.066,-6.938,-1.397,0.1646 }));
|
||||
this->HH_sigmaParam.insert(std::pair<long, SigmaParam>(40, SigmaParam{ 86.51,-93.16,0.0408,-0.4571,5.286,-0.07259 }));
|
||||
this->HH_sigmaParam.insert(std::pair<long, SigmaParam>(50, SigmaParam{ 9.03,-18.38,0.1604,-2.208,-6.042,3.596 }));
|
||||
this->HH_sigmaParam.insert(std::pair<long, SigmaParam>(60, SigmaParam{ 13.71,-24.14,0.1177,-2.107,6.382,-4.156 }));
|
||||
this->HH_sigmaParam.insert(std::pair<long, SigmaParam>(80, SigmaParam{ 136.6,-0.009549,3.246,143.9,0.0496,2.978 }));
|
||||
this->HH_sigmaParam.insert(std::pair<long, SigmaParam>(90, SigmaParam{ -8.716,-3.019,-0.9396,-0.977,-6.411,2.33 }));
|
||||
}
|
||||
|
||||
SigmaDatabase::~SigmaDatabase()
|
||||
|
|
|
@ -124,8 +124,8 @@
|
|||
<OpenMPSupport>true</OpenMPSupport>
|
||||
<LanguageStandard>stdcpp14</LanguageStandard>
|
||||
<LanguageStandard_C>stdc11</LanguageStandard_C>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<EnableFiberSafeOptimizations>false</EnableFiberSafeOptimizations>
|
||||
</ClCompile>
|
||||
<CudaCompile>
|
||||
<GenerateRelocatableDeviceCode>true</GenerateRelocatableDeviceCode>
|
||||
|
|
Loading…
Reference in New Issue