RasterProcessTool/GF3CalibrationAndOrthLib/GF3CalibrationAndGeocodingC...

773 lines
29 KiB
C++
Raw Normal View History

#include "GF3CalibrationAndGeocodingClass.h"
#include "SatelliteGF3xmlParser.h"
#include <QRegularExpression>
#include <QMessageBox>
2025-02-06 13:18:25 +00:00
#include "GF3PSTNClass.h"
2024-11-25 06:26:46 +00:00
#include "boost/asio.hpp"
#include <boost/thread.hpp>
#include <thread>
#include <qprogressdialog.h>
2025-05-22 03:01:52 +00:00
#include "BaseTool.h"
#include "GeoOperator.h"
#include "ImageOperatorBase.h"
#include "FileOperator.h"
#include "GF3Util.h"
#include "GF3CalibrationAndOrthLib.h"
ErrorCode GF3CalibrationRaster(QString inRasterPath, QString outRasterPath, double Qualifyvalue, double calibrationConst)
{
2024-11-25 06:26:46 +00:00
gdalImage imgraster(inRasterPath.toUtf8().constData());
if (!isExists(outRasterPath)) {
gdalImageComplex outraster = CreategdalImageComplex(outRasterPath, imgraster.height, imgraster.width, 1, imgraster.gt, imgraster.projection, false, true);
}
gdalImageComplex outraster(outRasterPath);
2025-05-26 12:55:18 +00:00
long blocklines = Memory1MB / 8 / imgraster.width*200;
2024-11-25 06:26:46 +00:00
blocklines = blocklines < 100 ? 100 : blocklines;
double quayCoff = Qualifyvalue * 1.0 / 32767;
double caliCoff = std::pow(10.0, (calibrationConst * 1.0 / 20));
2025-04-17 19:30:28 +00:00
qDebug() << u8"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><EFBFBD>:\t" << quayCoff / caliCoff;
2025-05-26 12:55:18 +00:00
2024-11-25 06:26:46 +00:00
2025-05-26 12:55:18 +00:00
omp_lock_t lock;
omp_init_lock(&lock);
#pragma omp parallel for
for (int64_t startrow = 0; startrow < imgraster.height; startrow = startrow + blocklines) {
Eigen::MatrixXd imgArrb1 = imgraster.getData(startrow, 0, blocklines, imgraster.width, 1);
Eigen::MatrixXd imgArrb2 = imgraster.getData(startrow, 0, blocklines, imgraster.width, 2);
Eigen::MatrixXcd imgArr = outraster.getDataComplex(startrow, 0, blocklines, outraster.width, 1);
2024-11-25 06:26:46 +00:00
imgArr.real() = imgArrb1.array() * quayCoff / caliCoff;
imgArr.imag() = imgArrb2.array() * quayCoff / caliCoff;
2025-05-26 12:55:18 +00:00
omp_set_lock(&lock);
2024-11-25 06:26:46 +00:00
outraster.saveImage(imgArr, startrow, 0, 1);
2025-05-26 12:55:18 +00:00
omp_unset_lock(&lock); //
2024-11-25 06:26:46 +00:00
}
2025-05-26 12:55:18 +00:00
omp_destroy_lock(&lock); //
2025-04-17 19:30:28 +00:00
qDebug() << u8"Ӱ<EFBFBD><EFBFBD>д<EFBFBD><EFBFBD><EFBFBD>" << outRasterPath;
2024-11-25 06:26:46 +00:00
return ErrorCode::SUCCESS;
}
ErrorCode ImportGF3L1ARasterToWorkspace(QString inMetaxmlPath, QString inRasterPath, QString outWorkDirPath, POLARTYPEENUM polsartype)
{
2024-11-25 06:26:46 +00:00
SatelliteGF3xmlParser gf3xml;
gf3xml.loadFile(inMetaxmlPath);
QString filename = getFileNameWidthoutExtend(inRasterPath);
SARSimulationImageL1Dataset l1dataset;
l1dataset.OpenOrNew(outWorkDirPath, filename, gf3xml.height, gf3xml.width);
l1dataset.setSateAntPos(SatellitePos2SatelliteAntPos(gf3xml.antposs));
l1dataset.setCenterFreq(gf3xml.RadarCenterFrequency);
l1dataset.setcolCount(gf3xml.width);
l1dataset.setrowCount(gf3xml.height);
l1dataset.setNearRange(gf3xml.nearRange);
l1dataset.setRefRange(gf3xml.refRange);
l1dataset.setFs(gf3xml.eqvFs);
l1dataset.setPRF(gf3xml.eqvPRF);
l1dataset.setCenterAngle((gf3xml.incidenceAngleNearRange + gf3xml.incidenceAngleFarRange) / 2.0); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
l1dataset.setDopplerParametersReferenceTime(gf3xml.DopplerParametersReferenceTime);
l1dataset.setTotalProcessedAzimuthBandWidth(gf3xml.TotalProcessedAzimuthBandWidth);
l1dataset.setIncidenceAngleFarRange(gf3xml.incidenceAngleFarRange);
l1dataset.setIncidenceAngleNearRangeet(gf3xml.incidenceAngleNearRange);
l1dataset.setDopplerParams(gf3xml.d0, gf3xml.d1, gf3xml.d2, gf3xml.d3, gf3xml.d4);
l1dataset.setDopplerCenterCoff(gf3xml.r0, gf3xml.r1, gf3xml.r2, gf3xml.r3, gf3xml.r4);
l1dataset.setLatitudeCenter(gf3xml.latitude_center);
l1dataset.setLongitudeCenter(gf3xml.longitude_center);
l1dataset.setLatitudeTopLeft(gf3xml.latitude_topLeft);
l1dataset.setLongitudeTopLeft(gf3xml.longitude_topLeft);
l1dataset.setLatitudeTopRight(gf3xml.latitude_topRight);
l1dataset.setLongitudeTopRight(gf3xml.longitude_topRight);
l1dataset.setLatitudeBottomLeft(gf3xml.latitude_bottomLeft);
l1dataset.setLongitudeBottomLeft(gf3xml.longitude_bottomLeft);
l1dataset.setLatitudeBottomRight(gf3xml.latitude_bottomRight);
l1dataset.setLongitudeBottomRight(gf3xml.longitude_bottomRight);
2024-11-25 06:26:46 +00:00
l1dataset.setStartImageTime(gf3xml.start);
l1dataset.setEndImageTime(gf3xml.end);
l1dataset.saveToXml();
QString outRasterpath = l1dataset.getImageRasterPath();
ErrorCode errorcode = ErrorCode::SUCCESS;
2025-04-17 19:30:28 +00:00
qDebug() << u8"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:\t" << inRasterPath;
2024-11-25 06:26:46 +00:00
switch (polsartype)
{
case POLARHH:
2025-04-17 19:30:28 +00:00
qDebug() << u8"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>HH";
2024-11-25 06:26:46 +00:00
errorcode = GF3CalibrationRaster(inRasterPath, outRasterpath, gf3xml.HH_QualifyValue, gf3xml.HH_CalibrationConst);
break;
case POLARHV:
2025-04-17 19:30:28 +00:00
qDebug() << u8"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>HH";
2024-11-25 06:26:46 +00:00
errorcode = GF3CalibrationRaster(inRasterPath, outRasterpath, gf3xml.HV_QualifyValue, gf3xml.HV_CalibrationConst);
break;
case POLARVH:
2025-04-17 19:30:28 +00:00
qDebug() << u8"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>VH";
2024-11-25 06:26:46 +00:00
errorcode = GF3CalibrationRaster(inRasterPath, outRasterpath, gf3xml.VH_QualifyValue, gf3xml.VH_CalibrationConst);
break;
case POLARVV:
2025-04-17 19:30:28 +00:00
qDebug() << u8"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>VV";
2024-11-25 06:26:46 +00:00
errorcode = GF3CalibrationRaster(inRasterPath, outRasterpath, gf3xml.VV_QualifyValue, gf3xml.VV_CalibrationConst);
break;
default:
break;
}
2025-04-17 19:30:28 +00:00
qDebug() << u8"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬<EFBFBD><EFBFBD>\t" << QString::fromStdString(errorCode2errInfo(errorcode));
2024-11-25 06:26:46 +00:00
return errorcode;
}
QVector<QString> SearchGF3DataTiff(QString inMetaxmlPath)
{
2024-11-25 06:26:46 +00:00
// ָ<><D6B8>·<EFBFBD><C2B7>
QString xmlpath = inMetaxmlPath; // <20>滻Ϊ<E6BBBB><CEAA><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5>·<EFBFBD><C2B7>
QString absPath = QFileInfo(xmlpath).absolutePath();
// <20><>ȡ·<C8A1><C2B7><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD>Ŀ¼
QDir directory(absPath);
if (!directory.exists()) {
2025-04-17 19:30:28 +00:00
qDebug() << u8"Directory does not exist:" << directory.absolutePath();
2024-11-25 06:26:46 +00:00
return QVector<QString>(0);
}
// <20><><EFBFBD>ù<EFBFBD><C3B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Խ<EFBFBD><D4BD>г<EFBFBD> .tif <20>ļ<EFBFBD>
QStringList filters;
filters << "*.tif" << "*.TIF" << "*.tiff" << "*.TIFF";
QStringList files = directory.entryList(filters, QDir::Files);
2025-04-17 19:30:28 +00:00
qDebug() << u8"TIFF Files in the directory" << directory.absolutePath() << ":";
2024-11-25 06:26:46 +00:00
QVector<QString> filepath(0);
for (long i = 0; i < files.count(); i++) {
filepath.append(JoinPath(absPath, files[i]));
}
return filepath;
}
POLARTYPEENUM getDatasetGF3FilePolsarType(QString fileName)
{
2024-11-25 06:26:46 +00:00
// <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
QRegularExpression re("_([A-Z]{2})_");
QRegularExpressionMatch match = re.match(fileName);
QString polarization = "";
if (match.hasMatch()) {
polarization = match.captured(1);
polarization = polarization.toLower().replace("_", "");
2025-04-17 19:30:28 +00:00
qDebug() << u8"Polarization extracted:" << polarization;
2024-11-25 06:26:46 +00:00
if (polarization == "hh") {
return POLARTYPEENUM::POLARHH;
}
else if (polarization == "hv") {
2024-11-25 06:26:46 +00:00
return POLARTYPEENUM::POLARHV;
}
else if (polarization == "vh") {
2024-11-25 06:26:46 +00:00
return POLARTYPEENUM::POLARVH;
}
else if (polarization == "vv") {
2024-11-25 06:26:46 +00:00
return POLARTYPEENUM::POLARVV;
}
else {
return POLARTYPEENUM::POLARUNKOWN;
}
}
else {
2025-04-17 19:30:28 +00:00
qDebug() << u8"No polarization found in the path.";
2024-11-25 06:26:46 +00:00
return POLARTYPEENUM::POLARUNKOWN;
}
return POLARTYPEENUM::POLARUNKOWN;
}
ErrorCode ImportGF3L1AProcess(QString inMetaxmlPath, QString outWorkDirPath)
{
2024-11-25 06:26:46 +00:00
QVector<QString> tiffpaths = SearchGF3DataTiff(inMetaxmlPath);
ErrorCode errorcode = ErrorCode::SUCCESS;
for (long i = 0; i < tiffpaths.count(); i++) {
QString tiffpath = tiffpaths[i];
QString filenamewithoutextern = getFileNameWidthoutExtend(tiffpath);
QString filename = getFileNameFromPath(tiffpath);
POLARTYPEENUM poltype = getDatasetGF3FilePolsarType(filename);
switch (poltype)
{
case POLARHH:
errorcode = ImportGF3L1ARasterToWorkspace(inMetaxmlPath, tiffpath, outWorkDirPath, POLARTYPEENUM::POLARHH);
break;
case POLARHV:
errorcode = ImportGF3L1ARasterToWorkspace(inMetaxmlPath, tiffpath, outWorkDirPath, POLARTYPEENUM::POLARHV);
break;
case POLARVH:
errorcode = ImportGF3L1ARasterToWorkspace(inMetaxmlPath, tiffpath, outWorkDirPath, POLARTYPEENUM::POLARVH);
break;
case POLARVV:
errorcode = ImportGF3L1ARasterToWorkspace(inMetaxmlPath, tiffpath, outWorkDirPath, POLARTYPEENUM::POLARVV);
break;
case POLARUNKOWN:
break;
default:
break;
}
if (errorcode == ErrorCode::SUCCESS) {
2025-04-17 19:30:28 +00:00
continue;
2024-11-25 06:26:46 +00:00
}
else {
QMessageBox::warning(nullptr, u8"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", u8"<EFBFBD><EFBFBD><EFBFBD>ݵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
break;
}
}
return errorcode;
}
2025-02-06 13:18:25 +00:00
ErrorCode RD_PSTN(double& refrange, double& lamda, double& timeR, double& R, double& tx, double& ty, double& tz, double& slopex, double& slopey, double& slopez, GF3PolyfitSatelliteOribtModel& polyfitmodel, SatelliteOribtNode& node, double& d0, double& d1, double& d2, double& d3, double& d4)
2024-11-25 06:26:46 +00:00
{
double dt = 1e-4;
2024-11-25 06:26:46 +00:00
double inct = 0;
bool antfalg = false;
double timeR2 = 0;
//return ((R_s1.array() * V_s1.array()).rowwise().sum().array() * (-2) / (R * this->lamda))[0];
//double t = (R - this->refrange) * (1e6 / LIGHTSPEED);
//return this->doppler_paras(0) + this->doppler_paras(1) * t + this->doppler_paras(2) * t * t + this->doppler_paras(3) * t * t * t + this->doppler_paras(4) * t * t * t * t;
double R1 = 0;
double R2 = 0;
double dplerTheory1 = 0;
double dplerTheory2 = 0;
double dplerNumber1 = 0;
double dplerNumber2 = 0;
double dplerR = 0;
// Rst=Rs-Rt;
for (int i = 0; i < 50; i++) {
polyfitmodel.getSatelliteOribtNode(timeR, node, antfalg);
R1 = std::sqrt(std::pow(node.Px - tx, 2) + std::pow(node.Py - ty, 2) + std::pow(node.Pz - tz, 2));
2025-04-21 01:56:53 +00:00
//dplerTheory1 = (-2 / lamda / R1) * ((node.Px - tx) * (node.Vx + EARTHWE * ty) + (node.Py - ty) * (node.Vy - EARTHWE * tx) + (node.Pz - tz) * (node.Vz - 0));
dplerTheory1 = (-2 / lamda / R1) * ((node.Px - tx) * (node.Vx + 0) + (node.Py - ty) * (node.Vy -0) + (node.Pz - tz) * (node.Vz - 0));
dplerR = (R1 - refrange) * 1e6 / LIGHTSPEED; // GF3 <20><><EFBFBD>ʽ
2024-11-25 06:26:46 +00:00
dplerNumber1 = d0 + dplerR * d1 + std::pow(dplerR, 2) * d2 + std::pow(dplerR, 3) * d3 + std::pow(dplerR, 4) * d4;
timeR2 = timeR + dt;
polyfitmodel.getSatelliteOribtNode(timeR2, node, antfalg);
R2 = std::sqrt(std::pow(node.Px - tx, 2) + std::pow(node.Py - ty, 2) + std::pow(node.Pz - tz, 2));
2025-04-21 01:56:53 +00:00
//dplerTheory2 = (-2 / lamda/R2) * ((node.Px - tx) * (node.Vx + EARTHWE * ty) + (node.Py - ty) * (node.Vy - EARTHWE * tx) + (node.Pz - tz) * (node.Vz - 0));
dplerTheory2 = (-2 / lamda/R2) * ((node.Px - tx) * (node.Vx +0) + (node.Py - ty) * (node.Vy -0) + (node.Pz - tz) * (node.Vz - 0));
//dplerR = (R2 - refrange) * 1e6 / LIGHTSPEED; // GF3 <20><><EFBFBD>ʽ
//dplerNumber2 = d0 + dplerR * d1 + std::pow(dplerR, 2) * d2 + std::pow(dplerR, 3) * d3 + std::pow(dplerR, 4) * d4;
2025-04-21 01:56:53 +00:00
inct = dt*(dplerTheory2-dplerNumber1) / (dplerTheory2 - dplerTheory1);
if (std::abs(dplerNumber1 - dplerTheory2) < 1e-6 || std::abs(inct) < 1.0e-4) {
2025-05-22 09:28:20 +00:00
R = R1; // б<><D0B1>
return ErrorCode::SUCCESS;
2024-11-25 06:26:46 +00:00
break;
}
2025-04-21 01:56:53 +00:00
inct = std::abs(inct) < 10 ?inct:inct*1e-2;
2024-11-25 06:26:46 +00:00
timeR = timeR - inct;
}
2025-05-22 09:28:20 +00:00
return ErrorCode::FAIL;
2024-11-25 06:26:46 +00:00
}
2024-11-25 06:26:46 +00:00
ErrorCode GF3RDCreateLookTable(QString inxmlPath, QString indemPath, QString outworkdir, QString outlooktablePath,QString outLocalIncidenceAnglePath,bool localincAngleFlag)
{
QString indemfilename = getFileNameWidthoutExtend(indemPath);
QString resampleDEMXYZPath = JoinPath(outworkdir, indemfilename + "_XYZ.tif");
QString resampleDEMSLOPEPath = JoinPath(outworkdir, indemfilename + "_slopevector.tif");
DEM2XYZRasterAndSlopRaster(indemPath, resampleDEMXYZPath, resampleDEMSLOPEPath);
gdalImage demxyz(resampleDEMXYZPath);// X,Y,Z
gdalImage demslope(resampleDEMSLOPEPath);// X,Y,Z
gdalImage rasterRC = CreategdalImage(outlooktablePath, demxyz.height, demxyz.width, 2, demxyz.gt, demxyz.projection, true, true);// X,Y,Z
gdalImage localincangleRaster;
if (localincAngleFlag) {
localincangleRaster = CreategdalImage(outLocalIncidenceAnglePath, demxyz.height, demxyz.width, 1, demxyz.gt, demxyz.projection, true, true);// X,Y,Z
2024-11-25 06:26:46 +00:00
}
SARSimulationImageL1Dataset l1dataset;
l1dataset.Open(inxmlPath);
// RD <20><><EFBFBD>ز<EFBFBD><D8B2><EFBFBD>
QVector<double> dopplers = l1dataset.getDopplerParams(); // <20><><EFBFBD><EFBFBD><EFBFBD>ղ<EFBFBD><D5B2><EFBFBD>
double d0 = dopplers[0];
double d1 = dopplers[1];
double d2 = dopplers[2];
double d3 = dopplers[3];
double d4 = dopplers[4];
double fs = l1dataset.getFs()*1e6;// Fs<46><73><EFBFBD><EFBFBD>
double prf = l1dataset.getPRF();// PRF <20><><EFBFBD><EFBFBD>
2024-11-25 06:26:46 +00:00
double nearRange = l1dataset.getNearRange();
double imagestarttime = l1dataset.getStartImageTime();
double imageendtime = l1dataset.getEndImageTime();
2024-11-25 06:26:46 +00:00
double refrange = l1dataset.getRefRange();
double lamda = (LIGHTSPEED*1.0e-9)/ l1dataset.getCenterFreq();
// <20><>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD>
qDebug() << "Fs:\t" << fs;
qDebug() << "prf:\t" << prf;
qDebug() << "nearRange:\t" << nearRange;
qDebug() << "imagestarttime:\t" << imagestarttime;
qDebug() << "imageendtime:\t" << imageendtime;
qDebug() << "refrange:\t" << refrange;
qDebug() << "lamda:\t" << lamda;
//<2F><>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>
qDebug() << u8"-----------------------------------";
qDebug() << u8"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ղ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n";
qDebug() << u8"d0:\t" << d0;
qDebug() << u8"d1:\t" << d1;
qDebug() << u8"d2:\t" << d2;
qDebug() << u8"d3:\t" << d3;
qDebug() << u8"d4:\t" << d4;
qDebug() << u8"-----------------------------------";
2024-11-25 06:26:46 +00:00
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>
2025-02-06 13:18:25 +00:00
GF3PolyfitSatelliteOribtModel polyfitmodel;
2024-11-25 06:26:46 +00:00
QVector < SatelliteAntPos > antposes = l1dataset.getXmlSateAntPos();
polyfitmodel.setSatelliteOribtStartTime((imagestarttime+imageendtime)/2);
2024-11-25 06:26:46 +00:00
for (long i = 0; i < antposes.size(); i++) {
if (antposes[i].time > imagestarttime - 5 && antposes[i].time < imageendtime + 5) {
SatelliteOribtNode node;
node.time = antposes[i].time;
node.Px = antposes[i].Px;
node.Py = antposes[i].Py;
node.Pz = antposes[i].Pz;
node.Vx = antposes[i].Vx;
node.Vy = antposes[i].Vy;
node.Vz = antposes[i].Vz;
polyfitmodel.addOribtNode(node);
}
2024-11-25 06:26:46 +00:00
}
polyfitmodel.polyFit(3, false);
qDebug() << "-----------------------------------";
2025-04-17 19:30:28 +00:00
qDebug() << u8"satellite polyfit model params:\n";
2024-11-25 06:26:46 +00:00
qDebug() << polyfitmodel.getSatelliteOribtModelParamsString();
qDebug() << "-----------------------------------";
// <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ұ<EFBFBD>
//1.<2E><><EFBFBD><EFBFBD><EFBFBD>ֿ<EFBFBD>
long cpucore_num = std::thread::hardware_concurrency();
long blocklineinit = Memory1MB / 8 / cpucore_num / 4 / l1dataset.getcolCount() * 8000;
2025-04-17 19:30:28 +00:00
blocklineinit = blocklineinit < 50 ? 50 : blocklineinit;
2024-11-25 06:26:46 +00:00
//2.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2025-04-17 19:30:28 +00:00
long colcount = rasterRC.width;//l1dataset.getcolCount();
long rowcount = rasterRC.height;//l1dataset.getrowCount();
2024-11-25 06:26:46 +00:00
long startRId = 0;
long processNumber = 0;
QProgressDialog progressDialog(u8"<EFBFBD><EFBFBD><EFBFBD>ұ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", u8"<EFBFBD><EFBFBD>ֹ", 0, rowcount);
progressDialog.setWindowTitle(u8"<EFBFBD><EFBFBD><EFBFBD>ұ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
progressDialog.setWindowModality(Qt::WindowModal);
progressDialog.setAutoClose(true);
progressDialog.setValue(0);
progressDialog.setMaximum(rowcount);
progressDialog.setMinimum(0);
progressDialog.show();
omp_lock_t lock;
omp_init_lock(&lock);
2025-04-17 19:30:28 +00:00
for (startRId = 0; startRId < rowcount; startRId = startRId + blocklineinit) {
long blockline = blocklineinit;
if (startRId + blockline > rowcount) {
blockline = rowcount - startRId;
}
2024-11-25 06:26:46 +00:00
Eigen::MatrixXd sar_r = rasterRC.getData(startRId, 0, blockline, colcount, 1);
Eigen::MatrixXd sar_c = rasterRC.getData(startRId, 0, blockline, colcount, 2);
Eigen::MatrixXd dem_x = demxyz.getData(startRId, 0, blockline, colcount, 1);
Eigen::MatrixXd dem_y = demxyz.getData(startRId, 0, blockline, colcount, 2);
Eigen::MatrixXd dem_z = demxyz.getData(startRId, 0, blockline, colcount, 3);
2024-11-25 06:26:46 +00:00
long blockrows = sar_r.rows();
long blockcols = sar_r.cols();
#pragma omp parallel for
2024-11-25 06:26:46 +00:00
for (long i = 0; i < blockrows; i++) {
// <20><><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
double timeR = 0;
double tx = 0;
double ty = 0;
double tz = 0;
double R = 0;
double slopex = 0, slopey = 0, slopez = 0;
SatelliteOribtNode node{ 0,0,0,0,0,0,0,0 };
bool antflag = false;
2024-11-25 06:26:46 +00:00
for (long j = 0; j < blockcols; j++) {
2024-11-25 06:26:46 +00:00
tx = dem_x(i, j);
ty = dem_y(i, j);
tz = dem_z(i, j);
if (RD_PSTN(refrange,lamda, timeR,R,tx,ty,tz,slopex,slopey,slopez,polyfitmodel,node,d0,d1,d2,d3,d4) == ErrorCode::SUCCESS) {
sar_r(i, j) =( timeR+ (imagestarttime + imageendtime) / 2 -imagestarttime) * prf;
sar_c(i, j) = ((R - nearRange) * 2 / LIGHTSPEED) * fs;
2024-11-25 06:26:46 +00:00
}
else {
sar_r(i, j) = -1;
sar_c(i, j) = -1;
}
}
}
2025-05-22 03:01:52 +00:00
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
omp_set_lock(&lock);
rasterRC.saveImage(sar_r, startRId, 0, 1);
rasterRC.saveImage(sar_c, startRId, 0, 2);
omp_unset_lock(&lock);
2024-11-25 06:26:46 +00:00
Eigen::MatrixXd Angle_Arr = Eigen::MatrixXd::Zero(dem_x.rows(),dem_x.cols()).array()+181;
if (localincAngleFlag) {
Eigen::MatrixXd demslope_x = demslope.getData(startRId, 0, blockline, colcount, 1);
Eigen::MatrixXd demslope_y = demslope.getData(startRId, 0, blockline, colcount, 2);
Eigen::MatrixXd demslope_z = demslope.getData(startRId, 0, blockline, colcount, 3);
Eigen::MatrixXd Angle_Arr = localincangleRaster.getData(startRId, 0, blockline, colcount, 1);
double Rst_x = 0, Rst_y = 0, Rst_z = 0, localangle = 0;
double slopeR = 0;
#pragma omp parallel for
2024-11-25 06:26:46 +00:00
for (long i = 0; i < blockrows; i++) {
// <20><><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
double timeR = 0;
double tx = 0;
double ty = 0;
double tz = 0;
double R = 0;
double slopex = 0, slopey = 0, slopez = 0;
SatelliteOribtNode node{ 0,0,0,0,0,0,0,0 };
bool antflag = false;
2024-11-25 06:26:46 +00:00
for (long j = 0; j < blockcols; j++) {
timeR = sar_r(i, j) / prf;
slopex = demslope_x(i, j);
slopey = demslope_y(i, j);
slopez = demslope_z(i, j);
tx = dem_x(i, j);
ty = dem_y(i, j);
tz = dem_z(i, j);
polyfitmodel.getSatelliteOribtNode(timeR, node, antflag);
Rst_x = node.Px - tx;
Rst_y = node.Py - ty;
Rst_z = node.Pz - tz;
R = std::sqrt(Rst_x*Rst_x+Rst_y*Rst_y+Rst_z*Rst_z);
slopeR = std::sqrt(slopex*slopex + slopey * slopey + slopez * slopez);
localangle = ((slopex * Rst_x) + (slopey * Rst_y) + (slopez * Rst_z));
2025-05-22 03:01:52 +00:00
localangle = std::acos(localangle / R/slopeR)*r2d; // <20>Ƕ<EFBFBD>
2024-11-25 06:26:46 +00:00
Angle_Arr(i, j) = localangle;
}
}
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
omp_set_lock(&lock);
if (localincAngleFlag) {
localincangleRaster.saveImage(Angle_Arr, startRId, 0, 1);
}
else {}
omp_unset_lock(&lock);
2024-11-25 06:26:46 +00:00
}
2024-11-25 06:26:46 +00:00
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
omp_set_lock(&lock);
2024-11-25 06:26:46 +00:00
processNumber = processNumber + blockrows;
2025-04-17 19:30:28 +00:00
qDebug() << u8"\rprocess bar:\t" << processNumber * 100.0 / rowcount << " % " << "\t\t\t";
2024-11-25 06:26:46 +00:00
if (progressDialog.maximum() <= processNumber) {
processNumber = progressDialog.maximum() - 1;
}
progressDialog.setValue(processNumber);
omp_unset_lock(&lock);
}
progressDialog.close();
return ErrorCode::SUCCESS;
}
2024-11-25 06:26:46 +00:00
ErrorCode GF3OrthSLC( QString inRasterPath, QString inlooktablePath, QString outRasterPath)
{
gdalImage slcRaster(inRasterPath);//
gdalImage looktableRaster(inlooktablePath);//
gdalImage outRaster = CreategdalImage(outRasterPath, looktableRaster.height, looktableRaster.width, 1, looktableRaster.gt, looktableRaster.projection, true, true);// X,Y,Z
//gdalImage outRaster(outRasterPath);//
2024-11-25 06:26:46 +00:00
if (outRaster.height != looktableRaster.height || outRaster.width != looktableRaster.width) {
2025-04-17 19:30:28 +00:00
qDebug() << u8"look table size is not same as outRaster size"<< looktableRaster.height <<"!="<<outRaster.height<<" "<<looktableRaster.width<<"!="<<outRaster.width;
2024-11-25 06:26:46 +00:00
return ErrorCode::FAIL;
}
2025-05-22 13:04:45 +00:00
// <20>ֿ<EFBFBD><D6BF><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>
2025-05-26 12:55:18 +00:00
long blockline = Memory1MB / looktableRaster.width / 8 * 200;//300M
2025-05-22 13:04:45 +00:00
blockline = blockline < 1 ? 1 : blockline;
2025-05-26 12:55:18 +00:00
int64_t allcount = 0;
2025-05-22 13:04:45 +00:00
#pragma omp parallel for
for (long startrowid = 0; startrowid < looktableRaster.height; startrowid = startrowid + blockline) {
long tempblockline = startrowid + blockline < looktableRaster.height ? blockline : looktableRaster.height - startrowid;
Eigen::MatrixXd sar_r = looktableRaster.getData(startrowid, 0, tempblockline, looktableRaster.width, 1);
Eigen::MatrixXd sar_c = looktableRaster.getData(startrowid, 0, tempblockline, looktableRaster.width, 2);
int64_t slc_min_rid = sar_r.array().minCoeff();
int64_t slc_max_rid = sar_r.array().maxCoeff();
int64_t slc_r_len = slc_max_rid - slc_min_rid+1;
slc_min_rid = slc_min_rid < 0 ? 0 : slc_min_rid-1;
slc_r_len = slc_r_len + 2;
Eigen::MatrixXd slcImg = slcRaster.getData(slc_min_rid, 0, slc_r_len, slcRaster.width, 1);
Eigen::MatrixXd outImg = outRaster.getData(startrowid, 0, tempblockline, outRaster.width, 1);
long lastr = 0;
long nextr = 0;
long lastc = 0;
long nextc = 0;
double Bileanervalue = 0;
// <20><>ֵ
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 lookRows = sar_r.rows();
long lookCols = sar_r.cols();
long slcRows = slcImg.rows();
long slcCols = slcImg.cols();
for (long i = 0; i < lookRows; i++) {
for (long j = 0; j < lookCols; j++) {
2025-05-26 12:55:18 +00:00
p0 = { sar_c(i,j) - lastc, sar_r(i,j) - lastr,0 };
2025-05-22 13:04:45 +00:00
lastr = std::floor(sar_r(i, j));
nextr = std::ceil(sar_r(i, j));
lastc = std::floor(sar_c(i, j));
nextc = std::ceil(sar_c(i, j));
2025-05-26 12:55:18 +00:00
lastr = lastr - slc_min_rid;
nextr = nextr - slc_min_rid;
2025-05-22 13:04:45 +00:00
if (lastr < 0 || lastc < 0 || nextr >= slcRows || nextc >= slcCols) {
continue;
}
p11 = Landpoint{ 0,0,slcImg(lastr,lastc) };
p21 = Landpoint{ 0,1,slcImg(nextr,lastc) };
p12 = Landpoint{ 1,0,slcImg(lastr,nextc) };
p22 = Landpoint{ 1,1,slcImg(nextr,nextc) };
Bileanervalue = Bilinear_interpolation(p0, p11, p21, p12, p22);
outImg(i, j) = Bileanervalue;
2024-11-25 06:26:46 +00:00
}
2025-05-26 12:55:18 +00:00
}
2025-05-22 13:04:45 +00:00
outRaster.saveImage(outImg, startrowid, 0, 1);
2025-05-26 12:55:18 +00:00
allcount = allcount + tempblockline;
2024-11-25 06:26:46 +00:00
}
2025-05-26 12:55:18 +00:00
return ErrorCode::SUCCESS;
}
2024-11-25 06:26:46 +00:00
ErrorCode GF3RDProcess(QString inxmlPath, QString indemPath, QString outworkdir, double gridx, double gridy)
{
2024-11-25 06:26:46 +00:00
SARSimulationImageL1Dataset l1dataset;
l1dataset.Open(inxmlPath);
DemBox box = l1dataset.getExtend();
2025-05-26 12:55:18 +00:00
double dlon = 0.2 * (box.max_lon - box.min_lon);
double dlat = 0.2 * (box.max_lat - box.min_lat);
2024-11-25 06:26:46 +00:00
double minlat = box.min_lat - dlat;
double minlon = box.min_lon - dlon;
double maxlat = box.max_lat + dlat;
double maxlon = box.max_lon + dlon;
2025-04-17 19:30:28 +00:00
qDebug() << u8"Ӱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Χ:";
qDebug() << u8"Bounding Box:";
qDebug() << u8"Latitude:" << minlat <<" - "<< maxlat;
qDebug() << u8"Longitude:" << minlon <<" - "<< maxlon;
double centerlat = (minlat + maxlat) / 2;
double centerlon = (minlon + maxlon) / 2;
long sourceespgcode = getProjectEPSGCodeByLon_Lat(centerlon, centerlat);
long demespgcode = GetEPSGFromRasterFile(indemPath);
double grid_resolution = gridx < gridy ? gridx : gridy;
2025-05-22 09:28:20 +00:00
double degreePerPixelX = getPixelSpacingInDegree(grid_resolution);
double degreePerPixelY = getPixelSpacingInDegree(grid_resolution);
2025-04-17 19:30:28 +00:00
bool meter2degreeflag = ConvertResolutionToDegrees(
sourceespgcode,
grid_resolution,
centerlon,
centerlat,
degreePerPixelX,
degreePerPixelY
);
if (!meter2degreeflag) {
qDebug() << u8"ת<EFBFBD><EFBFBD><EFBFBD>ֱ<EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>γ<EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD>";
2025-05-22 09:28:20 +00:00
degreePerPixelX = getPixelSpacingInDegree(grid_resolution);
degreePerPixelY = getPixelSpacingInDegree(grid_resolution);
2025-04-17 19:30:28 +00:00
}
qDebug() << u8"DEMӰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Χ:";
qDebug() << u8"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֱ<EFBFBD><EFBFBD>ʣ<EFBFBD>"<<gridx<<" \t" << gridy;
qDebug() << u8"Ӱ<EFBFBD><EFBFBD><EFBFBD>ֱ<EFBFBD><EFBFBD><EFBFBD>:\t" << grid_resolution;
qDebug() << u8"<EFBFBD>ֱ<EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>γ<EFBFBD><EFBFBD>:\t" << degreePerPixelX << "\t" << degreePerPixelY;
// <20><><EFBFBD><EFBFBD>DEM<45>ķֱ<C4B7><D6B1><EFBFBD>
2024-11-25 06:26:46 +00:00
// <20>ü<EFBFBD>DEM
QString filename = getFileNameWidthoutExtend(l1dataset.getxmlFilePath());
filename = filename.right(5);
QString clipDEMPath = JoinPath(outworkdir, getFileNameWidthoutExtend(indemPath) + filename + "_clip.tif");
cropRasterByLatLon(indemPath.toUtf8().constData(), clipDEMPath.toUtf8().constData(), minlon, maxlon, minlat, maxlat);
QString resampleDEMPath = JoinPath(outworkdir, getFileNameWidthoutExtend(indemPath) + filename + "_clip_resample.tif");
2025-04-17 19:30:28 +00:00
resampleRaster(clipDEMPath.toUtf8().constData(), resampleDEMPath.toUtf8().constData(), degreePerPixelX, degreePerPixelY);
2024-11-25 06:26:46 +00:00
QString outlooktablePath = JoinPath(outworkdir, getFileNameWidthoutExtend(l1dataset.getxmlFilePath()) + "_looktable.tif");
QString outlocalAnglePath = JoinPath(outworkdir, getFileNameWidthoutExtend(l1dataset.getxmlFilePath()) + "_localAngle.tif");
QString outOrthPath=JoinPath(outworkdir, getFileNameWidthoutExtend(l1dataset.getxmlFilePath()) + "_orth.tif");
2025-04-21 01:56:53 +00:00
if (GF3RDCreateLookTable(inxmlPath, resampleDEMPath, outworkdir, outlooktablePath, outlocalAnglePath,true) != ErrorCode::SUCCESS) {
2025-04-17 19:30:28 +00:00
qDebug() << u8"<EFBFBD><EFBFBD><EFBFBD>ұ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\t" + getFileNameWidthoutExtend(inxmlPath);
2024-11-25 06:26:46 +00:00
return ErrorCode::FAIL;
}
return ErrorCode::SUCCESS;
}
2025-05-22 03:01:52 +00:00
ErrorCode GF3MainOrthProcess(QString inDEMPath, QString inTarFilepath, QString outworkspacefolderpath, double pixelresultionDegreee, bool excutehh2vv)
{
2025-05-22 09:28:20 +00:00
QProgressDialog progressDialog(u8"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", u8"", 0, 6);
progressDialog.setWindowTitle(u8"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
progressDialog.setWindowModality(Qt::WindowModal);
progressDialog.setAutoClose(true);
progressDialog.setValue(0);
progressDialog.setMaximum(6);
progressDialog.setMinimum(0);
progressDialog.show();
2025-05-22 03:01:52 +00:00
qDebug() << u8"<EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
// <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
QString tarfilename = getFileNameWidthoutExtend(inTarFilepath);
// step 1. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD>
GF3TargzFilenameClass tarnameclss=getFilename(tarfilename);
QString productionname = tarnameclss.getProductName();
QString workfolderpath = JoinPath(outworkspacefolderpath, productionname); // <20><><EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD>
createNewFolerPath(workfolderpath, true);
qDebug() << u8"step 1. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD> ok";
2025-05-22 09:28:20 +00:00
progressDialog.setValue(1);
2025-05-22 03:01:52 +00:00
// step 2.<2E><>ѹ<EFBFBD>ļ<EFBFBD>
QString unarchiverFolderPath = JoinPath(workfolderpath, u8"unarchiver");
createNewFolerPath(unarchiverFolderPath, true);
unTarfile(inTarFilepath, unarchiverFolderPath);
qDebug() << u8"step 2.<2E><>ѹ<EFBFBD>ļ<EFBFBD> ok";
2025-05-22 09:28:20 +00:00
progressDialog.setValue(2);
2025-05-22 03:01:52 +00:00
// <20>ڽ<EFBFBD>ѹ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC>в<EFBFBD><D0B2><EFBFBD>meta.xml<6D>ļ<EFBFBD>
QFileInfoList metalist = findFilePath(unarchiverFolderPath, u8"*.meta.xml");
if (metalist.count() !=1) {
qWarning() << u8"Ŀ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD>з<EFBFBD><EFBFBD><EFBFBD><EFBFBD>˶<EFBFBD><EFBFBD><EFBFBD>meta.xml,<2C><><EFBFBD><EFBFBD><EFBFBD>Ϲ<EFBFBD><CFB9><EFBFBD>";
QMessageBox::warning(nullptr, u8"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", QString(u8"%1:%2").arg(tarfilename).arg(u8"Ŀ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD>з<EFBFBD><EFBFBD><EFBFBD><EFBFBD>˶<EFBFBD><EFBFBD><EFBFBD>meta.xml,<2C><><EFBFBD><EFBFBD><EFBFBD>Ϲ<EFBFBD><CFB9><EFBFBD>"));
return ErrorCode::METAXMLFOUNDERROR;
}
else {}
QString metaxmlpath = metalist[0].canonicalFilePath();
// step 3.<2E>ļ<EFBFBD>ת<EFBFBD><D7AA>Ϊͨ<CEAA><CDA8>L1A<31>ļ<EFBFBD>
QString L1AFolder = JoinPath(workfolderpath, u8"L1AFolder");
createNewFolerPath(L1AFolder);
ImportGF3L1AProcess(metaxmlpath, L1AFolder);
qDebug() << u8"step 3.<2E>ļ<EFBFBD>ת<EFBFBD><D7AA>Ϊͨ<CEAA><CDA8>L1A<31>ļ<EFBFBD> ok";
2025-05-22 09:28:20 +00:00
progressDialog.setValue(3);
2025-05-22 03:01:52 +00:00
// step 4. <20><><EFBFBD><EFBFBD>תamp
QFileInfoList xmlfilelist = findFilePath(L1AFolder, u8"*.xml");
if (xmlfilelist.count() == 0) {
qWarning() << u8"Ŀ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>з<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>L1A<EFBFBD><EFBFBD><EFBFBD><EFBFBD> xml,<2C><><EFBFBD><EFBFBD><EFBFBD>Ϲ<EFBFBD><CFB9><EFBFBD>";
QMessageBox::warning(nullptr, u8"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", QString(u8"%1:%2").arg(tarfilename).arg(u8"Ŀ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>з<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>L1A<EFBFBD><EFBFBD><EFBFBD><EFBFBD> xml,<2C><><EFBFBD><EFBFBD><EFBFBD>Ϲ<EFBFBD><CFB9><EFBFBD>"));
return ErrorCode::METAXMLFOUNDERROR;
}
QString outampfolder = JoinPath(workfolderpath, u8"ampRaster");
createNewFolerPath(outampfolder);
for (long i = 0; i < xmlfilelist.count(); i++) {
QString filename = getFileNameWidthoutExtend(xmlfilelist[i].canonicalFilePath());
QString l2bfilename = filename + "_amp";
QString folderpath = getParantFromPath(xmlfilelist[i].canonicalFilePath());
SARSimulationImageL1Dataset slcl1(RasterLevel::RasterSLC);
slcl1.Open(folderpath, filename);
SARSimulationImageL1Dataset l1B(RasterLevel::RasterL1B);
2025-05-22 09:28:20 +00:00
l1B.OpenOrNew(outampfolder, l2bfilename, slcl1.getrowCount(), slcl1.getcolCount());
2025-05-22 03:01:52 +00:00
QString srcxmlpath = slcl1.getxmlFilePath();
QString tarxmlpath = l1B.getxmlFilePath();
copyAndReplaceFile(srcxmlpath, tarxmlpath);
l1B.loadFromXml();
QString imgfilepath = slcl1.getImageRasterPath();
Complex2AmpRaster(imgfilepath, l1B.getImageRasterPath()); // ת<><D7AA><EFBFBD><EFBFBD>
}
2025-05-22 09:28:20 +00:00
progressDialog.setValue(4);
2025-05-22 03:01:52 +00:00
// step 5. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ұ<EFBFBD>
QString L1AXmlPath = xmlfilelist[0].canonicalFilePath();
QString looktablefolderpath = JoinPath(workfolderpath, u8"looktableRaster");
2025-05-22 09:28:20 +00:00
createNewFolerPath(looktablefolderpath);
2025-05-22 03:01:52 +00:00
if (GF3RDProcess(L1AXmlPath, inDEMPath, looktablefolderpath, pixelresultionDegreee, pixelresultionDegreee) == SUCCESS) {
qDebug()<<(u8"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɳɹ<EFBFBD>");
}
else {
qDebug() << (u8"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD>");
}
2025-05-22 09:28:20 +00:00
progressDialog.setValue(5);
2025-05-22 03:01:52 +00:00
qDebug() << u8"step 4. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ұ<EFBFBD> ok";
// step 6. Ӱ<><D3B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2025-05-22 09:28:20 +00:00
QFileInfoList looktableRasterPathList = findFilePath(looktablefolderpath, u8"*_looktable.tif");
2025-05-22 03:01:52 +00:00
if (looktableRasterPathList.count() != 1) {
qWarning() << u8"Ŀ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD>з<EFBFBD><EFBFBD><EFBFBD><EFBFBD>˶<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ұ<EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD>Ϲ<EFBFBD><CFB9><EFBFBD>";
QMessageBox::warning(nullptr, u8"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", QString(u8"%1:%2").arg(tarfilename).arg(u8"Ŀ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD>з<EFBFBD><EFBFBD><EFBFBD><EFBFBD>˶<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ұ<EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD>Ϲ<EFBFBD><CFB9><EFBFBD>"));
return ErrorCode::METAXMLFOUNDERROR;
}
// step 6.1 Ӱ<><D3B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2025-05-22 09:28:20 +00:00
QFileInfoList looktableAngleRasterPathList = findFilePath(looktablefolderpath, u8"*_localAngle.tif");
2025-05-22 03:01:52 +00:00
if (looktableAngleRasterPathList.count() != 1) {
qWarning() << u8"Ŀ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD>ֻ<EFBFBD><EFBFBD>1<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD>Ϲ<EFBFBD><CFB9><EFBFBD>";
QMessageBox::warning(nullptr, u8"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", QString(u8"%1:%2").arg(tarfilename).arg(u8"Ŀ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD>з<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD>Ϲ<EFBFBD><CFB9><EFBFBD>"));
return ErrorCode::METAXMLFOUNDERROR;
}
QString lookincidenceAnglePath = looktableAngleRasterPathList[0].canonicalFilePath();
QString looktableRasterPath = looktableRasterPathList[0].canonicalFilePath();
QString outworkpath = JoinPath(workfolderpath, u8"orth");
2025-05-22 09:28:20 +00:00
createNewFolerPath(outworkpath, true);
2025-05-22 03:01:52 +00:00
QFileInfoList l2filelist = findFilePath(outampfolder,u8"*.xml");
for (long i = 0; i < l2filelist.count(); i++) {
QString inl2filepath = l2filelist[i].canonicalFilePath();
SARSimulationImageL1Dataset l1B(RasterLevel::RasterL1B);
l1B.Open(inl2filepath);
QString inRaster = l1B.getImageRasterPath();
2025-05-22 09:28:20 +00:00
QString outname = getFileNameWidthoutExtend(inRaster) + "_orth.tif";
2025-05-22 03:01:52 +00:00
QString outstringpath = JoinPath(outworkpath, outname);
2025-05-22 09:28:20 +00:00
if (GF3OrthSLC(inRaster, looktableRasterPath, outstringpath) == SUCCESS) {
2025-05-22 03:01:52 +00:00
qDebug() << (u8"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɳɹ<EFBFBD>");
}
else {
qDebug() << (u8"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD>");
}
2025-05-22 09:28:20 +00:00
qDebug() << u8"step 5. <20><><EFBFBD><EFBFBD>Ӱ<EFBFBD><D3B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ok";
// step 6.2 <20><><EFBFBD><EFBFBD>HH2VV
POLARTYPEENUM poltype = getDatasetGF3FilePolsarType(outname);
if (poltype == POLARHH && excutehh2vv) {
qDebug() << u8"HH2VV<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:"<< outstringpath;
QString intempHH2VV = JoinPath(outworkpath, getFileNameWidthoutExtend(outstringpath) + "_HH2VV_dB.tif");
GF3_Sigma0_HH2VV(outstringpath, looktableRasterPath,intempHH2VV);
}
else {
// <20><>ampת<70><D7AA>Ϊsigma0
QString intempHH2VV = JoinPath(outworkpath, getFileNameWidthoutExtend(outstringpath) + "_HH2VV_dB.tif");
amp2dBRaster(outstringpath, intempHH2VV);
2025-05-22 03:01:52 +00:00
2025-05-22 09:28:20 +00:00
//qDebug() << u8"HH2VV<56><56><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>";
}
qDebug() << u8"step 6. HH2VV<56><56><EFBFBD><EFBFBD> ok";
}
progressDialog.setValue(6);
2025-05-22 13:04:45 +00:00
progressDialog.close();
2025-05-22 03:01:52 +00:00
return ErrorCode::SUCCESS;
}