增加了强度仿真-地距

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,35 +132,37 @@ void QtSimulationGeoSARSigma0Dialog::onbtnaccepted()
// 创建输出文件,其中输出文件的大小和输入文件的大小一致,复制输入文件到输出文件,并把文件置零
gdalImage IncAngle(IncAngleRaster);
gdalImage LandCls(LandClsRaster);
SigmaDatabase sigmads;
sigmads.readParamsFromFile(ClsWeightRaster.toStdString());
// 创建输出文件
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 IncAngleData = IncAngle.getData(0, 0, IncAngle.height, IncAngle.width,1);
Eigen::MatrixXd SigmaSARData = MuhlemanSigmaArray(IncAngleData);
Eigen::MatrixXd SigmaSARDataCls = SigmaSARData;
OutputTerrian.saveImage(SigmaSARData, 0, 0, 1);
for (long i = 0; i < LandClsData.rows(); i++)
{
for (long j = 0; j < LandClsData.cols(); j++)
if (QFile(LandClsRaster).exists()) {
QFile::copy(IncAngleRaster, OutputClsSARRaster);
gdalImage OutputClsSAR(OutputClsSARRaster);
gdalImage LandCls(LandClsRaster);
SigmaDatabase sigmads;
sigmads.readParamsFromFile(ClsWeightRaster.toStdString());
Eigen::MatrixXd LandClsData = LandCls.getData(0, 0, LandCls.height, LandCls.width,1);
Eigen::MatrixXd SigmaSARDataCls = SigmaSARData;
for (long i = 0; i < LandClsData.rows(); i++)
{
double weight = sigmads.getAmpHH(LandClsData(i, j),IncAngleData(i,j)*d2r);
SigmaSARDataCls(i, j) = std::pow(10.0, weight/20.0);
for (long j = 0; j < LandClsData.cols(); j++)
{
double weight = sigmads.getAmpHH(LandClsData(i, j), IncAngleData(i, j) * d2r);
SigmaSARDataCls(i, j) = std::pow(10.0, weight / 20.0);
}
}
OutputClsSAR.saveImage(SigmaSARDataCls, 0, 0, 1);
}
OutputClsSAR.saveImage(SigmaSARDataCls, 0, 0, 1);
else {}
QMessageBox::information(nullptr, u8"提示", u8"completed!!!");
}

View File

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

View File

@ -94,6 +94,11 @@ private:
std::map<long, SigmaParam> VH_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 "QCreateSARIntensityByLookTableDialog.h"
#include "QtSimulationGeoSARSigma0Dialog.h"
#include "QtLinearToIntenisityDialog.h"
SARSimlulationRFPCToolButton::SARSimlulationRFPCToolButton(QWidget* parent)
{
@ -67,18 +68,14 @@ void QSimulationSAROrbitModelToolButton::excute()
void RegisterPreToolBox(LAMPMainWidget::RasterMainWidget* mainwindows, ToolBoxWidget* toolbox)
{
emit toolbox->addBoxToolItemSIGNAL(new SARSimlulationRFPCToolButton(toolbox));
emit toolbox->addBoxToolItemSIGNAL(new SARSimulationTBPImageToolButton(toolbox));
emit toolbox->addBoxToolItemSIGNAL(new QSimulationSAROrbitModelToolButton(toolbox));
emit toolbox->addBoxToolItemSIGNAL(new LookTableComputerClassToolButton(toolbox));
emit toolbox->addBoxToolItemSIGNAL(new QCreateSARIntensityByLookTableToolButton(toolbox));
emit toolbox->addBoxToolItemSIGNAL(new QtSimulationGeoSARSigma0ToolButton(toolbox));
emit toolbox->addBoxToolItemSIGNAL(new QtLinearToIntenisityToolButton(toolbox));
}
LookTableComputerClassToolButton::LookTableComputerClassToolButton(QWidget* parent)
@ -129,3 +126,19 @@ void QtSimulationGeoSARSigma0ToolButton::excute()
QtSimulationGeoSARSigma0Dialog* dialog = new QtSimulationGeoSARSigma0Dialog;
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);