增加了强度仿真-地距

pull/13/head
chenzenghui 2025-03-13 12:08:14 +08:00
parent 8549fd485f
commit c7291b0475
5 changed files with 84 additions and 55 deletions

View File

@ -132,25 +132,26 @@ void QtSimulationGeoSARSigma0Dialog::onbtnaccepted()
// 创建输出文件,其中输出文件的大小和输入文件的大小一致,复制输入文件到输出文件,并把文件置零 // 创建输出文件,其中输出文件的大小和输入文件的大小一致,复制输入文件到输出文件,并把文件置零
gdalImage IncAngle(IncAngleRaster); gdalImage IncAngle(IncAngleRaster);
QFile::copy(IncAngleRaster, OutputTerrianRaster);
gdalImage OutputTerrian(OutputTerrianRaster);
Eigen::MatrixXd IncAngleData = IncAngle.getData(0, 0, IncAngle.height, IncAngle.width,1);
Eigen::MatrixXd SigmaSARData = MuhlemanSigmaArray(IncAngleData);
OutputTerrian.saveImage(SigmaSARData, 0, 0, 1);
if (QFile(LandClsRaster).exists()) {
QFile::copy(IncAngleRaster, OutputClsSARRaster);
gdalImage OutputClsSAR(OutputClsSARRaster);
gdalImage LandCls(LandClsRaster); gdalImage LandCls(LandClsRaster);
SigmaDatabase sigmads; SigmaDatabase sigmads;
sigmads.readParamsFromFile(ClsWeightRaster.toStdString()); sigmads.readParamsFromFile(ClsWeightRaster.toStdString());
Eigen::MatrixXd LandClsData = LandCls.getData(0, 0, LandCls.height, LandCls.width,1);
// 创建输出文件
QFile::copy(IncAngleRaster, OutputTerrianRaster);
QFile::copy(IncAngleRaster, OutputClsSARRaster);
gdalImage OutputTerrian(OutputTerrianRaster);
gdalImage OutputClsSAR(OutputClsSARRaster);
// 读取输入文件
Eigen::MatrixXd IncAngleData = IncAngle.getData(0, 0, IncAngle.height, IncAngle.width, 0);
Eigen::MatrixXd LandClsData = LandCls.getData(0, 0, LandCls.height, LandCls.width, 0);
Eigen::MatrixXd SigmaSARData = MuhlemanSigmaArray(IncAngleData);
Eigen::MatrixXd SigmaSARDataCls = SigmaSARData; Eigen::MatrixXd SigmaSARDataCls = SigmaSARData;
OutputTerrian.saveImage(SigmaSARData, 0, 0, 1);
for (long i = 0; i < LandClsData.rows(); i++) for (long i = 0; i < LandClsData.rows(); i++)
{ {
for (long j = 0; j < LandClsData.cols(); j++) for (long j = 0; j < LandClsData.cols(); j++)
@ -160,7 +161,8 @@ void QtSimulationGeoSARSigma0Dialog::onbtnaccepted()
} }
} }
OutputClsSAR.saveImage(SigmaSARDataCls, 0, 0, 1); OutputClsSAR.saveImage(SigmaSARDataCls, 0, 0, 1);
}
else {}
QMessageBox::information(nullptr, u8"提示", u8"completed!!!"); QMessageBox::information(nullptr, u8"提示", u8"completed!!!");
} }

View File

@ -4,16 +4,6 @@
#include <map> #include <map>
#include "BaseConstVariable.h" #include "BaseConstVariable.h"
struct SigmaParam {
double p1;
double p2;
double p3;
double p4;
double p5;
double p6;
};
double getSigma(double& theta, SigmaParam& param) { double getSigma(double& theta, SigmaParam& param) {
return param.p1 + param.p2 * exp(-param.p3 * theta) + param.p4 * cos(param.p5 * theta + param.p6); return param.p1 + param.p2 * exp(-param.p3 * theta) + param.p4 * cos(param.p5 * theta + param.p6);
@ -198,16 +188,9 @@ void SigmaDatabase::readParamsFromFile(const std::string& filename) {
} }
void SigmaDatabase::writeParamsToFile(const std::string& filename) {
std::ofstream outfile(filename);
if (!outfile.is_open()) {
std::cerr << "Failed to create file: " << filename << std::endl;
return;
}
// ¼æÈÝC++11µÄlambdaд·¨ void SigmaDatabase::writePolarData(std::ofstream& outfile, const std::string& polarType, const std::map<long, SigmaParam>& params)
auto writePolarData = [&outfile](const std::string& polarType, {
const std::map<long, SigmaParam>& params) {
for (const auto& entry : params) { for (const auto& entry : params) {
const long cls = entry.first; const long cls = entry.first;
const SigmaParam& param = entry.second; const SigmaParam& param = entry.second;
@ -216,12 +199,22 @@ void SigmaDatabase::writeParamsToFile(const std::string& filename) {
<< param.p3 << " " << param.p4 << " " << param.p3 << " " << param.p4 << " "
<< param.p5 << " " << param.p6 << "\n"; << param.p5 << " " << param.p6 << "\n";
} }
}; }
writePolarData("HH", HH_sigmaParam);
writePolarData("HV", HV_sigmaParam); void SigmaDatabase::writeParamsToFile(const std::string& filename) {
writePolarData("VH", VH_sigmaParam); std::ofstream outfile(filename);
writePolarData("VV", VV_sigmaParam); if (!outfile.is_open()) {
std::cerr << "Failed to create file: " << filename << std::endl;
return;
}
// ÏÔʽµ÷ÓÃËÄ´ÎÏû³ıÖØ¸´
writePolarData(outfile, "HH", HH_sigmaParam);
writePolarData(outfile, "HV", HV_sigmaParam);
writePolarData(outfile, "VH", VH_sigmaParam);
writePolarData(outfile, "VV", VV_sigmaParam);
outfile.close(); outfile.close();
} }

View File

@ -94,6 +94,11 @@ private:
std::map<long, SigmaParam> VH_sigmaParam; std::map<long, SigmaParam> VH_sigmaParam;
std::map<long, SigmaParam> VV_sigmaParam; std::map<long, SigmaParam> VV_sigmaParam;
private:
// 新增私有辅助函数
void writePolarData(std::ofstream& outfile,
const std::string& polarType,
const std::map<long, SigmaParam>& params);
}; };

View File

@ -6,6 +6,7 @@
#include "QSimulationLookTableDialog.h" #include "QSimulationLookTableDialog.h"
#include "QCreateSARIntensityByLookTableDialog.h" #include "QCreateSARIntensityByLookTableDialog.h"
#include "QtSimulationGeoSARSigma0Dialog.h" #include "QtSimulationGeoSARSigma0Dialog.h"
#include "QtLinearToIntenisityDialog.h"
SARSimlulationRFPCToolButton::SARSimlulationRFPCToolButton(QWidget* parent) SARSimlulationRFPCToolButton::SARSimlulationRFPCToolButton(QWidget* parent)
{ {
@ -67,17 +68,13 @@ void QSimulationSAROrbitModelToolButton::excute()
void RegisterPreToolBox(LAMPMainWidget::RasterMainWidget* mainwindows, ToolBoxWidget* toolbox) void RegisterPreToolBox(LAMPMainWidget::RasterMainWidget* mainwindows, ToolBoxWidget* toolbox)
{ {
emit toolbox->addBoxToolItemSIGNAL(new SARSimlulationRFPCToolButton(toolbox)); emit toolbox->addBoxToolItemSIGNAL(new SARSimlulationRFPCToolButton(toolbox));
emit toolbox->addBoxToolItemSIGNAL(new SARSimulationTBPImageToolButton(toolbox)); emit toolbox->addBoxToolItemSIGNAL(new SARSimulationTBPImageToolButton(toolbox));
emit toolbox->addBoxToolItemSIGNAL(new QSimulationSAROrbitModelToolButton(toolbox)); emit toolbox->addBoxToolItemSIGNAL(new QSimulationSAROrbitModelToolButton(toolbox));
emit toolbox->addBoxToolItemSIGNAL(new LookTableComputerClassToolButton(toolbox)); emit toolbox->addBoxToolItemSIGNAL(new LookTableComputerClassToolButton(toolbox));
emit toolbox->addBoxToolItemSIGNAL(new QCreateSARIntensityByLookTableToolButton(toolbox)); emit toolbox->addBoxToolItemSIGNAL(new QCreateSARIntensityByLookTableToolButton(toolbox));
emit toolbox->addBoxToolItemSIGNAL(new QtSimulationGeoSARSigma0ToolButton(toolbox)); emit toolbox->addBoxToolItemSIGNAL(new QtSimulationGeoSARSigma0ToolButton(toolbox));
emit toolbox->addBoxToolItemSIGNAL(new QtLinearToIntenisityToolButton(toolbox));
} }
@ -129,3 +126,19 @@ void QtSimulationGeoSARSigma0ToolButton::excute()
QtSimulationGeoSARSigma0Dialog* dialog = new QtSimulationGeoSARSigma0Dialog; QtSimulationGeoSARSigma0Dialog* dialog = new QtSimulationGeoSARSigma0Dialog;
dialog->show(); dialog->show();
} }
QtLinearToIntenisityToolButton::QtLinearToIntenisityToolButton(QWidget* parent)
{
this->toolPath = QVector<QString>(0);
this->toolPath.push_back(u8"·ÂÕæ¹¤¾ß¿â");
this->toolname = QString(u8"dBתÏßÐÔÖµ");
}
QtLinearToIntenisityToolButton::~QtLinearToIntenisityToolButton()
{
}
void QtLinearToIntenisityToolButton::excute()
{
QtLinearToIntenisityDialog* dialog = new QtLinearToIntenisityDialog;
dialog->show();
}

View File

@ -84,6 +84,22 @@ public slots:
}; };
class SIMULATIONSARTOOL_EXPORT QtLinearToIntenisityToolButton : public QToolAbstract {
Q_OBJECT
public:
QtLinearToIntenisityToolButton(QWidget* parent = nullptr);
~QtLinearToIntenisityToolButton();
public slots:
virtual void excute() override;
};
extern "C" SIMULATIONSARTOOL_EXPORT void RegisterPreToolBox(LAMPMainWidget::RasterMainWidget* mainwindows, ToolBoxWidget* toolbox); extern "C" SIMULATIONSARTOOL_EXPORT void RegisterPreToolBox(LAMPMainWidget::RasterMainWidget* mainwindows, ToolBoxWidget* toolbox);