在高程插值之后,增加了同步斜距计算

pull/10/head
陈增辉 2025-04-06 16:48:37 +08:00
parent da92aff9dc
commit a4f195c883
5 changed files with 259 additions and 113 deletions

View File

@ -218,7 +218,16 @@ bool OverlapCheck(QString& ImageLLPath, QString& ImageDEMPath)
}
void InterploateAtiByRefDEM(QString& ImageLLPath, QString& ImageDEMPath, QString& outImageLLAPath)
bool GPSPointsNumberEqualCheck(QString& ImageLLPath, QString& InEchoGPSDataPath)
{
gdalImage antimg(InEchoGPSDataPath);
gdalImage imgll(ImageLLPath);
return antimg.height == imgll.height;
}
void InterploateAtiByRefDEM(QString& ImageLLPath, QString& ImageDEMPath, QString& outImageLLAPath, QString& InEchoGPSDataPath)
{
gdalImage demimg(ImageDEMPath);
gdalImage imgll(ImageLLPath);
@ -230,10 +239,11 @@ void InterploateAtiByRefDEM(QString& ImageLLPath, QString& ImageDEMPath, QString
Eigen::MatrixXd imglonArr = imgll.getData(0, 0, imgheight, imgwidth, 1);
Eigen::MatrixXd imglatArr = imgll.getData(0, 0, imgheight, imgwidth, 2);
Eigen::MatrixXd imgatiArr = Eigen::MatrixXd::Zero(imgheight, imgwidth);
Eigen::MatrixXd imgRArr = Eigen::MatrixXd::Zero(imgheight, imgwidth);
outimgll.saveImage(imglonArr, 0, 0, 1);
outimgll.saveImage(imglatArr, 0, 0, 2);
#pragma omp parallel for
for (long i = 0; i < imgheight; i++) {
for (long j = 0; j < imgwidth; j++) {
double lon = imglonArr(i, j); // X
@ -286,6 +296,76 @@ void InterploateAtiByRefDEM(QString& ImageLLPath, QString& ImageDEMPath, QString
}
}
outimgll.saveImage(imgatiArr, 0, 0, 3);
qDebug() << u8"计算每个点的斜距值";
gdalImage antimg(InEchoGPSDataPath);
qDebug() << u8"1. 回波GPS坐标点文件参数\t";
qDebug() << u8"文件路径:\t" << InEchoGPSDataPath;
qDebug() << u8"GPS 点数:\t" << antimg.height;
qDebug() << u8"文件列数:\t" << antimg.width;
long prfcount = antimg.height;
std::shared_ptr<double> Pxs((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost);
std::shared_ptr<double> Pys((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost);
std::shared_ptr<double> Pzs((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost);
std::shared_ptr<double> AntDirectX((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost);
std::shared_ptr<double> AntDirectY((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost);
std::shared_ptr<double> AntDirectZ((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost);
{
long colnum = 19;
std::shared_ptr<double> antpos = readDataArr<double>(antimg, 0, 0, prfcount, colnum, 1, GDALREADARRCOPYMETHOD::VARIABLEMETHOD);
double time = 0;
double Px = 0;
double Py = 0;
double Pz = 0;
for (long i = 0; i < prfcount; i++) {
Pxs.get()[i] = antpos.get()[i * 19 + 1]; // 卫星坐标
Pys.get()[i] = antpos.get()[i * 19 + 2];
Pzs.get()[i] = antpos.get()[i * 19 + 3];
AntDirectX.get()[i] = antpos.get()[i * 19 + 13];// zero doppler
AntDirectY.get()[i] = antpos.get()[i * 19 + 14];
AntDirectZ.get()[i] = antpos.get()[i * 19 + 15];
double NormAnt = std::sqrt(AntDirectX.get()[i] * AntDirectX.get()[i] +
AntDirectY.get()[i] * AntDirectY.get()[i] +
AntDirectZ.get()[i] * AntDirectZ.get()[i]);
AntDirectX.get()[i] = AntDirectX.get()[i] / NormAnt;
AntDirectY.get()[i] = AntDirectY.get()[i] / NormAnt;
AntDirectZ.get()[i] = AntDirectZ.get()[i] / NormAnt;// 归一化
}
antpos.reset();
}
#pragma omp parallel for
for (long prfid = 0; prfid < prfcount; prfid++) {
double Px = Pxs.get()[prfid];
double Py = Pys.get()[prfid];
double Pz = Pzs.get()[prfid];
double R = 0;
Landpoint LLA = {};
Point3 XYZ = {};
for (long j = 0; j < imgwidth; j++) {
LLA.lon = imglonArr(prfid, j);
LLA.lat = imglatArr(prfid, j);
LLA.ati = imgatiArr(prfid, j);
LLA2XYZ(LLA, XYZ);
R = sqrt(pow(Px - XYZ.x, 2) +
pow(Py - XYZ.y, 2) +
pow(Pz - XYZ.z, 2));
imgRArr(prfid, j) = R;
}
}
outimgll.saveImage(imgRArr, 0, 0, 4);
qDebug() << u8"²åÖµÍê³É";
}

View File

@ -9,7 +9,10 @@ void InitCreateImageXYZProcess(QString& outImageLLPath, QString& outImageXYZPath
bool OverlapCheck(QString& ImageLLPath, QString& ImageDEMPath);
void InterploateAtiByRefDEM(QString& ImageLLPath, QString& ImageDEMPath, QString& outImageLLAPath);
bool GPSPointsNumberEqualCheck(QString& ImageLLPath, QString& InEchoGPSDataPath);
void InterploateAtiByRefDEM(QString& ImageLLPath, QString& ImageDEMPath, QString& outImageLLAPath, QString& InEchoGPSDataPath);

View File

@ -41,6 +41,24 @@ void ImagePlaneAtiInterpDialog::onpushButtonImageNet0Select_clicked()
}
}
void ImagePlaneAtiInterpDialog::onpushButtonEchoGPSPointSelect_clicked()
{
QString fileNames = QFileDialog::getOpenFileName(
this, // 父窗口
tr(u8"选择回波GPS坐标点文件"), // 标题
QString(), // 默认路径
tr(u8"GPS坐标点文件(*.gpspos.data);;All Files(*.*)") // 文件过滤器
);
// 如果用户选择了文件
if (!fileNames.isEmpty()) {
QString message = "选择的文件有:\n";
this->ui->lineEditGPSPointsPath->setText(fileNames);
}
else {
QMessageBox::information(this, tr(u8"没有选择文件"), tr(u8"没有选择任何文件。"));
}
}
void ImagePlaneAtiInterpDialog::onpushButtonRefRangeDEMSelect_clicked()
{
QString fileNames = QFileDialog::getOpenFileName(
@ -82,8 +100,8 @@ void ImagePlaneAtiInterpDialog::onbuttonBoxAccepted()
QString imageNet0Path = this->ui->lineEditImageNet0Path->text().trimmed();
QString refRangeDEMPath = this->ui->lineEditRefRangeDEMPath->text().trimmed();
QString imageLLAPath = this->ui->lineEditImageLLAPath->text().trimmed();
if (imageNet0Path.isEmpty() || refRangeDEMPath.isEmpty() || imageLLAPath.isEmpty()) {
QString echoGPSDataPath = this->ui->lineEditGPSPointsPath->text().trimmed();
if (imageNet0Path.isEmpty() || refRangeDEMPath.isEmpty() || imageLLAPath.isEmpty()||echoGPSDataPath.isEmpty()) {
QMessageBox::warning(this, tr(u8"Ìáʾ"), tr(u8"ûÓÐÑ¡ÖÐÎļþ"));
return;
}
@ -91,8 +109,16 @@ void ImagePlaneAtiInterpDialog::onbuttonBoxAccepted()
}
if (GPSPointsNumberEqualCheck(imageNet0Path, echoGPSDataPath)) {
}
else {
QMessageBox::warning(nullptr, u8"警告", u8"回波GPS坐标点数目不一致");
return;
}
if (OverlapCheck(imageNet0Path, refRangeDEMPath)) { // ????DEM???
InterploateAtiByRefDEM(imageNet0Path, refRangeDEMPath, imageLLAPath);
InterploateAtiByRefDEM(imageNet0Path, refRangeDEMPath, imageLLAPath,echoGPSDataPath);
QMessageBox::information(nullptr, u8"Ìáʾ", u8"completed!!");
return;

View File

@ -18,9 +18,10 @@ public:
ImagePlaneAtiInterpDialog(QWidget *parent = nullptr);
~ImagePlaneAtiInterpDialog();
public /*slots*/:
public slots:
void onpushButtonImageNet0Select_clicked();
void onpushButtonEchoGPSPointSelect_clicked();
void onpushButtonRefRangeDEMSelect_clicked();
void onpushButtonImageLLASelect_clicked();
void onbuttonBoxAccepted();

View File

@ -14,111 +14,7 @@
<string>根据经纬度插值高程数据</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>成像网格(经纬度):</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="lineEditImageNet0Path">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="pushButtonImageNet0Select">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>参考DEM</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="lineEditRefRangeDEMPath">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="pushButtonRefRangeDEMSelect">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>成像粗网格(高程):</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="lineEditImageLLAPath">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="2" column="2">
<item row="3" column="2">
<widget class="QPushButton" name="pushButtonImageLLASelect">
<property name="minimumSize">
<size>
@ -131,7 +27,46 @@
</property>
</widget>
</item>
<item row="3" column="0" colspan="3">
<item row="2" column="0">
<widget class="QLabel" name="label_2">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>参考DEM</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="lineEditImageLLAPath">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="lineEditRefRangeDEMPath">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="4" column="0" colspan="3">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="minimumSize">
<size>
@ -144,6 +79,107 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>成像网格(经纬度):</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="pushButtonImageNet0Select">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QPushButton" name="pushButtonRefRangeDEMSelect">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_3">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>成像粗网格(高程):</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="lineEditImageNet0Path">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_4">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>回波GPS点</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="lineEditGPSPointsPath">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="pushButton">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>