补充了完整的流程

Release
陈增辉 2024-11-25 14:26:46 +08:00
parent 81a8326364
commit 3d251929e4
20 changed files with 654 additions and 319 deletions

View File

@ -2,62 +2,67 @@
#include "SatelliteGF3xmlParser.h" #include "SatelliteGF3xmlParser.h"
#include <QRegularExpression> #include <QRegularExpression>
#include <QMessageBox> #include <QMessageBox>
#include "SatelliteOribtModel.h"
#include "boost/asio.hpp"
#include <boost/thread.hpp>
#include <thread>
#include <qprogressdialog.h>
ErrorCode GF3CalibrationRaster(QString inRasterPath, QString outRasterPath, double Qualifyvalue, double calibrationConst) ErrorCode GF3CalibrationRaster(QString inRasterPath, QString outRasterPath, double Qualifyvalue, double calibrationConst)
{ {
gdalImage imgraster(inRasterPath.toUtf8().constData()); gdalImage imgraster(inRasterPath.toUtf8().constData());
if (!isExists(outRasterPath)) { if (!isExists(outRasterPath)) {
gdalImageComplex outraster = CreategdalImageComplex(outRasterPath, imgraster.height, imgraster.width, 1, imgraster.gt, imgraster.projection, false, true); gdalImageComplex outraster = CreategdalImageComplex(outRasterPath, imgraster.height, imgraster.width, 1, imgraster.gt, imgraster.projection, false, true);
} }
gdalImageComplex outraster(outRasterPath); gdalImageComplex outraster(outRasterPath);
long blocklines = Memory1GB * 2 /8/ imgraster.width; long blocklines = Memory1GB * 2 / 8 / imgraster.width;
blocklines = blocklines < 100 ? 100 : blocklines; blocklines = blocklines < 100 ? 100 : blocklines;
Eigen::MatrixXd imgArrb1 = Eigen::MatrixXd::Zero(blocklines, imgraster.width); Eigen::MatrixXd imgArrb1 = Eigen::MatrixXd::Zero(blocklines, imgraster.width);
Eigen::MatrixXd imgArrb2 = Eigen::MatrixXd::Zero(blocklines, imgraster.width); Eigen::MatrixXd imgArrb2 = Eigen::MatrixXd::Zero(blocklines, imgraster.width);
Eigen::MatrixXcd imgArr = Eigen::MatrixXcd::Zero(blocklines, imgraster.width); Eigen::MatrixXcd imgArr = Eigen::MatrixXcd::Zero(blocklines, imgraster.width);
double quayCoff = Qualifyvalue * 1.0 / 32767; double quayCoff = Qualifyvalue * 1.0 / 32767;
double caliCoff = std::pow(10.0, (calibrationConst * 1.0 / 20)); double caliCoff = std::pow(10.0, (calibrationConst * 1.0 / 20));
qDebug() << "定标系数:\t" << quayCoff / caliCoff; qDebug() << "定标系数:\t" << quayCoff / caliCoff;
long startrow = 0; long startrow = 0;
for (startrow = 0; startrow < imgraster.height; startrow = startrow + blocklines) { for (startrow = 0; startrow < imgraster.height; startrow = startrow + blocklines) {
imgArrb1 = imgraster.getData(startrow, 0, blocklines, imgraster.width, 1); imgArrb1 = imgraster.getData(startrow, 0, blocklines, imgraster.width, 1);
imgArrb2 = imgraster.getData(startrow, 0, blocklines, imgraster.width, 2); imgArrb2 = imgraster.getData(startrow, 0, blocklines, imgraster.width, 2);
imgArr = outraster.getDataComplex(startrow, 0, blocklines, outraster.width, 1); imgArr = outraster.getDataComplex(startrow, 0, blocklines, outraster.width, 1);
imgArr.real() = imgArrb1.array() * quayCoff / caliCoff; imgArr.real() = imgArrb1.array() * quayCoff / caliCoff;
imgArr.imag() = imgArrb2.array() * quayCoff / caliCoff; imgArr.imag() = imgArrb2.array() * quayCoff / caliCoff;
outraster.saveImage(imgArr, startrow, 0, 1); outraster.saveImage(imgArr, startrow, 0, 1);
} }
qDebug() << "影像写入到:" << outRasterPath; qDebug() << "影像写入到:" << outRasterPath;
return ErrorCode::SUCCESS; return ErrorCode::SUCCESS;
} }
ErrorCode ImportGF3L1ARasterToWorkspace(QString inMetaxmlPath, QString inRasterPath, QString outWorkDirPath, POLARTYPEENUM polsartype) ErrorCode ImportGF3L1ARasterToWorkspace(QString inMetaxmlPath, QString inRasterPath, QString outWorkDirPath, POLARTYPEENUM polsartype)
{ {
SatelliteGF3xmlParser gf3xml; SatelliteGF3xmlParser gf3xml;
gf3xml.loadFile(inMetaxmlPath); gf3xml.loadFile(inMetaxmlPath);
QString filename = getFileNameWidthoutExtend(inRasterPath); QString filename = getFileNameWidthoutExtend(inRasterPath);
SARSimulationImageL1Dataset l1dataset; SARSimulationImageL1Dataset l1dataset;
l1dataset.OpenOrNew(outWorkDirPath, filename,gf3xml.height,gf3xml.width); l1dataset.OpenOrNew(outWorkDirPath, filename, gf3xml.height, gf3xml.width);
l1dataset.setSateAntPos(SatellitePos2SatelliteAntPos(gf3xml.antposs)); l1dataset.setSateAntPos(SatellitePos2SatelliteAntPos(gf3xml.antposs));
l1dataset.setCenterFreq(gf3xml.RadarCenterFrequency); l1dataset.setCenterFreq(gf3xml.RadarCenterFrequency);
l1dataset.setcolCount(gf3xml.width); l1dataset.setcolCount(gf3xml.width);
l1dataset.setrowCount(gf3xml.height); l1dataset.setrowCount(gf3xml.height);
l1dataset.setNearRange(gf3xml.nearRange); l1dataset.setNearRange(gf3xml.nearRange);
l1dataset.setRefRange(gf3xml.refRange); l1dataset.setRefRange(gf3xml.refRange);
l1dataset.setFs(gf3xml.eqvFs); l1dataset.setFs(gf3xml.eqvFs);
l1dataset.setPRF(gf3xml.eqvPRF); l1dataset.setPRF(gf3xml.eqvPRF);
l1dataset.setCenterAngle((gf3xml.incidenceAngleNearRange + gf3xml.incidenceAngleFarRange) / 2.0); // 入射角 l1dataset.setCenterAngle((gf3xml.incidenceAngleNearRange + gf3xml.incidenceAngleFarRange) / 2.0); // 入射角
l1dataset.setDopplerParametersReferenceTime(gf3xml.DopplerParametersReferenceTime); l1dataset.setDopplerParametersReferenceTime(gf3xml.DopplerParametersReferenceTime);
l1dataset.setTotalProcessedAzimuthBandWidth(gf3xml.TotalProcessedAzimuthBandWidth); l1dataset.setTotalProcessedAzimuthBandWidth(gf3xml.TotalProcessedAzimuthBandWidth);
l1dataset.setIncidenceAngleFarRange(gf3xml.incidenceAngleFarRange); l1dataset.setIncidenceAngleFarRange(gf3xml.incidenceAngleFarRange);
l1dataset.setIncidenceAngleNearRangeet(gf3xml.incidenceAngleNearRange); l1dataset.setIncidenceAngleNearRangeet(gf3xml.incidenceAngleNearRange);
l1dataset.setDopplerParams(gf3xml.d0, gf3xml.d1, gf3xml.d2, gf3xml.d3, gf3xml.d4); 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.setDopplerCenterCoff(gf3xml.r0, gf3xml.r1, gf3xml.r2, gf3xml.r3, gf3xml.r4);
l1dataset.setLatitudeCenter(gf3xml.latitude_center); l1dataset.setLatitudeCenter(gf3xml.latitude_center);
l1dataset.setLongitudeCenter(gf3xml.longitude_center); l1dataset.setLongitudeCenter(gf3xml.longitude_center);
l1dataset.setLatitudeTopLeft(gf3xml.latitude_topLeft); l1dataset.setLatitudeTopLeft(gf3xml.latitude_topLeft);
@ -68,289 +73,537 @@ ErrorCode ImportGF3L1ARasterToWorkspace(QString inMetaxmlPath, QString inRasterP
l1dataset.setLongitudeBottomLeft(gf3xml.longitude_bottomLeft); l1dataset.setLongitudeBottomLeft(gf3xml.longitude_bottomLeft);
l1dataset.setLatitudeBottomRight(gf3xml.latitude_bottomRight); l1dataset.setLatitudeBottomRight(gf3xml.latitude_bottomRight);
l1dataset.setLongitudeBottomRight(gf3xml.longitude_bottomRight); l1dataset.setLongitudeBottomRight(gf3xml.longitude_bottomRight);
l1dataset.setStartImageTime(gf3xml.start); l1dataset.setStartImageTime(gf3xml.start);
l1dataset.setEndImageTime(gf3xml.end); l1dataset.setEndImageTime(gf3xml.end);
l1dataset.saveToXml(); l1dataset.saveToXml();
QString outRasterpath = l1dataset.getImageRasterPath(); QString outRasterpath = l1dataset.getImageRasterPath();
ErrorCode errorcode = ErrorCode::SUCCESS; ErrorCode errorcode = ErrorCode::SUCCESS;
qDebug() << "导入数据:\t"<<inRasterPath; qDebug() << "导入数据:\t" << inRasterPath;
switch (polsartype) switch (polsartype)
{ {
case POLARHH: case POLARHH:
qDebug() << "极化HH"; qDebug() << "极化HH";
errorcode=GF3CalibrationRaster(inRasterPath, outRasterpath, gf3xml.HH_QualifyValue, gf3xml.HH_CalibrationConst); errorcode = GF3CalibrationRaster(inRasterPath, outRasterpath, gf3xml.HH_QualifyValue, gf3xml.HH_CalibrationConst);
break; break;
case POLARHV: case POLARHV:
qDebug() << "极化HH"; qDebug() << "极化HH";
errorcode = GF3CalibrationRaster(inRasterPath, outRasterpath, gf3xml.HV_QualifyValue, gf3xml.HV_CalibrationConst); errorcode = GF3CalibrationRaster(inRasterPath, outRasterpath, gf3xml.HV_QualifyValue, gf3xml.HV_CalibrationConst);
break; break;
case POLARVH: case POLARVH:
qDebug() << "极化VH"; qDebug() << "极化VH";
errorcode = GF3CalibrationRaster(inRasterPath, outRasterpath, gf3xml.VH_QualifyValue, gf3xml.VH_CalibrationConst); errorcode = GF3CalibrationRaster(inRasterPath, outRasterpath, gf3xml.VH_QualifyValue, gf3xml.VH_CalibrationConst);
break; break;
case POLARVV: case POLARVV:
qDebug() << "极化VV"; qDebug() << "极化VV";
errorcode = GF3CalibrationRaster(inRasterPath, outRasterpath, gf3xml.VV_QualifyValue, gf3xml.VV_CalibrationConst); errorcode = GF3CalibrationRaster(inRasterPath, outRasterpath, gf3xml.VV_QualifyValue, gf3xml.VV_CalibrationConst);
break; break;
default: default:
break; break;
} }
qDebug() << "导入数据状态:\t" << QString::fromStdString(errorCode2errInfo(errorcode)); qDebug() << "导入数据状态:\t" << QString::fromStdString(errorCode2errInfo(errorcode));
return errorcode; return errorcode;
} }
QVector<QString> SearchGF3DataTiff(QString inMetaxmlPath) QVector<QString> SearchGF3DataTiff(QString inMetaxmlPath)
{ {
// 指定路径 // 指定路径
QString xmlpath = inMetaxmlPath; // 替换为你的实际路径 QString xmlpath = inMetaxmlPath; // 替换为你的实际路径
QString absPath = QFileInfo(xmlpath).absolutePath(); QString absPath = QFileInfo(xmlpath).absolutePath();
// 获取路径所在的目录 // 获取路径所在的目录
QDir directory(absPath); QDir directory(absPath);
if (!directory.exists()) { if (!directory.exists()) {
qDebug() << "Directory does not exist:" << directory.absolutePath(); qDebug() << "Directory does not exist:" << directory.absolutePath();
return QVector<QString>(0); return QVector<QString>(0);
} }
// 设置过滤器以仅列出 .tif 文件 // 设置过滤器以仅列出 .tif 文件
QStringList filters; QStringList filters;
filters << "*.tif" << "*.TIF" << "*.tiff" << "*.TIFF"; filters << "*.tif" << "*.TIF" << "*.tiff" << "*.TIFF";
QStringList files = directory.entryList(filters, QDir::Files); QStringList files = directory.entryList(filters, QDir::Files);
qDebug() << "TIFF Files in the directory" << directory.absolutePath() << ":"; qDebug() << "TIFF Files in the directory" << directory.absolutePath() << ":";
QVector<QString> filepath(0); QVector<QString> filepath(0);
for (long i = 0; i < files.count(); i++) { for (long i = 0; i < files.count(); i++) {
filepath.append(JoinPath(absPath, files[i])); filepath.append(JoinPath(absPath, files[i]));
} }
return filepath; return filepath;
} }
POLARTYPEENUM getDatasetGF3FilePolsarType(QString fileName) POLARTYPEENUM getDatasetGF3FilePolsarType(QString fileName)
{ {
// 提取极化情况 // 提取极化情况
QRegularExpression re("_([A-Z]{2})_"); QRegularExpression re("_([A-Z]{2})_");
QRegularExpressionMatch match = re.match(fileName); QRegularExpressionMatch match = re.match(fileName);
QString polarization = ""; QString polarization = "";
if (match.hasMatch()) { if (match.hasMatch()) {
polarization = match.captured(1); polarization = match.captured(1);
polarization = polarization.toLower().replace("_", ""); polarization = polarization.toLower().replace("_", "");
qDebug() << "Polarization extracted:" << polarization; qDebug() << "Polarization extracted:" << polarization;
if (polarization == "hh") { if (polarization == "hh") {
return POLARTYPEENUM::POLARHH; return POLARTYPEENUM::POLARHH;
} }
else if (polarization == "hv") { else if (polarization == "hv") {
return POLARTYPEENUM::POLARHV; return POLARTYPEENUM::POLARHV;
} }
else if (polarization == "vh") { else if (polarization == "vh") {
return POLARTYPEENUM::POLARVH; return POLARTYPEENUM::POLARVH;
} }
else if (polarization == "vv") { else if (polarization == "vv") {
return POLARTYPEENUM::POLARVV; return POLARTYPEENUM::POLARVV;
} }
else { else {
return POLARTYPEENUM::POLARUNKOWN; return POLARTYPEENUM::POLARUNKOWN;
} }
} }
else { else {
qDebug() << "No polarization found in the path."; qDebug() << "No polarization found in the path.";
return POLARTYPEENUM::POLARUNKOWN; return POLARTYPEENUM::POLARUNKOWN;
} }
return POLARTYPEENUM::POLARUNKOWN; return POLARTYPEENUM::POLARUNKOWN;
} }
ErrorCode ImportGF3L1AProcess(QString inMetaxmlPath, QString outWorkDirPath) ErrorCode ImportGF3L1AProcess(QString inMetaxmlPath, QString outWorkDirPath)
{ {
QVector<QString> tiffpaths = SearchGF3DataTiff(inMetaxmlPath); QVector<QString> tiffpaths = SearchGF3DataTiff(inMetaxmlPath);
ErrorCode errorcode = ErrorCode::SUCCESS; ErrorCode errorcode = ErrorCode::SUCCESS;
for (long i = 0; i < tiffpaths.count(); i++) { for (long i = 0; i < tiffpaths.count(); i++) {
QString tiffpath = tiffpaths[i]; QString tiffpath = tiffpaths[i];
QString filenamewithoutextern = getFileNameWidthoutExtend(tiffpath); QString filenamewithoutextern = getFileNameWidthoutExtend(tiffpath);
QString filename = getFileNameFromPath(tiffpath); QString filename = getFileNameFromPath(tiffpath);
POLARTYPEENUM poltype = getDatasetGF3FilePolsarType(filename); POLARTYPEENUM poltype = getDatasetGF3FilePolsarType(filename);
switch (poltype) switch (poltype)
{ {
case POLARHH: case POLARHH:
errorcode=ImportGF3L1ARasterToWorkspace(inMetaxmlPath, tiffpath, outWorkDirPath, POLARTYPEENUM::POLARHH); errorcode = ImportGF3L1ARasterToWorkspace(inMetaxmlPath, tiffpath, outWorkDirPath, POLARTYPEENUM::POLARHH);
break; break;
case POLARHV: case POLARHV:
errorcode=ImportGF3L1ARasterToWorkspace(inMetaxmlPath, tiffpath, outWorkDirPath, POLARTYPEENUM::POLARHV); errorcode = ImportGF3L1ARasterToWorkspace(inMetaxmlPath, tiffpath, outWorkDirPath, POLARTYPEENUM::POLARHV);
break; break;
case POLARVH: case POLARVH:
errorcode=ImportGF3L1ARasterToWorkspace(inMetaxmlPath, tiffpath, outWorkDirPath, POLARTYPEENUM::POLARVH); errorcode = ImportGF3L1ARasterToWorkspace(inMetaxmlPath, tiffpath, outWorkDirPath, POLARTYPEENUM::POLARVH);
break; break;
case POLARVV: case POLARVV:
errorcode=ImportGF3L1ARasterToWorkspace(inMetaxmlPath, tiffpath, outWorkDirPath, POLARTYPEENUM::POLARVV); errorcode = ImportGF3L1ARasterToWorkspace(inMetaxmlPath, tiffpath, outWorkDirPath, POLARTYPEENUM::POLARVV);
break; break;
case POLARUNKOWN: case POLARUNKOWN:
break; break;
default: default:
break; break;
} }
if (errorcode == ErrorCode::SUCCESS) { if (errorcode == ErrorCode::SUCCESS) {
return errorcode; return errorcode;
} }
else { else {
QMessageBox::warning(nullptr, u8"错误", u8"数据导入错误"); QMessageBox::warning(nullptr, u8"错误", u8"数据导入错误");
break; break;
} }
} }
return errorcode; return errorcode;
} }
ErrorCode Complex2AmpRaster(QString inComplexPath, QString outRasterPath) ErrorCode Complex2AmpRaster(QString inComplexPath, QString outRasterPath)
{ {
gdalImageComplex inimg(inComplexPath); gdalImageComplex inimg(inComplexPath);
gdalImage ampimg= CreategdalImage(outRasterPath, inimg.height, inimg.width, inimg.band_num, inimg.gt, inimg.projection, true, true); gdalImage ampimg = CreategdalImage(outRasterPath, inimg.height, inimg.width, inimg.band_num, inimg.gt, inimg.projection, true, true);
long blocklines = Memory1GB * 2 / 8 / inimg.width; long blocklines = Memory1GB * 2 / 8 / inimg.width;
blocklines = blocklines < 100 ? 100 : blocklines; blocklines = blocklines < 100 ? 100 : blocklines;
Eigen::MatrixXd imgArrb1 = Eigen::MatrixXd::Zero(blocklines, ampimg.width); Eigen::MatrixXd imgArrb1 = Eigen::MatrixXd::Zero(blocklines, ampimg.width);
Eigen::MatrixXcd imgArr = Eigen::MatrixXcd::Zero(blocklines, inimg.width); Eigen::MatrixXcd imgArr = Eigen::MatrixXcd::Zero(blocklines, inimg.width);
long startrow = 0; long startrow = 0;
for (startrow = 0; startrow < inimg.height; startrow = startrow + blocklines) { for (startrow = 0; startrow < inimg.height; startrow = startrow + blocklines) {
imgArrb1 = ampimg.getData(startrow, 0, blocklines, inimg.width, 1); imgArrb1 = ampimg.getData(startrow, 0, blocklines, inimg.width, 1);
imgArr = inimg.getData(startrow, 0, blocklines, inimg.width, 2); imgArr = inimg.getData(startrow, 0, blocklines, inimg.width, 2);
imgArrb1 = imgArr.array().abs(); imgArrb1 = imgArr.array().abs();
ampimg.saveImage(imgArrb1, startrow, 0, 1); ampimg.saveImage(imgArrb1, startrow, 0, 1);
} }
qDebug() << "影像写入到:" << outRasterPath; qDebug() << "影像写入到:" << outRasterPath;
return ErrorCode::SUCCESS; return ErrorCode::SUCCESS;
} }
ErrorCode Complex2PhaseRaster(QString inComplexPath, QString outRasterPath) ErrorCode Complex2PhaseRaster(QString inComplexPath, QString outRasterPath)
{ {
gdalImageComplex inimg(inComplexPath); gdalImageComplex inimg(inComplexPath);
gdalImage ampimg = CreategdalImage(outRasterPath, inimg.height, inimg.width, inimg.band_num, inimg.gt, inimg.projection, true, true); gdalImage ampimg = CreategdalImage(outRasterPath, inimg.height, inimg.width, inimg.band_num, inimg.gt, inimg.projection, true, true);
long blocklines = Memory1GB * 2 / 8 / inimg.width; long blocklines = Memory1GB * 2 / 8 / inimg.width;
blocklines = blocklines < 100 ? 100 : blocklines; blocklines = blocklines < 100 ? 100 : blocklines;
Eigen::MatrixXd imgArrb1 = Eigen::MatrixXd::Zero(blocklines, ampimg.width); Eigen::MatrixXd imgArrb1 = Eigen::MatrixXd::Zero(blocklines, ampimg.width);
Eigen::MatrixXcd imgArr = Eigen::MatrixXcd::Zero(blocklines, inimg.width); Eigen::MatrixXcd imgArr = Eigen::MatrixXcd::Zero(blocklines, inimg.width);
long startrow = 0; long startrow = 0;
for (startrow = 0; startrow < inimg.height; startrow = startrow + blocklines) { for (startrow = 0; startrow < inimg.height; startrow = startrow + blocklines) {
imgArrb1 = ampimg.getData(startrow, 0, blocklines, inimg.width, 1); imgArrb1 = ampimg.getData(startrow, 0, blocklines, inimg.width, 1);
imgArr = inimg.getData(startrow, 0, blocklines, inimg.width, 2); imgArr = inimg.getData(startrow, 0, blocklines, inimg.width, 2);
imgArrb1 = imgArr.array().arg(); imgArrb1 = imgArr.array().arg();
ampimg.saveImage(imgArrb1, startrow, 0, 1); ampimg.saveImage(imgArrb1, startrow, 0, 1);
} }
qDebug() << "影像写入到:" << outRasterPath; qDebug() << "影像写入到:" << outRasterPath;
return ErrorCode::SUCCESS; return ErrorCode::SUCCESS;
} }
ErrorCode Complex2dBRaster(QString inComplexPath, QString outRasterPath) ErrorCode Complex2dBRaster(QString inComplexPath, QString outRasterPath)
{ {
gdalImageComplex inimg(inComplexPath); gdalImageComplex inimg(inComplexPath);
gdalImage ampimg = CreategdalImage(outRasterPath, inimg.height, inimg.width, inimg.band_num, inimg.gt, inimg.projection, true, true); gdalImage ampimg = CreategdalImage(outRasterPath, inimg.height, inimg.width, inimg.band_num, inimg.gt, inimg.projection, true, true);
long blocklines = Memory1GB * 2 / 8 / inimg.width; long blocklines = Memory1GB * 2 / 8 / inimg.width;
blocklines = blocklines < 100 ? 100 : blocklines; blocklines = blocklines < 100 ? 100 : blocklines;
Eigen::MatrixXd imgArrb1 = Eigen::MatrixXd::Zero(blocklines, ampimg.width); Eigen::MatrixXd imgArrb1 = Eigen::MatrixXd::Zero(blocklines, ampimg.width);
Eigen::MatrixXcd imgArr = Eigen::MatrixXcd::Zero(blocklines, inimg.width); Eigen::MatrixXcd imgArr = Eigen::MatrixXcd::Zero(blocklines, inimg.width);
long startrow = 0; long startrow = 0;
for (startrow = 0; startrow < inimg.height; startrow = startrow + blocklines) { for (startrow = 0; startrow < inimg.height; startrow = startrow + blocklines) {
imgArrb1 = ampimg.getData(startrow, 0, blocklines, inimg.width, 1); imgArrb1 = ampimg.getData(startrow, 0, blocklines, inimg.width, 1);
imgArr = inimg.getData(startrow, 0, blocklines, inimg.width, 2); imgArr = inimg.getData(startrow, 0, blocklines, inimg.width, 2);
imgArrb1 = imgArr.array().abs().log10()*20.0; imgArrb1 = imgArr.array().abs().log10() * 20.0;
ampimg.saveImage(imgArrb1, startrow, 0, 1); ampimg.saveImage(imgArrb1, startrow, 0, 1);
} }
qDebug() << "影像写入到:" << outRasterPath; qDebug() << "影像写入到:" << outRasterPath;
return ErrorCode::SUCCESS; return ErrorCode::SUCCESS;
} }
ErrorCode ResampleDEM(QString indemPath, QString outdemPath,double gridx,double gridy) ErrorCode ResampleDEM(QString indemPath, QString outdemPath, double gridx, double gridy)
{ {
double gridlat = gridy / 110000.0; double gridlat = gridy / 110000.0;
double gridlon = gridx / 100000.0; double gridlon = gridx / 100000.0;
long espgcode = GetEPSGFromRasterFile(indemPath.toUtf8().constData()); long espgcode = GetEPSGFromRasterFile(indemPath.toUtf8().constData());
if (espgcode == 4326) { if (espgcode == 4326) {
resampleRaster(indemPath.toUtf8().constData(), outdemPath.toUtf8().constData(), gridlon, gridlat); resampleRaster(indemPath.toUtf8().constData(), outdemPath.toUtf8().constData(), gridlon, gridlat);
return ErrorCode::SUCCESS; return ErrorCode::SUCCESS;
} }
else { else {
QMessageBox::warning(nullptr,u8"警告",u8"请输入WGS84坐标的DEM影像"); QMessageBox::warning(nullptr, u8"警告", u8"请输入WGS84坐标的DEM影像");
return ErrorCode::FAIL; return ErrorCode::FAIL;
} }
} }
ErrorCode GF3RDCreateLookTable(QString inxmlPath, QString indemPath,QString outworkdir, QString outlooktablePath)
ErrorCode RD_PSTN(double& refrange, double& lamda, double& timeR, double& R, double& tx, double& ty, double& tz, double& slopex, double& slopey, double& slopez, PolyfitSatelliteOribtModel& polyfitmodel, SatelliteOribtNode& node, double& d0, double& d1, double& d2, double& d3, double& d4)
{ {
QString indemfilename = getFileNameWidthoutExtend(indemPath); double dt = 1e-6;
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;
QString resampleDEMXYZPath = JoinPath(outworkdir, indemfilename + "_XYZ.tif"); for (int i = 0; i < 50; i++) {
QString resampleDEMSLOPEPath = JoinPath(outworkdir, indemfilename + "_slopevector.tif"); polyfitmodel.getSatelliteOribtNode(timeR, node, antfalg);
DEM2XYZRasterAndSlopRaster(indemPath, resampleDEMXYZPath, resampleDEMSLOPEPath); R1 = std::sqrt(std::pow(node.Px - tx, 2) + std::pow(node.Py - ty, 2) + std::pow(node.Pz - tz, 2));
dplerTheory1 = (-2 / lamda) * (((node.Px - tx) * (node.Vx + EARTHWE * ty) + (node.Py - ty) * (node.Vy - EARTHWE * tz) + (node.Pz - tz) * (node.Vz - 0)) / R1);
dplerR = (R1 - refrange) * 1e6 / LIGHTSPEED;
dplerNumber1 = d0 + dplerR * d1 + std::pow(dplerR, 2) * d2 + std::pow(dplerR, 3) * d3 + std::pow(dplerR, 4) * d4;
gdalImage demxyz(resampleDEMXYZPath);// X,Y,Z timeR2 = timeR + dt;
gdalImage demslope(resampleDEMSLOPEPath);// X,Y,Z polyfitmodel.getSatelliteOribtNode(timeR2, node, antfalg);
gdalImage rasterRC = CreategdalImage(outlooktablePath, demxyz.height, demxyz.width,2, demxyz.gt, demxyz.projection, true, true);// X,Y,Z R2 = std::sqrt(std::pow(node.Px - tx, 2) + std::pow(node.Py - ty, 2) + std::pow(node.Pz - tz, 2));
dplerTheory2 = (-2 / lamda) * (((node.Px - tx) * (node.Vx + EARTHWE * ty) + (node.Py - ty) * (node.Vy - EARTHWE * tz) + (node.Pz - tz) * (node.Vz - 0)) / R2);
dplerR = (R2 - refrange) * 1e6 / LIGHTSPEED;
dplerNumber2 = d0 + dplerR * d1 + std::pow(dplerR, 2) * d2 + std::pow(dplerR, 3) * d3 + std::pow(dplerR, 4) * d4;
SARSimulationImageL1Dataset l1dataset; inct = dt * (dplerTheory2 - dplerNumber1) / (dplerTheory1 - dplerTheory2);
l1dataset.Open(inxmlPath); if (std::abs(dplerTheory1 - dplerTheory2) < 1e-9 || std::abs(inct) < dt) {
// RD 相关参数 break;
QVector<double> dopplers = l1dataset.getDopplerParams(); }
double d0 = dopplers[0]; timeR = timeR - inct;
double d1 = dopplers[1]; }
double d2 = dopplers[2]; R = R1; // 斜距
double d3 = dopplers[3]; return ErrorCode::SUCCESS;
double d4 = dopplers[4];
double fs = l1dataset.getFs();
double prf = (l1dataset.getEndImageTime()-l1dataset.getStartImageTime())/(l1dataset.getrowCount()-1);
// 构建轨道模型
return ErrorCode::SUCCESS;
} }
ErrorCode GF3RDCreateLookTable(QString inxmlPath, QString indemPath, QString outworkdir, double gridx, double gridy) ErrorCode GF3RDCreateLookTable(QString inxmlPath, QString indemPath, QString outworkdir, QString outlooktablePath,QString outLocalIncidenceAnglePath,bool localincAngleFlag)
{ {
SARSimulationImageL1Dataset l1dataset; QString indemfilename = getFileNameWidthoutExtend(indemPath);
l1dataset.Open(inxmlPath);
DemBox box = l1dataset.getExtend(); QString resampleDEMXYZPath = JoinPath(outworkdir, indemfilename + "_XYZ.tif");
double dlon = 0.1*(box.max_lon - box.min_lon); QString resampleDEMSLOPEPath = JoinPath(outworkdir, indemfilename + "_slopevector.tif");
double dlat = 0.1 * (box.max_lat - box.min_lat); DEM2XYZRasterAndSlopRaster(indemPath, resampleDEMXYZPath, resampleDEMSLOPEPath);
double minlat = box.min_lat - dlat; gdalImage demxyz(resampleDEMXYZPath);// X,Y,Z
double minlon = box.min_lon - dlon; gdalImage demslope(resampleDEMSLOPEPath);// X,Y,Z
double maxlat = box.max_lat + dlat; gdalImage rasterRC = CreategdalImage(outlooktablePath, demxyz.height, demxyz.width, 2, demxyz.gt, demxyz.projection, true, true);// X,Y,Z
double maxlon = box.max_lon + dlon; gdalImage localincangleRaster;
if (localincAngleFlag) {
// 裁剪DEM localincangleRaster = CreategdalImage(outLocalIncidenceAnglePath, demxyz.height, demxyz.width, 2, demxyz.gt, demxyz.projection, true, true);// X,Y,Z
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");
resampleRaster(clipDEMPath.toUtf8().constData(), resampleDEMPath.toUtf8().constData(), gridx, gridy);
QString outlooktablePath= JoinPath(outworkdir, getFileNameWidthoutExtend(l1dataset.getxmlFilePath()) + "_looktable.tif"); SARSimulationImageL1Dataset l1dataset;
if (GF3RDCreateLookTable(inxmlPath, resampleDEMPath, outworkdir, outlooktablePath) != ErrorCode::SUCCESS) { l1dataset.Open(inxmlPath);
qDebug() << "查找表生成错误:\t"+ getFileNameWidthoutExtend(inxmlPath); // RD 相关参数
return ErrorCode::FAIL; QVector<double> dopplers = l1dataset.getDopplerParams(); // 多普勒参数
} double d0 = dopplers[0];
double d1 = dopplers[1];
double d2 = dopplers[2];
double d3 = dopplers[3];
double d4 = dopplers[4];
return ErrorCode::SUCCESS; double fs = l1dataset.getFs();// Fs采样
double prf = (l1dataset.getEndImageTime() - l1dataset.getStartImageTime()) / (l1dataset.getrowCount() - 1);// PRF 采样
double nearRange = l1dataset.getNearRange();
double imagestarttime = l1dataset.getStartImageTime();
double refrange = l1dataset.getRefRange();
double lamda = (LIGHTSPEED*1e-6)/ l1dataset.getCenterFreq();
// 构建轨道模型
PolyfitSatelliteOribtModel polyfitmodel;
QVector < SatelliteAntPos > antposes = l1dataset.getXmlSateAntPos();
polyfitmodel.setSatelliteOribtStartTime(imagestarttime);
for (long i = 0; i < antposes.size(); i++) {
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);
}
polyfitmodel.polyFit(3, false);
qDebug() << "-----------------------------------";
qDebug() << "satellite polyfit model params:\n";
qDebug() << polyfitmodel.getSatelliteOribtModelParamsString();
qDebug() << "-----------------------------------";
// 开始计算查找表
//1.计算分块
long cpucore_num = std::thread::hardware_concurrency();
long blockline = Memory1MB * 500 / 8 / cpucore_num / 4 / l1dataset.getcolCount();
blockline = blockline < 50 ? 50 : blockline;
//2.迭代计算
long colcount = l1dataset.getcolCount();
long rowcount = l1dataset.getrowCount();
long startRId = 0;
long processNumber = 0;
QProgressDialog progressDialog(u8"查找表生成中", u8"终止", 0, rowcount);
progressDialog.setWindowTitle(u8"查找表生成中");
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);
#pragma omp parallel for num_threads(cpucore_num-1)
for (startRId = 0; startRId < rowcount; startRId = startRId + blockline) {
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);
// 逐像素迭代计算
double timeR = 0;
long blockrows = sar_r.rows();
long blockcols = sar_r.cols();
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;
for (long i = 0; i < blockrows; i++) {
for (long j = 0; j < blockcols; j++) {
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 * prf;
sar_c(i, j) = ((R - nearRange) / 2 / LIGHTSPEED) * fs;
}
else {
sar_r(i, j) = -1;
sar_c(i, j) = -1;
}
}
}
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;
for (long i = 0; i < blockrows; i++) {
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));
localangle = std::acos(localangle / R/slopeR)*r2d;
Angle_Arr(i, j) = localangle;
}
}
}
// 保存结果
omp_set_lock(&lock);
rasterRC.saveImage(sar_r, startRId, 0, 1);
rasterRC.saveImage(sar_c, startRId, 0, 2);
if (localincAngleFlag) {
localincangleRaster.saveImage(Angle_Arr, startRId, 0, 1);
}
else {}
processNumber = processNumber + blockrows;
std::cout << "\rprocess bar:\t" << processNumber * 100.0 / rowcount << " % " << "\t\t\t";
if (progressDialog.maximum() <= processNumber) {
processNumber = progressDialog.maximum() - 1;
}
progressDialog.setValue(processNumber);
omp_unset_lock(&lock);
}
progressDialog.close();
return ErrorCode::SUCCESS;
}
ErrorCode GF3OrthSLC( QString inRasterPath, QString inlooktablePath, QString outRasterPath)
{
gdalImage slcRaster(inRasterPath);//
gdalImage looktableRaster(inlooktablePath);//
gdalImage outRaster(outRasterPath);//
if (outRaster.height != looktableRaster.height || outRaster.width != looktableRaster.width) {
qDebug() << "look table size is not same as outRaster size"<< looktableRaster.height <<"!="<<outRaster.height<<" "<<looktableRaster.width<<"!="<<outRaster.width;
return ErrorCode::FAIL;
}
Eigen::MatrixXd slcImg = slcRaster.getData(0, 0, slcRaster.height, slcRaster.width, 1);
Eigen::MatrixXd sar_r = looktableRaster.getData(0, 0, looktableRaster.height, looktableRaster.width, 1);
Eigen::MatrixXd sar_c = looktableRaster.getData(0, 0, looktableRaster.height, looktableRaster.width, 1);
Eigen::MatrixXd outImg = outRaster.getData(0, 0, outRaster.height, outRaster.width, 1);
long lookRows = sar_r.rows();
long lookCols = sar_r.cols();
long slcRows = slcImg.rows();
long slcCols = slcImg.cols();
long lastr = 0;
long nextr = 0;
long lastc = 0;
long nextc = 0;
double Bileanervalue = 0;
// 插值
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 };
QProgressDialog progressDialog(u8"正射图像生成中", u8"终止", 0, lookRows);
progressDialog.setWindowTitle(u8"正射图像生成中");
progressDialog.setWindowModality(Qt::WindowModal);
progressDialog.setAutoClose(true);
progressDialog.setValue(0);
progressDialog.setMaximum(lookRows);
progressDialog.setMinimum(0);
progressDialog.show();
for (long i = 0; i < lookRows; i++) {
for (long j = 0; j < lookCols; j++) {
p0 = {sar_r(i,j),sar_c(i,j),0};
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));
if (lastr < 0 || lastc < 0 || nextr >= slcRows || nextc >= slcCols) {
continue;
}
p11 = { sar_r(i,j),sar_c(i,j),0 };
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;
}
progressDialog.setValue(i);
}
outRaster.saveImage(outImg, 0, 0, 1);
progressDialog.close();
return ErrorCode::SUCCESS;
}
ErrorCode GF3RDProcess(QString inxmlPath, QString indemPath, QString outworkdir, double gridx, double gridy)
{
SARSimulationImageL1Dataset l1dataset;
l1dataset.Open(inxmlPath);
DemBox box = l1dataset.getExtend();
double dlon = 0.1 * (box.max_lon - box.min_lon);
double dlat = 0.1 * (box.max_lat - box.min_lat);
double minlat = box.min_lat - dlat;
double minlon = box.min_lon - dlon;
double maxlat = box.max_lat + dlat;
double maxlon = box.max_lon + dlon;
// 裁剪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");
resampleRaster(clipDEMPath.toUtf8().constData(), resampleDEMPath.toUtf8().constData(), gridx, gridy);
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");
if (GF3RDCreateLookTable(inxmlPath, resampleDEMPath, outworkdir, outlooktablePath, outlocalAnglePath,true) != ErrorCode::SUCCESS) {
qDebug() << "查找表生成错误:\t" + getFileNameWidthoutExtend(inxmlPath);
return ErrorCode::FAIL;
}
return ErrorCode::SUCCESS;
} }

View File

@ -1,10 +1,12 @@
#pragma once #pragma once
#include "../BaseLibraryCPP/BaseConstVariable.h" #include "BaseConstVariable.h"
#include "../BaseLibraryCPP/ImageOperatorBase.h" #include "ImageOperatorBase.h"
#include "../BaseLibraryCPP/LogInfoCls.h" #include "LogInfoCls.h"
#include "../BaseLibraryCPP/SARSimulationImageL1.h" #include "SARSimulationImageL1.h"
#include "SatelliteOribtModel.h"
#include <QString> #include <QString>
// 数据定标 // 数据定标
ErrorCode GF3CalibrationRaster(QString inRasterPath, QString outRasterPath, double Qualifyvalue, double calibrationConst); ErrorCode GF3CalibrationRaster(QString inRasterPath, QString outRasterPath, double Qualifyvalue, double calibrationConst);
@ -23,12 +25,17 @@ ErrorCode Complex2dBRaster(QString inComplexPath, QString outRasterPath);
ErrorCode ResampleDEM(QString indemPath, QString outdemPath, double gridx, double gridy); ErrorCode ResampleDEM(QString indemPath, QString outdemPath, double gridx, double gridy);
// RD Ëã·¨Àà
ErrorCode RD_PSTN(double& refrange,double& lamda, double& timeR, double& R, double& tx, double& ty, double& tz, double& slopex, double& slopey, double& slopez, PolyfitSatelliteOribtModel& polyfitmodel, SatelliteOribtNode& node,double& d0,double& d1, double& d2, double& d3, double& d4);
//创建查找表 //创建查找表
ErrorCode GF3RDCreateLookTable(QString inxmlPath, QString indemPath, QString outworkdir, QString outlooktablePath); ErrorCode GF3RDCreateLookTable(QString inxmlPath, QString indemPath, QString outworkdir, QString outlooktablePath, QString outLocalIncidenceAnglePath, bool localincAngleFlag=false);
ErrorCode GF3OrthSLC( QString inRasterPath, QString inlooktablePath, QString outRasterPath);
// 正射处理流程 // 正射处理流程
ErrorCode GF3RDCreateLookTable(QString inxmlPath, QString indemPath, QString outworkdir, double gridx, double gridy); ErrorCode GF3RDProcess(QString inxmlPath, QString indemPath, QString outworkdir, double gridx, double gridy);

View File

@ -1,8 +1,8 @@
#include "QComplex2AmpPhase.h" #include "QComplex2AmpPhase.h"
#include <QtWidgets> #include <QtWidgets>
#include <QFileDialog> #include <QFileDialog>
#include "../BaseLibraryCPP/FileOperator.h" #include "FileOperator.h"
#include "../BaseLibraryCPP/BaseTool.h" #include "BaseTool.h"
#include "GF3CalibrationAndGeocodingClass.h" #include "GF3CalibrationAndGeocodingClass.h"
QComplex2AmpPhase::QComplex2AmpPhase(QWidget *parent) QComplex2AmpPhase::QComplex2AmpPhase(QWidget *parent)

View File

@ -7,7 +7,7 @@
//#define EIGEN_VECTORIZE_SSE4_2 //#define EIGEN_VECTORIZE_SSE4_2
//#include <mkl.h> //#include <mkl.h>
// 本地方法 // 本地方法
#include "../BaseLibraryCPP/BaseTool.h" #include "BaseTool.h"
#include <iostream> #include <iostream>
#include <Eigen/Core> #include <Eigen/Core>
#include <Eigen/Dense> #include <Eigen/Dense>

View File

@ -3,7 +3,7 @@
#include <QFile> #include <QFile>
#include <QDomDocument> #include <QDomDocument>
#include <QDebug> #include <QDebug>
#include "../BaseLibraryCPP/SARSimulationImageL1.h" #include "SARSimulationImageL1.h"

View File

@ -15,5 +15,5 @@
#include <opencv2/core/eigen.hpp> #include <opencv2/core/eigen.hpp>
#include <opencv2/features2d.hpp> #include <opencv2/features2d.hpp>
#include <fstream> #include <fstream>
#include "../BaseLibraryCPP/BaseTool.h" #include "BaseTool.h"
#include"WGS84_J2000.h" #include"WGS84_J2000.h"

View File

@ -6,5 +6,5 @@
#include <Eigen/Core> #include <Eigen/Core>
#include <Eigen/Dense> #include <Eigen/Dense>
#include <time.h> #include <time.h>
#include "../BaseLibraryCPP/BaseTool.h" #include "BaseTool.h"
#include <string> #include <string>

View File

@ -14,7 +14,7 @@
#include <time.h> #include <time.h>
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
#include <omp.h> #include <omp.h>
#include "../BaseLibraryCPP/BaseTool.h" #include "BaseTool.h"
#include "simptsn.h" #include "simptsn.h"
#include "SateOrbit.h" #include "SateOrbit.h"
#include <gdal_utils.h> #include <gdal_utils.h>
@ -28,7 +28,7 @@
#include <vector> #include <vector>
#include <gdalgrid.h> #include <gdalgrid.h>
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
#include "../BaseLibraryCPP/ImageOperatorBase.h" #include "ImageOperatorBase.h"
#include <opencv2/opencv.hpp> #include <opencv2/opencv.hpp>
@ -88,7 +88,7 @@ PSTNAlgorithm::PSTNAlgorithm(QString infile_path)
getline(infile, buf); this->PRF = stod(buf); qDebug() << "PRF\t" << this->PRF ; getline(infile, buf); this->PRF = stod(buf); qDebug() << "PRF\t" << this->PRF ;
getline(infile, buf); this->refrange = stod(buf); qDebug() << "refrange\t" << this->refrange ; getline(infile, buf); this->refrange = stod(buf); qDebug() << "refrange\t" << this->refrange ;
getline(infile, buf); this->fs = stod(buf); qDebug() << "fs\t" << this->fs ; getline(infile, buf); this->fs = stod(buf); qDebug() << "fs\t" << this->fs ;
this->widthspace = (1 / this->fs) * LIGHTSPEED;
getline(infile, buf); this->doppler_paramenter_number = stoi(buf); qDebug() << "doppler_paramenter_number\t" << this->doppler_paramenter_number ; getline(infile, buf); this->doppler_paramenter_number = stoi(buf); qDebug() << "doppler_paramenter_number\t" << this->doppler_paramenter_number ;
// 读取多普勒系数 // 读取多普勒系数
@ -275,8 +275,8 @@ Eigen::MatrixX<double> PSTNAlgorithm::PSTN(Eigen::MatrixX<double> landpoints, do
satepoint = satestate(Eigen::all, { 0,1,2 }); satepoint = satestate(Eigen::all, { 0,1,2 });
sate_land = satepoint - landpoint; sate_land = satepoint - landpoint;
R1 = (sate_land.array().pow(2).array().rowwise().sum().array().sqrt())[0];; R1 = (sate_land.array().pow(2).array().rowwise().sum().array().sqrt())[0];;
//SARPoint(j, 2) = getIncAngle(satePoints, landPoint); SARPoint(j, 2) = getIncAngle(satePoints, landPoint);
//SARPoint(j, 2) = (R1 - this->R0 - (this->refrange - this->R0) / 3) / this->widthspace; SARPoint(j, 2) = (R1 - this->R0 - (this->refrange - this->R0) / 3) / this->widthspace;
SARPoint(j, 2) = getRangeColumn(R1, this->R0, this->fs, this->lamda);// (R1 - this->R0) / this->widthspace; // SARPoint(j, 2) = getRangeColumn(R1, this->R0, this->fs, this->lamda);// (R1 - this->R0) / this->widthspace; //
} }
//qDebug() <<"SARPoints(200, 0):\t" << SARPoint(200, 0) << "\t" << SARPoint(200, 1) << "\t" << SARPoint(200, 2) << "\t" ; //qDebug() <<"SARPoints(200, 0):\t" << SARPoint(200, 0) << "\t" << SARPoint(200, 1) << "\t" << SARPoint(200, 2) << "\t" ;
@ -1861,7 +1861,7 @@ int simProcess::correct_ati(QString orth_rc_path, QString dem_path, QString out_
gdalImage dem_img(dem_path); gdalImage dem_img(dem_path);
gdalImage orth_rc(orth_rc_path); gdalImage orth_rc(orth_rc_path);
//gdalImage ori_inclocal = CreategdalImage(out_inclocal_path, this->pstn.height, this->pstn.width, 1, orth_rc.gt, orth_rc.projection, false);// 注意这里保留仿真结果 gdalImage ori_inclocal = CreategdalImage(out_inclocal_path, this->pstn.height, this->pstn.width, 1, orth_rc.gt, orth_rc.projection, false);// 注意这里保留仿真结果
gdalImage ori_dem = CreategdalImage(out_dem_path, this->pstn.height, this->pstn.width, 1, orth_rc.gt, orth_rc.projection, false);// 注意这里保留仿真结果 gdalImage ori_dem = CreategdalImage(out_dem_path, this->pstn.height, this->pstn.width, 1, orth_rc.gt, orth_rc.projection, false);// 注意这里保留仿真结果
gdalImage ori_count = CreategdalImage(out_count_path, this->pstn.height, this->pstn.width, 1, orth_rc.gt, orth_rc.projection, false);// 注意这里保留仿真 gdalImage ori_count = CreategdalImage(out_count_path, this->pstn.height, this->pstn.width, 1, orth_rc.gt, orth_rc.projection, false);// 注意这里保留仿真
@ -1873,11 +1873,11 @@ int simProcess::correct_ati(QString orth_rc_path, QString dem_path, QString out_
int start_ids = 0; int start_ids = 0;
do { do {
Eigen::MatrixXd sar_dem = ori_dem.getData(start_ids, 0, line_invert, this->pstn.width, 1); Eigen::MatrixXd sar_dem = ori_dem.getData(start_ids, 0, line_invert, this->pstn.width, 1);
//Eigen::MatrixXd sar_inclocal = ori_inclocal.getData(start_ids, 0, line_invert, this->pstn.width, 1); Eigen::MatrixXd sar_inclocal = ori_inclocal.getData(start_ids, 0, line_invert, this->pstn.width, 1);
Eigen::MatrixXd sar_count = ori_count.getData(start_ids, 0, line_invert, this->pstn.width, 1); Eigen::MatrixXd sar_count = ori_count.getData(start_ids, 0, line_invert, this->pstn.width, 1);
sar_dem = sar_dem.array() * 0; sar_dem = sar_dem.array() * 0;
//sar_inclocal = sar_inclocal.array() * 0; sar_inclocal = sar_inclocal.array() * 0;
sar_count = sar_count.array() * 0; sar_count = sar_count.array() * 0;
ori_dem.saveImage(sar_dem, start_ids, 0, 1); ori_dem.saveImage(sar_dem, start_ids, 0, 1);
@ -1931,7 +1931,7 @@ int simProcess::correct_ati(QString orth_rc_path, QString dem_path, QString out_
sar_dem = ori_dem.getData(r_min, 0, r_max - r_min + 1, this->pstn.width, 1).cast<double>(); sar_dem = ori_dem.getData(r_min, 0, r_max - r_min + 1, this->pstn.width, 1).cast<double>();
sar_count = ori_count.getData(r_min, 0, r_max - r_min + 1, this->pstn.width, 1).cast<double>(); sar_count = ori_count.getData(r_min, 0, r_max - r_min + 1, this->pstn.width, 1).cast<double>();
//sar_inclocal = ori_inclocal.getData(r_min, 0, r_max - r_min + 1, this->pstn.width, 1).cast<double>(); // 列 sar_inclocal = ori_inclocal.getData(r_min, 0, r_max - r_min + 1, this->pstn.width, 1).cast<double>(); // 列
rowcount = dem.rows(); rowcount = dem.rows();
colcount = dem.cols(); colcount = dem.cols();
@ -1958,7 +1958,7 @@ int simProcess::correct_ati(QString orth_rc_path, QString dem_path, QString out_
r = sar_r(i, j); r = sar_r(i, j);
c = sar_c(i, j); c = sar_c(i, j);
if (r >= 0 && r < this->pstn.height && c >= 0 && c < this->pstn.width) { if (r >= 0 && r < this->pstn.height && c >= 0 && c < this->pstn.width) {
//sar_inclocal(r - r_min, c) += localincangle; sar_inclocal(r - r_min, c) += localincangle;
sar_count(r - r_min, c) += 1; sar_count(r - r_min, c) += 1;
sar_dem(r - r_min, c) += dem(i, j); sar_dem(r - r_min, c) += dem(i, j);
} }
@ -1981,11 +1981,11 @@ int simProcess::correct_ati(QString orth_rc_path, QString dem_path, QString out_
int start_ids = 0; int start_ids = 0;
do { do {
Eigen::MatrixXd sar_dem = ori_dem.getData(start_ids, 0, line_invert, this->pstn.width, 1); Eigen::MatrixXd sar_dem = ori_dem.getData(start_ids, 0, line_invert, this->pstn.width, 1);
//Eigen::MatrixXd sar_inclocal = ori_inclocal.getData(start_ids, 0, line_invert, this->pstn.width, 1); Eigen::MatrixXd sar_inclocal = ori_inclocal.getData(start_ids, 0, line_invert, this->pstn.width, 1);
Eigen::MatrixXd sar_count = ori_count.getData(start_ids, 0, line_invert, this->pstn.width, 1); Eigen::MatrixXd sar_count = ori_count.getData(start_ids, 0, line_invert, this->pstn.width, 1);
sar_dem = sar_dem.array() / sar_count.array(); sar_dem = sar_dem.array() / sar_count.array();
//sar_inclocal = sar_inclocal.array() / sar_count.array(); sar_inclocal = sar_inclocal.array() / sar_count.array();
ori_dem.saveImage(sar_dem, start_ids, 0, 1); ori_dem.saveImage(sar_dem, start_ids, 0, 1);
//ori_inclocal.saveImage(sar_inclocal, start_ids, 0, 1); //ori_inclocal.saveImage(sar_inclocal, start_ids, 0, 1);
@ -2611,17 +2611,17 @@ void simProcess::interpolation_GTC_sar_sigma(QString in_rc_wgs84_path, QString i
int start_ids = 0; int start_ids = 0;
do { do {
Eigen::MatrixXd sar_a = sar_img.getData(start_ids, 0, line_invert, sar_rc.width, 1); Eigen::MatrixXd sar_a = sar_img.getData(start_ids, 0, line_invert, sar_rc.width, 1);
//Eigen::MatrixXd sar_b = sar_img.getData(start_ids, 0, line_invert, sar_rc.width, 2); Eigen::MatrixXd sar_b = sar_img.getData(start_ids, 0, line_invert, sar_rc.width, 2);
sar_a = sar_a.array() * 0 - 9999; sar_a = sar_a.array() * 0 - 9999;
//sar_b = sar_b.array() * 0 - 9999; sar_b = sar_b.array() * 0 - 9999;
sar_img.saveImage(sar_a, start_ids, 0, 1); sar_img.saveImage(sar_a, start_ids, 0, 1);
//sar_img.saveImage(sar_a, start_ids, 0, 2); sar_img.saveImage(sar_a, start_ids, 0, 2);
start_ids = start_ids + line_invert; start_ids = start_ids + line_invert;
} while (start_ids < sar_rc.height); } while (start_ids < sar_rc.height);
sar_img.setNoDataValue(-9999, 1); sar_img.setNoDataValue(-9999, 1);
//sar_img.setNoDataValue(-9999, 2); sar_img.setNoDataValue(-9999, 2);
} }
// 正式计算插值 // 正式计算插值
@ -2672,7 +2672,7 @@ void simProcess::interpolation_GTC_sar_sigma(QString in_rc_wgs84_path, QString i
ori_a = Eigen::MatrixXd(1, 1); ori_a = Eigen::MatrixXd(1, 1);
//ori_b = Eigen::MatrixXd(1, 1); // 释放内存 //ori_b = Eigen::MatrixXd(1, 1); // 释放内存
Eigen::MatrixXd sar_a = sar_img.getData(start_ids, 0, line_invert, sar_rc.width, 1); Eigen::MatrixXd sar_a = sar_img.getData(start_ids, 0, line_invert, sar_rc.width, 1);
//Eigen::MatrixXd sar_b = sar_img.getData(start_ids, 0, line_invert, sar_rc.width, 2); Eigen::MatrixXd sar_b = sar_img.getData(start_ids, 0, line_invert, sar_rc.width, 2);
sar_r = sar_rc.getData(start_ids, 0, line_invert, sar_rc.width, 1); sar_r = sar_rc.getData(start_ids, 0, line_invert, sar_rc.width, 1);
sar_c = sar_rc.getData(start_ids, 0, line_invert, sar_rc.width, 2); sar_c = sar_rc.getData(start_ids, 0, line_invert, sar_rc.width, 2);
row_count = sar_r.rows(); row_count = sar_r.rows();
@ -2909,11 +2909,11 @@ void simProcess::interpolation_GTC_sar_sigma(QString in_rc_wgs84_path, QString i
complex<double> interpolation_value = Cubic_Convolution_interpolation(r - r1, c - c1, img_block); complex<double> interpolation_value = Cubic_Convolution_interpolation(r - r1, c - c1, img_block);
// //
sar_a(i, j) = interpolation_value.real(); sar_a(i, j) = interpolation_value.real();
//sar_b(i, j) = interpolation_value.imag(); sar_b(i, j) = interpolation_value.imag();
} }
} }
sar_img.saveImage(sar_a, start_ids, 0, 1); sar_img.saveImage(sar_a, start_ids, 0, 1);
//sar_img.saveImage(sar_b, start_ids, 0, 2); sar_img.saveImage(sar_b, start_ids, 0, 2);
start_ids = start_ids + line_invert; start_ids = start_ids + line_invert;
} while (start_ids < sar_rc.height); } while (start_ids < sar_rc.height);
} }

View File

@ -7,7 +7,7 @@
//#include <mkl.h> //#include <mkl.h>
// 本地方法 // 本地方法
#include "../BaseLibraryCPP/BaseTool.h" #include "BaseTool.h"
#include <iostream> #include <iostream>
#include <Eigen/Core> #include <Eigen/Core>
#include <Eigen/Dense> #include <Eigen/Dense>
@ -55,6 +55,8 @@ public:
int height; // 影像的高 int height; // 影像的高
int width; int width;
int widthspace;
// 入射角 // 入射角
double near_in_angle;// 近入射角 double near_in_angle;// 近入射角
double far_in_angle;// 远入射角 double far_in_angle;// 远入射角

View File

@ -3,7 +3,7 @@
#ifndef IMAGESHOWDIALOGCLASS_H #ifndef IMAGESHOWDIALOGCLASS_H
#define IMAGESHOWDIALOGCLASS_H #define IMAGESHOWDIALOGCLASS_H
#include "../BaseLibraryCPP/BaseConstVariable.h" #include "BaseConstVariable.h"
#include <QDialog> #include <QDialog>
#include <QLabel> #include <QLabel>
#include "qcustomplot.h" #include "qcustomplot.h"

View File

@ -1,6 +1,6 @@
#include "QMergeRasterProcessDialog.h" #include "QMergeRasterProcessDialog.h"
#include "QToolProcessBarDialog.h" #include "QToolProcessBarDialog.h"
#include "BaseLibraryCPP/ImageOperatorBase.h" #include "ImageOperatorBase.h"
#include <QString> #include <QString>
#include <QVector> #include <QVector>
#include <QFileDialog> #include <QFileDialog>

10
QSimulationRTPCGUI.cpp Normal file
View File

@ -0,0 +1,10 @@
#include "QSimulationRTPCGUI.h"
QSimulationRTPCGUI::QSimulationRTPCGUI(QWidget *parent)
: QDialog(parent)
{
ui.setupUi(this);
}
QSimulationRTPCGUI::~QSimulationRTPCGUI()
{}

16
QSimulationRTPCGUI.h Normal file
View File

@ -0,0 +1,16 @@
#pragma once
#include <QDialog>
#include "ui_QSimulationRTPCGUI.h"
class QSimulationRTPCGUI : public QDialog
{
Q_OBJECT
public:
QSimulationRTPCGUI(QWidget *parent = nullptr);
~QSimulationRTPCGUI();
private:
Ui::QSimulationRTPCGUIClass ui;
};

20
QSimulationRTPCGUI.ui Normal file
View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QSimulationRTPCGUIClass</class>
<widget class="QDialog" name="QSimulationRTPCGUIClass">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>600</width>
<height>400</height>
</rect>
</property>
<property name="windowTitle">
<string>RTPC回波仿真</string>
</property>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
<connections/>
</ui>

View File

@ -2,7 +2,7 @@
#include <QDialog> #include <QDialog>
#include "ui_QToolProcessBarDialog.h" #include "ui_QToolProcessBarDialog.h"
#include "BaseLibraryCPP/ImageOperatorBase.h" #include "ImageOperatorBase.h"
class QToolProcessBarDialog : public QDialog, public ShowProessAbstract class QToolProcessBarDialog : public QDialog, public ShowProessAbstract
{ {
Q_OBJECT Q_OBJECT

View File

@ -63,8 +63,10 @@
</ImportGroup> </ImportGroup>
<PropertyGroup Label="UserMacros" /> <PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<IncludePath>.\SimulationSAR;.\GF3ProcessToolbox;.\BaseLibraryCPP;$(IncludePath)</IncludePath>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<IncludePath>.\SimulationSAR;.\GF3ProcessToolbox;.\BaseLibraryCPP;$(oneMKLIncludeDir);$(IncludePath)</IncludePath>
</PropertyGroup> </PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile> <ClCompile>
@ -106,6 +108,7 @@
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="QSimulationRTPCGUI.cpp" />
<ClCompile Include="SimulationSAR\RTPCProcessCls.cpp" /> <ClCompile Include="SimulationSAR\RTPCProcessCls.cpp" />
<ClCompile Include="SimulationSAR\SARSatelliteSimulationAbstractCls.cpp" /> <ClCompile Include="SimulationSAR\SARSatelliteSimulationAbstractCls.cpp" />
<ClCompile Include="SimulationSAR\SARSimulationTaskSetting.cpp" /> <ClCompile Include="SimulationSAR\SARSimulationTaskSetting.cpp" />
@ -119,6 +122,7 @@
<QtUic Include="Imageshow\ImageShowDialogClass.ui" /> <QtUic Include="Imageshow\ImageShowDialogClass.ui" />
<QtUic Include="Imageshow\qcustomplot.ui" /> <QtUic Include="Imageshow\qcustomplot.ui" />
<QtUic Include="QMergeRasterProcessDialog.ui" /> <QtUic Include="QMergeRasterProcessDialog.ui" />
<QtUic Include="QSimulationRTPCGUI.ui" />
<QtUic Include="QToolProcessBarDialog.ui" /> <QtUic Include="QToolProcessBarDialog.ui" />
<QtUic Include="RasterProcessTool.ui" /> <QtUic Include="RasterProcessTool.ui" />
<QtMoc Include="RasterProcessTool.h" /> <QtMoc Include="RasterProcessTool.h" />
@ -155,6 +159,7 @@
<ClInclude Include="BaseLibraryCPP\EchoDataFormat.h" /> <ClInclude Include="BaseLibraryCPP\EchoDataFormat.h" />
<ClInclude Include="BaseLibraryCPP\FileOperator.h" /> <ClInclude Include="BaseLibraryCPP\FileOperator.h" />
<ClInclude Include="BaseLibraryCPP\GeoOperator.h" /> <ClInclude Include="BaseLibraryCPP\GeoOperator.h" />
<QtMoc Include="QSimulationRTPCGUI.h" />
<ClInclude Include="SimulationSAR\RTPCProcessCls.h" /> <ClInclude Include="SimulationSAR\RTPCProcessCls.h" />
<ClInclude Include="SimulationSAR\SARSatelliteSimulationAbstractCls.h" /> <ClInclude Include="SimulationSAR\SARSatelliteSimulationAbstractCls.h" />
<ClInclude Include="SimulationSAR\SARSimulationTaskSetting.h" /> <ClInclude Include="SimulationSAR\SARSimulationTaskSetting.h" />

View File

@ -133,6 +133,9 @@
<ClCompile Include="SimulationSAR\SigmaDatabase.cpp"> <ClCompile Include="SimulationSAR\SigmaDatabase.cpp">
<Filter>SimulationSAR</Filter> <Filter>SimulationSAR</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="QSimulationRTPCGUI.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="BaseLibraryCPP\BaseConstVariable.h"> <ClInclude Include="BaseLibraryCPP\BaseConstVariable.h">
@ -218,6 +221,9 @@
<QtMoc Include="GF3ProcessToolbox\QRDOrthProcessClass.h"> <QtMoc Include="GF3ProcessToolbox\QRDOrthProcessClass.h">
<Filter>GF3ProcessToolbox</Filter> <Filter>GF3ProcessToolbox</Filter>
</QtMoc> </QtMoc>
<QtMoc Include="QSimulationRTPCGUI.h">
<Filter>Header Files</Filter>
</QtMoc>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<QtUic Include="QMergeRasterProcessDialog.ui"> <QtUic Include="QMergeRasterProcessDialog.ui">
@ -241,5 +247,8 @@
<QtUic Include="GF3ProcessToolbox\QRDOrthProcessClass.ui"> <QtUic Include="GF3ProcessToolbox\QRDOrthProcessClass.ui">
<Filter>GF3ProcessToolbox</Filter> <Filter>GF3ProcessToolbox</Filter>
</QtUic> </QtUic>
<QtUic Include="QSimulationRTPCGUI.ui">
<Filter>Form Files</Filter>
</QtUic>
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -263,8 +263,6 @@ std::shared_ptr<AbstractSARSatelliteModel> ReadSimulationSettingsXML(QString xml
std::shared_ptr<SARSimulationTaskSetting> taskSetting = std::make_shared<SARSimulationTaskSetting>(); std::shared_ptr<SARSimulationTaskSetting> taskSetting = std::make_shared<SARSimulationTaskSetting>();
//SARSimulationTaskSetting taskSetting;
double starttimestamp = convertToMilliseconds(startTime.text().trimmed().toStdString()); double starttimestamp = convertToMilliseconds(startTime.text().trimmed().toStdString());
double endtimestamp = convertToMilliseconds(endTime.text().trimmed().toStdString()); double endtimestamp = convertToMilliseconds(endTime.text().trimmed().toStdString());
@ -291,7 +289,6 @@ std::shared_ptr<AbstractSARSatelliteModel> ReadSimulationSettingsXML(QString xml
} }
taskSetting->setCenterLookAngle(centerLookAngle.text().toDouble()); taskSetting->setCenterLookAngle(centerLookAngle.text().toDouble());
taskSetting->setSARImageStartTime(starttimestamp); // 成像开始时间 taskSetting->setSARImageStartTime(starttimestamp); // 成像开始时间
taskSetting->setSARImageEndTime(endtimestamp); // 成像终止时间 taskSetting->setSARImageEndTime(endtimestamp); // 成像终止时间

View File

@ -37,6 +37,39 @@ PolyfitSatelliteOribtModel::~PolyfitSatelliteOribtModel()
} }
QString PolyfitSatelliteOribtModel::getSatelliteOribtModelParamsString()
{
QString result = "";
result += this->polyfitPx.size()-1 + "\n";
result += "----------- poly Position X -------------------------\n";
for (long i = 0; i < this->polyfitPx.size(); i++) { // 求解平方
result += QString::number(this->polyfitPx[i], 'e', 6) + "\n";
}
result += "----------- poly Position Y -------------------------\n";
for (long i = 0; i < this->polyfitPx.size(); i++) { // 求解平方
result += QString::number(this->polyfitPy[i], 'e', 6) + "\n";
}
result += "----------- poly Position Z -------------------------\n";
for (long i = 0; i < this->polyfitPx.size(); i++) { // 求解平方
result += QString::number(this->polyfitPz[i], 'e', 6) + "\n";
}
result += "----------- poly Position Vector X ------------------\n";
for (long i = 0; i < this->polyfitPx.size(); i++) { // 求解平方
result += QString::number(this->polyfitVx[i], 'e', 6) + "\n";
}
result += "----------- poly Position Vector Y ------------------\n";
for (long i = 0; i < this->polyfitPx.size(); i++) { // 求解平方
result += QString::number(this->polyfitVy[i], 'e', 6) + "\n";
}
result += "----------- poly Position Vector Z ------------------\n";
for (long i = 0; i < this->polyfitPx.size(); i++) { // 求解平方
result += QString::number(this->polyfitVz[i], 'e', 6) + "\n";
}
result+= "------------------------------------------------------\n";
return result;
}
SatelliteOribtNode PolyfitSatelliteOribtModel::getSatelliteOribtNode(double& timeFromStartTime, bool& antAzAngleFlag) SatelliteOribtNode PolyfitSatelliteOribtModel::getSatelliteOribtNode(double& timeFromStartTime, bool& antAzAngleFlag)
{ {
// 位置、速度 // 位置、速度
@ -236,22 +269,6 @@ void PolyfitSatelliteOribtModel::addOribtNode(SatelliteOribtNode node)
} }
ErrorCode polynomial_fit(const std::vector<double>& x, const std::vector<double>& y, int degree, std::vector<double>& out_factor, double& out_chisq) {
int xyLength = x.size();
double* xdata = new double[xyLength];
double* ydata = new double[xyLength];
for (long i = 0; i < xyLength; i++) {
xdata[i] = x[i];
ydata[i] = y[i];
}
ErrorCode state= polyfit(xdata, ydata,xyLength, degree, out_factor, out_chisq);
delete[] xdata;
delete[] ydata; // ÊÍ·ÅÄÚ´æ
return state;
}
ErrorCode PolyfitSatelliteOribtModel::polyFit(int polynum/*=3*/, bool input_timeFromReferenceTime) ErrorCode PolyfitSatelliteOribtModel::polyFit(int polynum/*=3*/, bool input_timeFromReferenceTime)
{ {

View File

@ -20,7 +20,8 @@ class PolyfitSatelliteOribtModel:public AbstractSatelliteOribtModel
public: public:
PolyfitSatelliteOribtModel(); PolyfitSatelliteOribtModel();
~PolyfitSatelliteOribtModel() override; ~PolyfitSatelliteOribtModel() override;
public:
QString getSatelliteOribtModelParamsString();
public: // 卫星轨道节点 public: // 卫星轨道节点
virtual SatelliteOribtNode getSatelliteOribtNode(double& timeFromStartTime, bool& antAzAngleFlag) override; // 获取轨道节点 virtual SatelliteOribtNode getSatelliteOribtNode(double& timeFromStartTime, bool& antAzAngleFlag) override; // 获取轨道节点
@ -100,8 +101,6 @@ private:
}; };
ErrorCode polynomial_fit(const std::vector<double>& x, const std::vector<double>& y, int degree, std::vector<double>& out_factor, double& out_chisq);
std::shared_ptr<AbstractSatelliteOribtModel> CreataPolyfitSatelliteOribtModel(std::vector<SatelliteOribtNode> &nodes, long double startTime,int polynum=3); std::shared_ptr<AbstractSatelliteOribtModel> CreataPolyfitSatelliteOribtModel(std::vector<SatelliteOribtNode> &nodes, long double startTime,int polynum=3);