插值方法前增加类型判断,并且修改编译修改级别

pull/13/head
chenzenghui 2025-03-14 14:49:13 +08:00
parent 0dbe3a0d20
commit 5254154c5c
15 changed files with 911 additions and 405 deletions

View File

@ -530,7 +530,7 @@ Eigen::MatrixXd gdalImage::getData(int start_row, int start_col, int rows_count,
rows_count, gdal_datatype, 0, 0);
for(int i = 0; i < rows_count; i++) {
for(int j = 0; j < cols_count; j++) {
datamatrix(i, j) = temp[i * cols_count + j];
datamatrix(i, j) = long(temp[i * cols_count + j])*1.0;
}
}
delete[] temp;
@ -540,7 +540,7 @@ Eigen::MatrixXd gdalImage::getData(int start_row, int start_col, int rows_count,
rows_count, gdal_datatype, 0, 0);
for(int i = 0; i < rows_count; i++) {
for(int j = 0; j < cols_count; j++) {
datamatrix(i, j) = temp[i * cols_count + j];
datamatrix(i, j) = long(temp[i * cols_count + j]) * 1.0;
}
}
delete[] temp;
@ -550,7 +550,7 @@ Eigen::MatrixXd gdalImage::getData(int start_row, int start_col, int rows_count,
rows_count, gdal_datatype, 0, 0);
for(int i = 0; i < rows_count; i++) {
for(int j = 0; j < cols_count; j++) {
datamatrix(i, j) = temp[i * cols_count + j];
datamatrix(i, j) = long(temp[i * cols_count + j]) * 1.0;
}
}
delete[] temp;
@ -570,7 +570,7 @@ Eigen::MatrixXd gdalImage::getData(int start_row, int start_col, int rows_count,
rows_count, gdal_datatype, 0, 0);
for(int i = 0; i < rows_count; i++) {
for(int j = 0; j < cols_count; j++) {
datamatrix(i, j) = temp[i * cols_count + j];
datamatrix(i, j) = long(temp[i * cols_count + j]) * 1.0;
}
}
delete[] temp;
@ -3843,13 +3843,22 @@ void ConvertCoordinateSystem(QString inRasterPath, QString outRasterPath, long o
// qDebug() << "无效的EPSG代码" << outepsgcode;
return;
}
GDALDataType datetype = srcDataset->GetRasterBand(1)->GetRasterDataType();
// 获取目标坐标系的WKT表示
char* targetSRSWkt = nullptr;
targetSRS.exportToWkt(&targetSRSWkt);
bool flag = (datetype == GDT_Byte || datetype == GDT_Int8 || datetype == GDT_Int16 ||datetype == GDT_UInt16 || datetype == GDT_Int32 || datetype == GDT_UInt32 || datetype == GDT_Int64 || datetype == GDT_UInt64);
// 创建重投影后的虚拟数据集Warped VRT
GDALDataset* warpedVRT = (GDALDataset*)GDALAutoCreateWarpedVRT(
GDALDataset* warpedVRT = flag? (GDALDataset*)GDALAutoCreateWarpedVRT(
srcDataset,
nullptr, // 输入坐标系(默认使用源数据)
targetSRSWkt, // 目标坐标系
GRA_NearestNeighbour, // 重采样方法:双线性插值
0.0, // 最大误差0表示自动计算
nullptr // 其他选项
) :(GDALDataset*)GDALAutoCreateWarpedVRT(
srcDataset,
nullptr, // 输入坐标系(默认使用源数据)
targetSRSWkt, // 目标坐标系

View File

@ -119,7 +119,7 @@ QDEMResampleDialogToolButton::QDEMResampleDialogToolButton(QWidget* parent)
{
this->toolPath = QVector<QString>(0);
this->toolPath.push_back(u8"基础处理");
this->toolname = QString(u8"DEMÖØ²ÉÑù");
this->toolname = QString(u8"Õ¤¸ñÖØ²ÉÑù");
}
QDEMResampleDialogToolButton::~QDEMResampleDialogToolButton()

View File

@ -110,7 +110,7 @@ void DEMLLA2XYZTool::onaccept()
Vector3D Zaxis = { 0,0,1 };
double rowidx = 0, colidx = 0;
#pragma omp parallel for
//#pragma omp parallel for
for (long i = 1; i < dem_rows - 1; i++) {
for (long j = 1; j < dem_cols - 1; j++) {
rowidx = i + startlineid;
@ -127,7 +127,7 @@ void DEMLLA2XYZTool::onaccept()
Zaxis.x = pp.lon;
Zaxis.y = pp.lat;
Zaxis.z = pp.ati;
sloperAngle = getCosAngle(slopeVector, Zaxis); // 華醱亠砃褒
sloperAngle = getCosAngle(slopeVector, Zaxis)*r2d; // 華醱亠砃褒
demsloper_x(i, j) = slopeVector.x;
demsloper_y(i, j) = slopeVector.y;

View File

@ -94,12 +94,32 @@ void QResampleRefrenceRaster::ondialogBtnaccepted()
gt.get()[4] = refimage.gt(1, 1);
gt.get()[5] = refimage.gt(1, 2);
gdalImage inRaster(inRasterPath);
GDALDataType datetype = inRaster.getDataType();
if (datetype == GDT_Byte ||
datetype == GDT_Int8 ||
datetype == GDT_Int16 ||
datetype == GDT_UInt16 ||
datetype == GDT_Int32 ||
datetype == GDT_UInt32 ||
datetype == GDT_Int64 ||
datetype == GDT_UInt64
) {
ResampleGDAL(inRasterPath.toLocal8Bit().constData(), OutRasterPath.toLocal8Bit().constData(),
gt.get(), refimage.width, refimage.height,
GDALResampleAlg::GRA_NearestNeighbour);
//alignRaster(inRasterPath, RefRasterPath, OutRasterPath,GDALResampleAlg::GRA_Bilinear);
}
else {
ResampleGDAL(inRasterPath.toLocal8Bit().constData(), OutRasterPath.toLocal8Bit().constData(),
gt.get(), refimage.width, refimage.height,
GDALResampleAlg::GRA_Bilinear);
//alignRaster(inRasterPath, RefRasterPath, OutRasterPath,GDALResampleAlg::GRA_Bilinear);
}
ResampleGDAL(inRasterPath.toLocal8Bit().constData(), OutRasterPath.toLocal8Bit().constData(),
gt.get(), refimage.width, refimage.height,
GDALResampleAlg::GRA_Bilinear);
//alignRaster(inRasterPath, RefRasterPath, OutRasterPath,GDALResampleAlg::GRA_Bilinear);

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>600</width>
<height>400</height>
<height>322</height>
</rect>
</property>
<property name="windowTitle">

View File

@ -31,7 +31,7 @@ QtLookTableCorrectOffsetDialog::~QtLookTableCorrectOffsetDialog()
void QtLookTableCorrectOffsetDialog::onOutRasterBtnClicked()
{
QString fileName = QFileDialog::getOpenFileName(
QString fileName = QFileDialog::getSaveFileName(
this, // 父窗口
tr(u8"选择影像文件"), // 标题
QString(), // 默认路径
@ -50,7 +50,7 @@ void QtLookTableCorrectOffsetDialog::onOutRasterBtnClicked()
void QtLookTableCorrectOffsetDialog::onInRasterBtnClicked()
{
QString fileName = QFileDialog::getSaveFileName(
QString fileName = QFileDialog::getOpenFileName(
this, // 父窗口
tr(u8"选择影像文件"), // 标题
QString(), // 默认路径
@ -95,7 +95,7 @@ void QtLookTableCorrectOffsetDialog::onAcceptBtnClicked()
Coldata = Coldata.array() + offsetCol;
outds.saveImage(Rowdata, i, 0, 1);
outds.saveImage(Coldata, i, 0, 1);
outds.saveImage(Coldata, i, 0, 2);
this->ui->progressBar->setValue(i);
}
this->ui->progressBar->setValue(inds.height);

View File

@ -131,7 +131,7 @@ __global__ void Kernel_RDProcess_doppler(
Rd_r = (ti - starttime) * PRF;
Rd_c = Fs/LIGHTSPEED * (R - nearRange)*2;
//printf("ti: %10.6f,starttime:%10.6f,PRF:%10.6f,Rd_c:%10.6f,R:%10.6f\n", ti, starttime, PRF, Rd_c, R);
//printf("ti: %10.6f,starttime:%10.6f,PRF:%10.6f,Rd_r:%10.6f,Rd_c:%10.6f,R:%10.6f\n", ti, starttime, PRF, Rd_r, Rd_c, R);
outRidx[idx] = Rd_r;
outCidx[idx] = Rd_c;//Rd_c;
return;
@ -185,6 +185,93 @@ void RDProcess_dopplerGPU(
cudaDeviceSynchronize();
}
__device__ double calculateIncidenceAngle(double Rx, double Ry, double Rz, double Sx, double Sy, double Sz) {
double dotProduct = Rx * Sx + Ry * Sy + Rz * Sz;
double magnitudeR = sqrt(Rx * Rx + Ry * Ry + Rz * Rz);
double magnitudeS = sqrt(Sx * Sx + Sy * Sy + Sz * Sz);
return acos(dotProduct / (magnitudeR * magnitudeS));
}
__global__ void Kernel_RDProcess_demSloper(
double* demX, double* demY, double* demZ,
double* demSloperX, double* demSloperY, double* demSloperZ,
float* InRidx,
float* outIncAngle,
long pixelcount,
double Xp0, double Yp0, double Zp0, double Xv0, double Yv0, double Zv0,
double Xp1, double Yp1, double Zp1, double Xv1, double Yv1, double Zv1,
double Xp2, double Yp2, double Zp2, double Xv2, double Yv2, double Zv2,
double Xp3, double Yp3, double Zp3, double Xv3, double Yv3, double Zv3,
double Xp4, double Yp4, double Zp4, double Xv4, double Yv4, double Zv4,
double Xp5, double Yp5, double Zp5, double Xv5, double Yv5, double Zv5,
double starttime, double nearRange, double farRange,
double PRF
) {
long idx = blockIdx.x * blockDim.x + threadIdx.x;
if (idx < pixelcount) {
double demx = demX[idx];
double demy = demY[idx];
double demz = demZ[idx];
double demSloperx = demSloperX[idx];
double demSlopery = demSloperY[idx];
double demSloperz = demSloperZ[idx];
float Rd_r = InRidx[idx];
double ti = starttime + Rd_r / PRF;
double Spx = getPolyfitNumber(ti, Xp0, Xp1, Xp2, Xp3, Xp4, Xp5);
double Spy = getPolyfitNumber(ti, Yp0, Yp1, Yp2, Yp3, Yp4, Yp5);
double Spz = getPolyfitNumber(ti, Zp0, Zp1, Zp2, Zp3, Zp4, Zp5);
double Rx = Spx - demx;
double Ry = Spy - demy;
double Rz = Spz - demz;
double R = sqrt(Rx * Rx + Ry * Ry + Rz * Rz);
Rx = Rx / R;
Ry = Ry / R;
Rz = Rz / R;
double incidenceAngle = calculateIncidenceAngle(Rx, Ry, Rz, demSloperx, demSlopery, demSloperz);
//printf("incangle:%f\n", incidenceAngle * r2d);
outIncAngle[idx] = incidenceAngle*r2d;
}
}
void RDProcess_demSloperGPU(
double* demX, double* demY, double* demZ,
double* demSloperX, double* demSloperY, double* demSloperZ,
float* InRidx,
float* outIncAngle,
long rowcount, long colcount,
double starttime, double nearRange, double farRange,
double PRF,
double Xp0, double Yp0, double Zp0, double Xv0, double Yv0, double Zv0,
double Xp1, double Yp1, double Zp1, double Xv1, double Yv1, double Zv1,
double Xp2, double Yp2, double Zp2, double Xv2, double Yv2, double Zv2,
double Xp3, double Yp3, double Zp3, double Xv3, double Yv3, double Zv3,
double Xp4, double Yp4, double Zp4, double Xv4, double Yv4, double Zv4,
double Xp5, double Yp5, double Zp5, double Xv5, double Yv5, double Zv5
) {
long pixelcount = rowcount * colcount;
int numBlocks = (pixelcount + BLOCK_SIZE - 1) / BLOCK_SIZE;
Kernel_RDProcess_demSloper << <numBlocks, BLOCK_SIZE >> > (
demX, demY, demZ,
demSloperX, demSloperY, demSloperZ,
InRidx,
outIncAngle,
pixelcount,
Xp0, Yp0, Zp0, Xv0, Yv0, Zv0,
Xp1, Yp1, Zp1, Xv1, Yv1, Zv1,
Xp2, Yp2, Zp2, Xv2, Yv2, Zv2,
Xp3, Yp3, Zp3, Xv3, Yv3, Zv3,
Xp4, Yp4, Zp4, Xv4, Yv4, Zv4,
Xp5, Yp5, Zp5, Xv5, Yv5, Zv5,
starttime, nearRange, farRange,
PRF
);
PrintLasterError("RD with demSloper function");
cudaDeviceSynchronize();
}

View File

@ -37,5 +37,23 @@ extern "C" void RDProcess_dopplerGPU(
//
extern "C" void RDProcess_demSloperGPU(
double* demX, double* demY, double* demZ, // 处理入射坐标
double* demSloperX, double* demSloperY, double* demSloperZ, // 处理入射坐标
float* InRidx, //float* InCidx, // 输出 行列数
float* outIncAngle,
long rowcount, long colcount,
double starttime, double nearRange, double farRange,
double PRF, //double Fs,
//double fact_lamda, // lamda 倒数
double Xp0 = 0, double Yp0 = 0, double Zp0 = 0, double Xv0 = 0, double Yv0 = 0, double Zv0 = 0, // 轨道参数
double Xp1 = 0, double Yp1 = 0, double Zp1 = 0, double Xv1 = 0, double Yv1 = 0, double Zv1 = 0,
double Xp2 = 0, double Yp2 = 0, double Zp2 = 0, double Xv2 = 0, double Yv2 = 0, double Zv2 = 0,
double Xp3 = 0, double Yp3 = 0, double Zp3 = 0, double Xv3 = 0, double Yv3 = 0, double Zv3 = 0,
double Xp4 = 0, double Yp4 = 0, double Zp4 = 0, double Xv4 = 0, double Yv4 = 0, double Zv4 = 0,
double Xp5 = 0, double Yp5 = 0, double Zp5 = 0, double Xv5 = 0, double Yv5 = 0, double Zv5 = 0
);

View File

@ -15,13 +15,14 @@
#include "ImageShowDialogClass.h"
#include "QToolProcessBarDialog.h"
QSimulationLookTableDialog::QSimulationLookTableDialog(QWidget *parent)
: QDialog(parent),ui(new Ui::QSimulationLookTableDialogClass)
QSimulationLookTableDialog::QSimulationLookTableDialog(QWidget* parent)
: QDialog(parent), ui(new Ui::QSimulationLookTableDialogClass)
{
ui->setupUi(this);
connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(onaccepted()));
connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(onrejected()));
connect(ui->pushButtonDEM, SIGNAL(clicked(bool)), this, SLOT(onpushButtonDEMClicked(bool)));
connect(ui->pushButtonSloper, SIGNAL(clicked(bool)), this, SLOT(onpushButtonSloperClicked(bool)));
connect(ui->pushButtonOrbitModel, SIGNAL(clicked(bool)), this, SLOT(onpushButtonOrbitModelClicked(bool)));
connect(ui->pushButtonOutDir, SIGNAL(clicked(bool)), this, SLOT(onpushButtonOutDirClicked(bool)));
connect(ui->pushButtonSataSetting, SIGNAL(clicked(bool)), this, SLOT(onpushButtonSataSettingClicked(bool)));
@ -76,7 +77,7 @@ void QSimulationLookTableDialog::onpushButtonDEMClicked(bool)
{
// 调用文件选择对话框并选择一个 .tif 文件
QString fileName = QFileDialog::getOpenFileName(this,
u8"DEM Raster Select", // ¶Ô»°¿ò±êÌâ
u8"DEM XYZ Raster Select", // 对话框标题
"", // 初始目录,可以设置为路径
u8"tiff Files (*.tiff);;tif Files (*.tif);;dat Files (*.dat);;All Files (*.*)"); // 文件类型过滤器
@ -88,13 +89,29 @@ void QSimulationLookTableDialog::onpushButtonDEMClicked(bool)
}
}
void QSimulationLookTableDialog::onpushButtonSloperClicked(bool)
{
// 调用文件选择对话框并选择一个 .tif 文件
QString fileName = QFileDialog::getOpenFileName(this,
u8"DEM Sloper Raster Select", // 对话框标题
"", // 初始目录,可以设置为路径
u8"tiff Files (*.tiff);;tif Files (*.tif);;dat Files (*.dat);;All Files (*.*)"); // 文件类型过滤器
if (!fileName.isEmpty()) {
this->ui->SloperLineEdit->setText(fileName);
}
else {
QMessageBox::information(this, u8"没有选择文件", u8"没有选择任何文件");
}
}
void QSimulationLookTableDialog::onpushButtonOutDirClicked(bool)
{
// 调用文件选择对话框并选择一个 .tif 文件
QString fileName = QFileDialog::getExistingDirectory(this,
u8"DEM Raster Select", // 对话框标题
"" // 初始目录,可以设置为路径
);
);
if (!fileName.isEmpty()) {
this->ui->outDirLineEdit->setText(fileName);
}
@ -174,7 +191,8 @@ void QSimulationLookTableDialog::LookTableSimualtionMainProcess(QString sateName
this->ui->label_tip->setText(u8"look table create...");
this->ui->progressBar->setValue(0);
this->LookTableSimulationDopplerProcess(
DEMPath, outLookTablePath,
DEMPath,
outLookTablePath,
OribtStartTime,
PolyfitPx, PolyfitPy, PolyfitPz,
PolyfitVx, PolyfitVy, PolyfitVz,
@ -193,14 +211,27 @@ void QSimulationLookTableDialog::LookTableSimualtionMainProcess(QString sateName
);
}
if (checkBoxIncAngle) {
this->ui->label_tip->setText(u8"sloper process...");
this->ui->progressBar->setValue(0);
outIncPath = JoinPath(outDirPath, sateName + "_incAngle.bin");
QString sloperPath = this->ui->SloperLineEdit->text();
LocalIncidenceAngleSimulationCompter(
sloperPath,
DEMPath,
outLookTablePath,
outIncPath,
OribtStartTime,
PolyfitPx,
PolyfitPy,
PolyfitPz,
PolyfitVx,
PolyfitVy,
PolyfitVz,
startTime, endTime,
nearRange, farRange,
PRF, Fs);
}
@ -310,37 +341,24 @@ void QSimulationLookTableDialog::LookTableSimulationDopplerProcess(QString DEMPa
// 内存预分配
//
std::shared_ptr<float> host_Rid((float*)mallocCUDAHost(sizeof(float) * GPUMemoryline * demimg.width), FreeCUDAHost);
std::shared_ptr<float> host_Cid((float*)mallocCUDAHost(sizeof(float) * GPUMemoryline * demimg.width), FreeCUDAHost);
std::shared_ptr<float> device_Rid((float*)mallocCUDADevice(sizeof(float) * GPUMemoryline * demimg.width), FreeCUDADevice);
std::shared_ptr<float> device_Cid((float*)mallocCUDADevice(sizeof(float) * GPUMemoryline * demimg.width), FreeCUDADevice);
//
std::shared_ptr<double> host_demX((double*)mallocCUDAHost(sizeof(double) * GPUMemoryline * demimg.width), FreeCUDAHost);
std::shared_ptr<double> host_demY((double*)mallocCUDAHost(sizeof(double) * GPUMemoryline * demimg.width), FreeCUDAHost);
std::shared_ptr<double> host_demZ((double*)mallocCUDAHost(sizeof(double) * GPUMemoryline * demimg.width), FreeCUDAHost);
std::shared_ptr<double> device_demX((double*)mallocCUDADevice(sizeof(double) * GPUMemoryline * demimg.width), FreeCUDADevice);
std::shared_ptr<double> device_demY((double*)mallocCUDADevice(sizeof(double) * GPUMemoryline * demimg.width), FreeCUDADevice);
std::shared_ptr<double> device_demZ((double*)mallocCUDADevice(sizeof(double) * GPUMemoryline * demimg.width), FreeCUDADevice);
//
//std::shared_ptr<ImageShowDialogClass> datashowptr(new ImageShowDialogClass);
// 处理复制结果
long rowcount = GPUMemoryline;
long colcount = demimg.width;
//rowcount = 1;
//colcount = 1;
//long testRid = demimg.height / 2;
//long testCid = demimg.width / 2;
double fact_lamda = 1 / lamda;
for (long rid = 0; rid < demimg.height; rid = rid + GPUMemoryline) {
long rowcount = GPUMemoryline;
long colcount = demimg.width;
qDebug() << "computer read file : " << rid << "~" << rowcount + rid << "\t:" << demimg.height;
//double* tmep = new double[rowcount * colcount];
std::shared_ptr<double> demX = readDataArr<double>(demimg, rid, 0, rowcount, colcount, 1, GDALREADARRCOPYMETHOD::VARIABLEMETHOD);// 行列数修改
@ -348,7 +366,21 @@ void QSimulationLookTableDialog::LookTableSimulationDopplerProcess(QString DEMPa
std::shared_ptr<double> demZ = readDataArr<double>(demimg, rid, 0, rowcount, colcount, 3, GDALREADARRCOPYMETHOD::VARIABLEMETHOD);
//
std::shared_ptr<float> host_Rid((float*)mallocCUDAHost(sizeof(float) * rowcount * demimg.width), FreeCUDAHost);
std::shared_ptr<float> host_Cid((float*)mallocCUDAHost(sizeof(float) * rowcount * demimg.width), FreeCUDAHost);
std::shared_ptr<float> device_Rid((float*)mallocCUDADevice(sizeof(float) * rowcount * demimg.width), FreeCUDADevice);
std::shared_ptr<float> device_Cid((float*)mallocCUDADevice(sizeof(float) * rowcount * demimg.width), FreeCUDADevice);
//
std::shared_ptr<double> host_demX((double*)mallocCUDAHost(sizeof(double) * rowcount * demimg.width), FreeCUDAHost);
std::shared_ptr<double> host_demY((double*)mallocCUDAHost(sizeof(double) * rowcount * demimg.width), FreeCUDAHost);
std::shared_ptr<double> host_demZ((double*)mallocCUDAHost(sizeof(double) * rowcount * demimg.width), FreeCUDAHost);
std::shared_ptr<double> device_demX((double*)mallocCUDADevice(sizeof(double) * rowcount * demimg.width), FreeCUDADevice);
std::shared_ptr<double> device_demY((double*)mallocCUDADevice(sizeof(double) * rowcount * demimg.width), FreeCUDADevice);
std::shared_ptr<double> device_demZ((double*)mallocCUDADevice(sizeof(double) * rowcount * demimg.width), FreeCUDADevice);
//std::shared_ptr<double> demX = readDataArr<double>(demimg, rid, testCid, rowcount, colcount, 1, GDALREADARRCOPYMETHOD::VARIABLEMETHOD);// 行列数修改
//std::shared_ptr<double> demY = readDataArr<double>(demimg, rid, testCid, rowcount, colcount, 2, GDALREADARRCOPYMETHOD::VARIABLEMETHOD);
@ -363,9 +395,9 @@ void QSimulationLookTableDialog::LookTableSimulationDopplerProcess(QString DEMPa
memcpy(host_demZ.get(), demZ.get(), sizeof(double) * rowcount * colcount);
//内存->GPU
HostToDevice(host_demX.get(), device_demX.get(), sizeof(double) * GPUMemoryline * demimg.width);
HostToDevice(host_demY.get(), device_demY.get(), sizeof(double) * GPUMemoryline * demimg.width);
HostToDevice(host_demZ.get(), device_demZ.get(), sizeof(double) * GPUMemoryline * demimg.width);
HostToDevice(host_demX.get(), device_demX.get(), sizeof(double) * rowcount * demimg.width);
HostToDevice(host_demY.get(), device_demY.get(), sizeof(double) * rowcount * demimg.width);
HostToDevice(host_demZ.get(), device_demZ.get(), sizeof(double) * rowcount * demimg.width);
qDebug() << "GPU computer start: " << rid << "~" << rowcount + rid << "\t:" << demimg.height;
RDProcess_dopplerGPU(
@ -385,8 +417,8 @@ void QSimulationLookTableDialog::LookTableSimulationDopplerProcess(QString DEMPa
// GPU -> 内存
DeviceToHost(host_Rid.get(), device_Rid.get(), sizeof(float) * GPUMemoryline * demimg.width);
DeviceToHost(host_Cid.get(), device_Cid.get(), sizeof(float) * GPUMemoryline * demimg.width);
DeviceToHost(host_Rid.get(), device_Rid.get(), sizeof(float) * rowcount * demimg.width);
DeviceToHost(host_Cid.get(), device_Cid.get(), sizeof(float) * rowcount * demimg.width);
qDebug() << "GPU computer finished!!: " << rid << "~" << rowcount + rid << "\t:" << demimg.height;
//exit(-1);
// 数据存储
@ -397,25 +429,227 @@ void QSimulationLookTableDialog::LookTableSimulationDopplerProcess(QString DEMPa
//datashowptr->exec();
qDebug() << "GPU computer result write finished: " << rid << "~" << rowcount + rid << "\t:" << demimg.height;
this->ui->progressBar->setValue(floor(100.0*(rowcount + rid)/ demimg.height));
this->ui->progressBar->setValue(floor(100.0 * (rowcount + rid) / demimg.height));
}
qDebug() << "look table computed finished!!!";
this->ui->progressBar->setValue(100);
}
void QSimulationLookTableDialog::LocalIncidenceAngleSimulationCompter(QString DEMPath, QString LookTablePath, QString outIncPath, long double OribtStartTime, std::vector<double> PolyfitPx, std::vector<double> PolyfitPy, std::vector<double> PolyfitPz, std::vector<double> PolyfitVx, std::vector<double> PolyfitVy, std::vector<double> PolyfitVz, double starttime, double endtime, double nearRange, double farRange, double PRF, double Fs)
void QSimulationLookTableDialog::LocalIncidenceAngleSimulationCompter(QString sloperPath, QString demxyzPath, QString LookTablePath, QString outIncPath, long double OribtStartTime, std::vector<double> PolyfitPx, std::vector<double> PolyfitPy, std::vector<double> PolyfitPz, std::vector<double> PolyfitVx, std::vector<double> PolyfitVy, std::vector<double> PolyfitVz, double starttime, double endtime, double nearRange, double farRange, double PRF, double Fs)
{
//gdalImage outInc = CreategdalImageDouble(
// outIncPath,
// demimg.height, demimg.width, 1,
// demimg.gt,
// demimg.projection,
// true,
// true,
// true
//);
// 生成入射角
qDebug() << "generate look table ";
qDebug() << "Sloper Path\t" << sloperPath;
qDebug() << "outLookTablePath\t" << LookTablePath;
gdalImage sloperimg(sloperPath);
gdalImage demimg(demxyzPath);
gdalImage looktableimg(LookTablePath);
gdalImage outIncAngle = CreategdalImage( // 创建查找表
outIncPath,
demimg.height, demimg.width,1,
demimg.gt,
demimg.projection,
true,
true,
true
);
starttime = starttime - OribtStartTime; // 处理坐标时间
endtime = endtime - OribtStartTime;
// 轨道模型
double Xp0 = 0, Yp0 = 0, Zp0 = 0, Xv0 = 0, Yv0 = 0, Zv0 = 0;
double Xp1 = 0, Yp1 = 0, Zp1 = 0, Xv1 = 0, Yv1 = 0, Zv1 = 0;
double Xp2 = 0, Yp2 = 0, Zp2 = 0, Xv2 = 0, Yv2 = 0, Zv2 = 0;
double Xp3 = 0, Yp3 = 0, Zp3 = 0, Xv3 = 0, Yv3 = 0, Zv3 = 0;
double Xp4 = 0, Yp4 = 0, Zp4 = 0, Xv4 = 0, Yv4 = 0, Zv4 = 0;
double Xp5 = 0, Yp5 = 0, Zp5 = 0, Xv5 = 0, Yv5 = 0, Zv5 = 0;
int degree = PolyfitPx.size();
switch (degree) {
case(6):
Xp5 = PolyfitPx[5];
Yp5 = PolyfitPy[5];
Zp5 = PolyfitPz[5];
Xv5 = PolyfitVx[5];
Yv5 = PolyfitVy[5];
Zv5 = PolyfitVz[5];
case(5):
Xp4 = PolyfitPx[4];
Yp4 = PolyfitPy[4];
Zp4 = PolyfitPz[4];
Xv4 = PolyfitVx[4];
Yv4 = PolyfitVy[4];
Zv4 = PolyfitVz[4];
case(4):
Xp3 = PolyfitPx[3];
Yp3 = PolyfitPy[3];
Zp3 = PolyfitPz[3];
Xv3 = PolyfitVx[3];
Yv3 = PolyfitVy[3];
Zv3 = PolyfitVz[3];
case(3):
Xp2 = PolyfitPx[2];
Yp2 = PolyfitPy[2];
Zp2 = PolyfitPz[2];
Xv2 = PolyfitVx[2];
Yv2 = PolyfitVy[2];
Zv2 = PolyfitVz[2];
case(2):
Xp1 = PolyfitPx[1];
Yp1 = PolyfitPy[1];
Zp1 = PolyfitPz[1];
Xv1 = PolyfitVx[1];
Yv1 = PolyfitVy[1];
Zv1 = PolyfitVz[1];
case(1):
Xp0 = PolyfitPx[0];
Yp0 = PolyfitPy[0];
Zp0 = PolyfitPz[0];
Xv0 = PolyfitVx[0];
Yv0 = PolyfitVy[0];
Zv0 = PolyfitVz[0];
default:
break;
}
// 处理分块
long GPUMemoryline = floor((Memory1MB * 2.0 / 8.0 / 3.0 / demimg.width * 2000));//2GB
GPUMemoryline = GPUMemoryline < 1 ? 1 : GPUMemoryline;
for (long rid = 0; rid < demimg.height; rid = rid + GPUMemoryline) {
long rowcount = GPUMemoryline;
long colcount = demimg.width;
qDebug() << "computer read file : " << rid << "~" << rowcount + rid << "\t:" << demimg.height;
//double* tmep = new double[rowcount * colcount];
std::shared_ptr<double> demX = readDataArr<double>(demimg, rid, 0, rowcount, colcount, 1, GDALREADARRCOPYMETHOD::VARIABLEMETHOD);// 行列数修改
std::shared_ptr<double> demY = readDataArr<double>(demimg, rid, 0, rowcount, colcount, 2, GDALREADARRCOPYMETHOD::VARIABLEMETHOD);
std::shared_ptr<double> demZ = readDataArr<double>(demimg, rid, 0, rowcount, colcount, 3, GDALREADARRCOPYMETHOD::VARIABLEMETHOD);
std::shared_ptr<double> demSloperX = readDataArr<double>(sloperimg, rid, 0, rowcount, colcount, 1, GDALREADARRCOPYMETHOD::VARIABLEMETHOD);// 行列数修改
std::shared_ptr<double> demSloperY = readDataArr<double>(sloperimg, rid, 0, rowcount, colcount, 2, GDALREADARRCOPYMETHOD::VARIABLEMETHOD);
std::shared_ptr<double> demSloperZ = readDataArr<double>(sloperimg, rid, 0, rowcount, colcount, 3, GDALREADARRCOPYMETHOD::VARIABLEMETHOD);
std::shared_ptr<double> look_rid = readDataArr<double>(looktableimg, rid, 0, rowcount, colcount, 1, GDALREADARRCOPYMETHOD::VARIABLEMETHOD);
//
std::shared_ptr<float> host_incangle((float*)mallocCUDAHost(sizeof(float) * rowcount * demimg.width), FreeCUDAHost);
std::shared_ptr<float> device_incangle((float*)mallocCUDADevice(sizeof(float) * rowcount * demimg.width), FreeCUDADevice);
//
std::shared_ptr<double> host_demX((double*)mallocCUDAHost(sizeof(double) * rowcount * demimg.width), FreeCUDAHost);
std::shared_ptr<double> host_demY((double*)mallocCUDAHost(sizeof(double) * rowcount * demimg.width), FreeCUDAHost);
std::shared_ptr<double> host_demZ((double*)mallocCUDAHost(sizeof(double) * rowcount * demimg.width), FreeCUDAHost);
std::shared_ptr<double> device_demX((double*)mallocCUDADevice(sizeof(double) * rowcount * demimg.width), FreeCUDADevice);
std::shared_ptr<double> device_demY((double*)mallocCUDADevice(sizeof(double) * rowcount * demimg.width), FreeCUDADevice);
std::shared_ptr<double> device_demZ((double*)mallocCUDADevice(sizeof(double) * rowcount * demimg.width), FreeCUDADevice);
// 对应坡度
std::shared_ptr<double> host_demSloperX((double*)mallocCUDAHost(sizeof(double) * rowcount * demimg.width), FreeCUDAHost);
std::shared_ptr<double> host_demSloperY((double*)mallocCUDAHost(sizeof(double) * rowcount * demimg.width), FreeCUDAHost);
std::shared_ptr<double> host_demSloperZ((double*)mallocCUDAHost(sizeof(double) * rowcount * demimg.width), FreeCUDAHost);
std::shared_ptr<double> device_demSloperX((double*)mallocCUDADevice(sizeof(double) * rowcount * demimg.width), FreeCUDADevice);
std::shared_ptr<double> device_demSloperY((double*)mallocCUDADevice(sizeof(double) * rowcount * demimg.width), FreeCUDADevice);
std::shared_ptr<double> device_demSloperZ((double*)mallocCUDADevice(sizeof(double) * rowcount * demimg.width), FreeCUDADevice);
// 行号
std::shared_ptr<float> host_Rid((float*)mallocCUDAHost(sizeof(float) * rowcount * demimg.width), FreeCUDAHost);
std::shared_ptr<float> device_Rid((float*)mallocCUDADevice(sizeof(float) * rowcount * demimg.width), FreeCUDADevice);
//std::shared_ptr<double> demX = readDataArr<double>(demimg, rid, testCid, rowcount, colcount, 1, GDALREADARRCOPYMETHOD::VARIABLEMETHOD);// 行列数修改
//std::shared_ptr<double> demY = readDataArr<double>(demimg, rid, testCid, rowcount, colcount, 2, GDALREADARRCOPYMETHOD::VARIABLEMETHOD);
//std::shared_ptr<double> demZ = readDataArr<double>(demimg, rid, testCid, rowcount, colcount, 3, GDALREADARRCOPYMETHOD::VARIABLEMETHOD);
//demX.get()[0]=-1407793.922129;
//demY.get()[0]=5465044.940211;
//demZ.get()[0]=2963219.736386;
// 数据复制
memcpy(host_demX.get(), demX.get(), sizeof(double) * rowcount * colcount);
memcpy(host_demY.get(), demY.get(), sizeof(double) * rowcount * colcount);
memcpy(host_demZ.get(), demZ.get(), sizeof(double) * rowcount * colcount);
memcpy(host_demSloperX.get(), demSloperX.get(), sizeof(double) * rowcount * colcount);
memcpy(host_demSloperY.get(), demSloperY.get(), sizeof(double) * rowcount * colcount);
memcpy(host_demSloperZ.get(), demSloperZ.get(), sizeof(double) * rowcount * colcount);
//内存->GPU
HostToDevice(host_demX.get(), device_demX.get(), sizeof(double) * rowcount * demimg.width);
HostToDevice(host_demY.get(), device_demY.get(), sizeof(double) * rowcount * demimg.width);
HostToDevice(host_demZ.get(), device_demZ.get(), sizeof(double) * rowcount * demimg.width);
HostToDevice(host_demSloperX.get(), device_demSloperX.get(), sizeof(double) * rowcount * demimg.width);
HostToDevice(host_demSloperY.get(), device_demSloperY.get(), sizeof(double) * rowcount * demimg.width);
HostToDevice(host_demSloperZ.get(), device_demSloperZ.get(), sizeof(double) * rowcount * demimg.width);
HostToDevice(look_rid.get(), device_Rid.get(), sizeof(float) * rowcount * demimg.width);
qDebug() << "GPU computer start: " << rid << "~" << rowcount + rid << "\t:" << demimg.height;
RDProcess_demSloperGPU(
device_demX.get(), device_demY.get(), device_demZ.get(),
device_demSloperX.get(), device_demSloperY.get(), device_demSloperZ.get(),
device_Rid.get(), device_incangle.get(),
rowcount, colcount,
starttime, nearRange, farRange,
PRF,
Xp0, Yp0, Zp0, Xv0, Yv0, Zv0,
Xp1, Yp1, Zp1, Xv1, Yv1, Zv1,
Xp2, Yp2, Zp2, Xv2, Yv2, Zv2,
Xp3, Yp3, Zp3, Xv3, Yv3, Zv3,
Xp4, Yp4, Zp4, Xv4, Yv4, Zv4,
Xp5, Yp5, Zp5, Xv5, Yv5, Zv5
);
DeviceToHost(host_incangle.get(), device_incangle.get(), sizeof(float) * rowcount * demimg.width);
qDebug() << "GPU computer finished!!: " << rid << "~" << rowcount + rid << "\t:" << demimg.height;
//exit(-1);
// 数据存储
outIncAngle.saveImage(host_incangle, rid, 0, rowcount, colcount, 1);
//datashowptr->load_double_data(host_Rid.get(), rowcount, colcount, QString("host_Rid"));
//datashowptr->exec();
qDebug() << "GPU computer result write finished: " << rid << "~" << rowcount + rid << "\t:" << demimg.height;
this->ui->progressBar->setValue(floor(100.0 * (rowcount + rid) / demimg.height));
}
qDebug() << "look table computed finished!!!";
this->ui->progressBar->setValue(100);
}
void QSimulationLookTableDialog::onaccepted()

View File

@ -26,6 +26,7 @@ public slots:
void onpushButtonOrbitModelClicked(bool);
void onpushButtonSataSettingClicked(bool);
void onpushButtonDEMClicked(bool);
void onpushButtonSloperClicked(bool);
void onpushButtonOutDirClicked(bool);
@ -69,7 +70,8 @@ private: // doppler
);
void LocalIncidenceAngleSimulationCompter(
QString DEMPath,
QString sloperPath,
QString demxyzPath,
QString LookTablePath,
QString outIncPath,
long double OribtStartTime, // 轨道模型参考时间

View File

@ -7,14 +7,106 @@
<x>0</x>
<y>0</y>
<width>763</width>
<height>387</height>
<height>498</height>
</rect>
</property>
<property name="windowTitle">
<string>QSimulationLookTableDialog</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="6" column="0" rowspan="2">
<item row="3" column="2">
<widget class="QPushButton" name="pushButtonDEM">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
<item row="10" column="0">
<widget class="QLabel" name="label_tip">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="10" column="1">
<widget class="QProgressBar" name="progressBar">
<property name="value">
<number>24</number>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLineEdit" name="lineEditLookName">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>LT1A_20250210</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_9">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>结果文件保存地址:</string>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QPushButton" name="pushButtonSloper">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="pushButtonSataSetting">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="OrbitModelPathLineEdit">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>D:\FZSimulation\LT1A\L20250210\LT1_Simulation_OrbitModel.xml</string>
</property>
</widget>
</item>
<item row="7" column="0" rowspan="2">
<widget class="QGroupBox" name="groupBox_3">
<property name="title">
<string>计算资源</string>
@ -52,15 +144,8 @@
</layout>
</widget>
</item>
<item row="11" column="0" colspan="3">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLineEdit" name="lineEditLookName">
<item row="0" column="0">
<widget class="QLabel" name="label_7">
<property name="minimumSize">
<size>
<width>0</width>
@ -68,7 +153,20 @@
</size>
</property>
<property name="text">
<string>LT1A_20250210</string>
<string>多项式轨道模型参数:</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_4">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>坡度法向文件(sloper)</string>
</property>
</widget>
</item>
@ -85,7 +183,46 @@
</property>
</widget>
</item>
<item row="8" column="0">
<item row="4" column="1">
<widget class="QLineEdit" name="SloperLineEdit">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>D:\FZSimulation\LT1A\L20250210\LT1A_DEM_20250210_resampleXYZ.dat</string>
</property>
</widget>
</item>
<item row="9" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="pushButtonOrbitModel">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
<item row="9" column="0">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
@ -98,7 +235,56 @@
</property>
</spacer>
</item>
<item row="5" column="2">
<item row="6" column="1">
<widget class="QLineEdit" name="outDirLineEdit">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>D:\FZSimulation\LT1A\L20250210\Looktable</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>查找表名</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="checkBoxDoppler">
<property name="text">
<string>采用多普勒参数</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_8">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>卫星仿真参数:</string>
</property>
</widget>
</item>
<item row="6" column="2">
<widget class="QPushButton" name="pushButtonOutDir">
<property name="minimumSize">
<size>
@ -111,6 +297,19 @@
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="SateSettingLineEdit">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>D:\FZSimulation\LT1A\L20250210\LT1_Simulation_Setting.xml</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="DEMLineEdit">
<property name="minimumSize">
@ -124,95 +323,14 @@
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_9">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>结果文件保存地址:</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_7">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>多项式轨道模型参数:</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>查找表名</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="pushButtonOrbitModel">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="checkBoxDoppler">
<property name="text">
<string>采用多普勒参数</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QPushButton" name="pushButtonDEM">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择</string>
<item row="12" column="0" colspan="3">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item row="8" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="7" column="1">
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>产品输出类型</string>
@ -253,85 +371,6 @@
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_8">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>卫星仿真参数:</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="pushButtonSataSetting">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="SateSettingLineEdit">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>D:\FZSimulation\LT1A\L20250210\LT1_Simulation_Setting.xml</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLineEdit" name="outDirLineEdit">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>D:\FZSimulation\LT1A\L20250210\Looktable</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="OrbitModelPathLineEdit">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>D:\FZSimulation\LT1A\L20250210\LT1_Simulation_OrbitModel.xml</string>
</property>
</widget>
</item>
<item row="9" column="1">
<widget class="QProgressBar" name="progressBar">
<property name="value">
<number>24</number>
</property>
</widget>
</item>
<item row="9" column="0">
<widget class="QLabel" name="label_tip">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>

View File

@ -128,41 +128,128 @@ void QtSimulationGeoSARSigma0Dialog::onbtnaccepted()
QString LandClsRaster = this->ui->InputLandClsRasterLineEdit->text(); // 输入地表覆盖分类文件
QString ClsWeightRaster = this->ui->InputClsWeightRasterLineEdit->text();// 输入 SigmaDatabase 权重文件
QString OutputTerrianRaster = this->ui->OutputTerrianRasterLineEdit->text(); // 输出入射角仿真SAR文件
QString OutputClsSARRaster = this->ui->OutputClsSARRasterLineEdit->text();// 输出地表覆盖分类仿真SAR文件
//QString OutputClsSARRaster = this->ui->OutputClsSARRasterLineEdit->text();// 输出地表覆盖分类仿真SAR文件
// 创建输出文件,其中输出文件的大小和输入文件的大小一致,复制输入文件到输出文件,并把文件置零
gdalImage IncAngle(IncAngleRaster);
QFile::copy(IncAngleRaster, OutputTerrianRaster);
gdalImage OutputTerrian(OutputTerrianRaster);
Eigen::MatrixXd IncAngleData = IncAngle.getData(0, 0, IncAngle.height, IncAngle.width,1);
Eigen::MatrixXd SigmaSARData = MuhlemanSigmaArray(IncAngleData);
OutputTerrian.saveImage(SigmaSARData, 0, 0, 1);
gdalImage incAngleImg(IncAngleRaster);
gdalImage landImg(LandClsRaster);
gdalImage weightImg(ClsWeightRaster);
gdalImage OutputTerrian=CreategdalImage(OutputTerrianRaster, incAngleImg.height, incAngleImg.width, 1, incAngleImg.gt, 4326, GDT_Float32, true, true);
if (QFile(LandClsRaster).exists()) {
// 分块加载运行 incAngleImg landImg weightImg处理每次处理100行
int blockSize = 100;
int numRows = incAngleImg.height;
int numCols = incAngleImg.width;
QFile::copy(IncAngleRaster, OutputClsSARRaster);
gdalImage OutputClsSAR(OutputClsSARRaster);
gdalImage LandCls(LandClsRaster);
SigmaDatabase sigmads;
sigmads.readParamsFromFile(ClsWeightRaster.toStdString());
Eigen::MatrixXd LandClsData = LandCls.getData(0, 0, LandCls.height, LandCls.width,1);
double calibration = 0;
bool flag = false;
for (int row = 0; row < numRows; row += blockSize) {
int numRowsToProcess = std::min(blockSize, numRows - row);
Eigen::MatrixXd SigmaSARDataCls = SigmaSARData;
for (long i = 0; i < LandClsData.rows(); i++)
{
for (long j = 0; j < LandClsData.cols(); j++)
{
double weight = sigmads.getAmpHH(LandClsData(i, j), IncAngleData(i, j) * d2r);
SigmaSARDataCls(i, j) = std::pow(10.0, weight / 20.0);
Eigen::MatrixXd incAngleData = incAngleImg.getData(row, 0, numRowsToProcess, numCols, 1);
Eigen::MatrixXd landData = landImg.getData(row, 0, numRowsToProcess, numCols, 1);
Eigen::MatrixXd weightData = weightImg.getData(row, 0, numRowsToProcess, numCols, 1);
//qDebug() << "(0,0)" << incAngleData(0, 2);
for (int i = 0; i < incAngleData.rows(); i++) {
for (int j = 0; j < incAngleData.cols(); j++) {
double weight = weightData(i, j);
double incAngle = incAngleData(i, j);
double weightSIgma = weight* sin(38 * d2r) / sin(incAngle * d2r);
double muhsigmaAmp=calculate_MuhlemanSigma(incAngle);
if ((landData(i, j) == 10|| std::abs(landData(i, j) - 10)<10||
landData(i, j) == 30 || std::abs(landData(i, j) - 30) < 10 ||
landData(i, j) == 90 || std::abs(landData(i, j) -90) < 10
)&&!isnan(incAngle)&&!isinf(incAngle)) {
//qDebug() << "muhsigmaAmp:" << muhsigmaAmp << "weightSIgma:" << weightSIgma << "weight:" << weight << "incAngle:" << incAngle;
calibration= (10 * log10(muhsigmaAmp))/ weightSIgma ;
if (!isinf(calibration) && !isnan(calibration))
{
flag = true;
break;
}
}
else {
//alibration = weightSIgma / (10 * log10(muhsigmaAmp));
}
}
}
OutputClsSAR.saveImage(SigmaSARDataCls, 0, 0, 1);
if (flag) {
break;
}
}
for (int row = 0; row < numRows; row += blockSize) {
int numRowsToProcess = std::min(blockSize, numRows - row);
Eigen::MatrixXd incAngleData = incAngleImg.getData(row, 0, numRowsToProcess, numCols, 1);
Eigen::MatrixXd landData = landImg.getData(row, 0, numRowsToProcess, numCols, 1);
Eigen::MatrixXd weightData = weightImg.getData(row, 0, numRowsToProcess, numCols, 1);
Eigen::MatrixXd OutputTerrianData = OutputTerrian.getData(row, 0, numRowsToProcess, numCols, 1);
for (int i = 0; i < incAngleData.rows(); i++) {
for (int j = 0; j < incAngleData.cols(); j++) {
double weight = weightData(i, j);
double incAngle = incAngleData(i, j);
double weightSIgma = weight * sin(38 * d2r) / sin(incAngle * d2r)* calibration;
double amp = std::pow(10, weightSIgma / 20);
OutputTerrianData(i, j) = amp;
}
}
OutputTerrian.saveImage(OutputTerrianData, row, 0, 1);
}
else {}
//// 创建输出文件,其中输出文件的大小和输入文件的大小一致,复制输入文件到输出文件,并把文件置零
//gdalImage IncAngle(IncAngleRaster);
//
//// 调用createImage函数创建输出文件 函数定义
//gdalImage OutputTerrian=CreategdalImage(OutputTerrianRaster, IncAngle.height, IncAngle.width, 1, IncAngle.gt, 4326, GDT_Float32, true, true);
//
//Eigen::MatrixXd IncAngleData = IncAngle.getData(0, 0, IncAngle.height, IncAngle.width,1);
//Eigen::MatrixXd SigmaSARData = MuhlemanSigmaArray(IncAngleData);
//
//OutputTerrian.saveImage(SigmaSARData, 0, 0, 1);
//if (QFile(LandClsRaster).exists()) {
// QFile::copy(OutputTerrianRaster, OutputClsSARRaster);
// gdalImage OutputClsSAR(OutputClsSARRaster);
// gdalImage LandCls(LandClsRaster);
// SigmaDatabase sigmads;
// sigmads.readParamsFromFile(ClsWeightRaster.toStdString());
// Eigen::MatrixXd LandClsData = LandCls.getData(0, 0, LandCls.height, LandCls.width,1);
// Eigen::MatrixXd SigmaSARDataCls = SigmaSARData;
// for (long i = 0; i < LandClsData.rows(); i++)
// {
// for (long j = 0; j < LandClsData.cols(); j++)
// {
// double weight = sigmads.getAmpHH(LandClsData(i, j), IncAngleData(i, j) * d2r);
// SigmaSARDataCls(i, j) = weight;
// }
// }
// OutputClsSAR.saveImage(SigmaSARDataCls, 0, 0, 1);
//}
//else {}
QMessageBox::information(nullptr, u8"提示", u8"completed!!!");
}

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>451</width>
<height>400</height>
<width>810</width>
<height>604</height>
</rect>
</property>
<property name="windowTitle">
@ -23,71 +23,6 @@
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_7">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>入射角影像:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="InputIncAngleRasterLineEdit">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>D:\FZSimulation\LT1A\L20250210\LT1_Simulation_OrbitModel.xml</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="InputIncAngleRasterBtn">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_9">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>地表覆盖影像:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="InputLandClsRasterLineEdit">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="InputLandClsRasterBtn">
<property name="minimumSize">
@ -101,71 +36,6 @@
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_10">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>权重文件:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="InputClsWeightRasterLineEdit">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QPushButton" name="InputClsWeightRasterBtn">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_11">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>输出地形仿真:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="OutputTerrianRasterLineEdit">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QPushButton" name="OutputTerrianRasterBtn">
<property name="minimumSize">
@ -179,8 +49,8 @@
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_8">
<item row="3" column="1">
<widget class="QLineEdit" name="OutputTerrianRasterLineEdit">
<property name="minimumSize">
<size>
<width>0</width>
@ -188,12 +58,12 @@
</size>
</property>
<property name="text">
<string>输出地类仿真影像:</string>
<string>D:/FZSimulation/LT1A/L20250210/Looktable/LT1A_2025021_simualtion_terrian.tif</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLineEdit" name="OutputClsSARRasterLineEdit">
<item row="3" column="0">
<widget class="QLabel" name="label_11">
<property name="minimumSize">
<size>
<width>0</width>
@ -201,12 +71,80 @@
</size>
</property>
<property name="text">
<string>D:\FZSimulation\LT1A\L20250210\LT1_Simulation_Setting.xml</string>
<string>输出地形仿真:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="InputIncAngleRasterLineEdit">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>D:/FZSimulation/LT1A/L20250210/Looktable/LT1A_20250210_incAngle.bin</string>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QPushButton" name="OutputClsSARRasterBtn">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string> </string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="InputLandClsRasterLineEdit">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>D:/FZSimulation/LT1A/n48_25_2020lc030_WGS84_aligned.tif</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_9">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>地表覆盖影像:</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_10">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>权重文件:</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="InputIncAngleRasterBtn">
<property name="minimumSize">
<size>
<width>0</width>
@ -218,6 +156,77 @@
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QPushButton" name="InputClsWeightRasterBtn">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLineEdit" name="OutputClsSARRasterLineEdit">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string> </string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_8">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string> </string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_7">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>入射角影像:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="InputClsWeightRasterLineEdit">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>D:/FZSimulation/LT1A/S1GBM_Merge_aligned.tif</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>

View File

@ -286,11 +286,11 @@ ErrorCode TBPImageAlgCls::ProcessGPU()
size_t prfcount = L0ds->getPluseCount();
size_t freqpoints = L0ds->getPlusePoints();
size_t block_pfrcount = Memory1MB / freqpoints / 8 * 2000;// 4GB -- 可以分配内存
size_t block_pfrcount = Memory1GB / freqpoints / 8 * 2;// 4GB -- 可以分配内存
size_t img_rowCont = L1ds->getrowCount();
size_t img_colCont = L1ds->getcolCount();
size_t block_imgRowCount = Memory1MB / img_colCont / 8 / 3 * 2000;// 4GB-- 可以分配内存
size_t block_imgRowCount = Memory1GB / img_colCont / 8 / 3 * 1;// 4GB-- 可以分配内存
gdalImage demgridimg(imgXYZPath);
gdalImageComplex im_finalds(outimgDataPath);

View File

@ -124,6 +124,7 @@
<OpenMPSupport>true</OpenMPSupport>
<LanguageStandard>stdcpp14</LanguageStandard>
<LanguageStandard_C>stdc11</LanguageStandard_C>
<WholeProgramOptimization>false</WholeProgramOptimization>
</ClCompile>
<CudaCompile>
<GenerateRelocatableDeviceCode>true</GenerateRelocatableDeviceCode>