插值结果代码调节完成
parent
a8c39794ce
commit
eca5bc4575
|
|
@ -176,11 +176,11 @@ void InitCreateImageXYZProcess(QString& outImageLLPath, QString& outImageXYZPath
|
||||||
bool OverlapCheck(QString& ImageLLPath, QString& ImageDEMPath)
|
bool OverlapCheck(QString& ImageLLPath, QString& ImageDEMPath)
|
||||||
{
|
{
|
||||||
// ¼ì²éDEMÊÇ·ñÊÇWGS84×ø±êϵ
|
// ¼ì²éDEMÊÇ·ñÊÇWGS84×ø±êϵ
|
||||||
long demEPSG = GetEPSGFromRasterFile(ImageDEMPath);
|
//long demEPSG = GetEPSGFromRasterFile(ImageDEMPath);
|
||||||
if (demEPSG != 4326) {
|
//if (demEPSG != 4326) {
|
||||||
qDebug() << u8"DEM×ø±êϵ²»ÊÇWGS84×ø±êϵ";
|
// qDebug() << u8"DEM坐标系不是WGS84坐标系,ESPG:"<< demEPSG;
|
||||||
return false;
|
// return false;
|
||||||
}
|
//}
|
||||||
|
|
||||||
gdalImage demimg(ImageDEMPath);
|
gdalImage demimg(ImageDEMPath);
|
||||||
gdalImage imgll(ImageLLPath);
|
gdalImage imgll(ImageLLPath);
|
||||||
|
|
@ -190,13 +190,29 @@ bool OverlapCheck(QString& ImageLLPath, QString& ImageDEMPath)
|
||||||
Eigen::MatrixXd imglonArr = imgll.getData(0, 0, imgheight, imgwidth, 1);
|
Eigen::MatrixXd imglonArr = imgll.getData(0, 0, imgheight, imgwidth, 1);
|
||||||
Eigen::MatrixXd imglatArr = imgll.getData(0, 0, imgheight, imgwidth, 2);
|
Eigen::MatrixXd imglatArr = imgll.getData(0, 0, imgheight, imgwidth, 2);
|
||||||
|
|
||||||
|
// 打印范围
|
||||||
|
qDebug() << u8"影像范围:";
|
||||||
|
qDebug() << u8"最小经度:\t" << imglonArr.minCoeff();
|
||||||
|
qDebug() << u8"最大经度:\t" << imglonArr.maxCoeff();
|
||||||
|
qDebug() << u8"最小纬度:\t" << imglatArr.minCoeff();
|
||||||
|
qDebug() << u8"最大纬度:\t" << imglatArr.maxCoeff();
|
||||||
|
qDebug() << u8"DEM范围:";
|
||||||
|
RasterExtend demextend = demimg.getExtend();
|
||||||
|
qDebug() << u8"最小经度:\t" << demextend.min_x;
|
||||||
|
qDebug() << u8"最大经度:\t" << demextend.max_x;
|
||||||
|
qDebug() << u8"最小纬度:\t" << demextend.min_y;
|
||||||
|
qDebug() << u8"最大纬度:\t" << demextend.max_y;
|
||||||
|
qDebug() << u8"影像大小:\t" << demimg.height << " * " << demimg.width;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for (long i = 0; i < imgheight; i++)
|
for (long i = 0; i < imgheight; i++)
|
||||||
{
|
{
|
||||||
for (long j = 0; j < imgwidth; j++)
|
for (long j = 0; j < imgwidth; j++)
|
||||||
{
|
{
|
||||||
double lon = imglonArr(i, j); // X
|
double lon = imglonArr(i, j); // X
|
||||||
double lat = imglatArr(i, j); // Y
|
double lat = imglatArr(i, j); // Y
|
||||||
Landpoint point = imgll.getRow_Col(lon, lat);
|
Landpoint point = demimg.getRow_Col(lon, lat);
|
||||||
imglonArr(i, j) = point.lon;
|
imglonArr(i, j) = point.lon;
|
||||||
imglatArr(i, j) = point.lat;
|
imglatArr(i, j) = point.lat;
|
||||||
}
|
}
|
||||||
|
|
@ -207,6 +223,14 @@ bool OverlapCheck(QString& ImageLLPath, QString& ImageDEMPath)
|
||||||
double minY = imglatArr.minCoeff();
|
double minY = imglatArr.minCoeff();
|
||||||
double maxY = imglatArr.maxCoeff();
|
double maxY = imglatArr.maxCoeff();
|
||||||
|
|
||||||
|
//打印范围
|
||||||
|
qDebug() << u8"dem 的范围:";
|
||||||
|
qDebug() << u8"minX:"<<minX<<"\t"<<demimg.width;
|
||||||
|
qDebug() << u8"maxX:"<<maxX << "\t" << demimg.width;
|
||||||
|
qDebug() << u8"minY:"<<minY << "\t" << demimg.height;
|
||||||
|
qDebug() << u8"maxY:"<<maxY << "\t" << demimg.height;
|
||||||
|
qDebug() << u8"图像行列:\t" << demimg.height << " , " << demimg.width;
|
||||||
|
|
||||||
if (minX<1 || maxX>demimg.width - 1 || minY<1 || maxY>demimg.height - 1) {
|
if (minX<1 || maxX>demimg.width - 1 || minY<1 || maxY>demimg.height - 1) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -238,42 +262,53 @@ void InterploateAtiByRefDEM(QString& ImageLLPath, QString& ImageDEMPath, QString
|
||||||
|
|
||||||
Eigen::MatrixXd imglonArr = imgll.getData(0, 0, imgheight, imgwidth, 1);
|
Eigen::MatrixXd imglonArr = imgll.getData(0, 0, imgheight, imgwidth, 1);
|
||||||
Eigen::MatrixXd imglatArr = imgll.getData(0, 0, imgheight, imgwidth, 2);
|
Eigen::MatrixXd imglatArr = imgll.getData(0, 0, imgheight, imgwidth, 2);
|
||||||
|
Eigen::MatrixXd demArr = demimg.getData(0, 0, demimg.height, demimg.width, 1);
|
||||||
Eigen::MatrixXd imgatiArr = Eigen::MatrixXd::Zero(imgheight, imgwidth);
|
Eigen::MatrixXd imgatiArr = Eigen::MatrixXd::Zero(imgheight, imgwidth);
|
||||||
Eigen::MatrixXd imgRArr = Eigen::MatrixXd::Zero(imgheight, imgwidth);
|
Eigen::MatrixXd imgRArr = Eigen::MatrixXd::Zero(imgheight, imgwidth);
|
||||||
|
|
||||||
outimgll.saveImage(imglonArr, 0, 0, 1);
|
outimgll.saveImage(imglonArr, 0, 0, 1);
|
||||||
outimgll.saveImage(imglatArr, 0, 0, 2);
|
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 minX = imglonArr.minCoeff();
|
||||||
double lon = imglonArr(i, j); // X
|
double maxX = imglonArr.maxCoeff();
|
||||||
double lat = imglatArr(i, j); // Y
|
double minY = imglatArr.minCoeff();
|
||||||
Landpoint point = imgll.getRow_Col(lon, lat);
|
double maxY = imglatArr.maxCoeff();
|
||||||
imglonArr(i, j) = point.lon;
|
//打印范围
|
||||||
imglatArr(i, j) = point.lat;
|
qDebug() << u8"dem 的范围:";
|
||||||
}
|
qDebug() << u8"minX:" << minX << "\t" << demimg.width;
|
||||||
}
|
qDebug() << u8"maxX:" << maxX << "\t" << demimg.width;
|
||||||
|
qDebug() << u8"minY:" << minY << "\t" << demimg.height;
|
||||||
|
qDebug() << u8"maxY:" << maxY << "\t" << demimg.height;
|
||||||
|
qDebug() << u8"图像行列:\t" << demimg.height << " , " << demimg.width;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for (long i = 0; i < imgheight; i++) {
|
for (long i = 0; i < imgheight; i++) {
|
||||||
|
//printf("\rprocess:%f precent\t\t\t",i*100.0/imgheight);
|
||||||
for (long j = 0; j < imgwidth; j++) {
|
for (long j = 0; j < imgwidth; j++) {
|
||||||
double imX = imglonArr(i, j);
|
double lon = imglonArr(i, j);
|
||||||
double imY = imglatArr(i, j);
|
double lat = imglatArr(i, j);
|
||||||
|
Landpoint point = demimg.getRow_Col(lon, lat);
|
||||||
Landpoint p0, p11, p21, p12, p22;
|
Landpoint p0, p11, p21, p12, p22;
|
||||||
p0.lon = imX;
|
p0.lon = point.lon;
|
||||||
p0.lat = imY;
|
p0.lat = point.lat;
|
||||||
|
|
||||||
p11.lon = floor(p0.lon);
|
p11.lon = floor(p0.lon);
|
||||||
p11.lat = floor(p0.lat);
|
p11.lat = floor(p0.lat);
|
||||||
|
p11.ati = demArr(long(p11.lat), long(p11.lon));
|
||||||
|
|
||||||
p12.lon = ceil(p0.lon);
|
p12.lon = ceil(p0.lon);
|
||||||
p12.lat = floor(p0.lat);
|
p12.lat = floor(p0.lat);
|
||||||
|
p12.ati = demArr(long(p12.lat), long(p12.lon));
|
||||||
|
|
||||||
p21.lon = floor(p0.lon);
|
p21.lon = floor(p0.lon);
|
||||||
p21.lat = ceil(p0.lat);
|
p21.lat = ceil(p0.lat);
|
||||||
|
p21.ati = demArr(long(p21.lat), long(p21.lon));
|
||||||
|
|
||||||
p22.lon = ceil(p0.lon);
|
p22.lon = ceil(p0.lon);
|
||||||
p22.lat = ceil(p0.lat);
|
p22.lat = ceil(p0.lat);
|
||||||
|
p22.ati = demArr(long(p22.lat), long(p22.lon));
|
||||||
|
|
||||||
p0.lon = p0.lon - p11.lon;
|
p0.lon = p0.lon - p11.lon;
|
||||||
p0.lat = p0.lat - p11.lat;
|
p0.lat = p0.lat - p11.lat;
|
||||||
|
|
@ -290,7 +325,7 @@ void InterploateAtiByRefDEM(QString& ImageLLPath, QString& ImageDEMPath, QString
|
||||||
p11.lon = p11.lon - p11.lon;
|
p11.lon = p11.lon - p11.lon;
|
||||||
p11.lat = p11.lat - p11.lat;
|
p11.lat = p11.lat - p11.lat;
|
||||||
|
|
||||||
Bilinear_interpolation(p0, p11, p21, p12, p22);
|
p0.ati=Bilinear_interpolation(p0, p11, p21, p12, p22);
|
||||||
imgatiArr(i, j) = p0.ati;
|
imgatiArr(i, j) = p0.ati;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ void ImagePlaneAtiInterpDialog::onpushButtonRefRangeDEMSelect_clicked()
|
||||||
|
|
||||||
void ImagePlaneAtiInterpDialog::onpushButtonImageLLASelect_clicked()
|
void ImagePlaneAtiInterpDialog::onpushButtonImageLLASelect_clicked()
|
||||||
{
|
{
|
||||||
QString fileNames = QFileDialog::getOpenFileName(
|
QString fileNames = QFileDialog::getSaveFileName(
|
||||||
this, // ??????
|
this, // ??????
|
||||||
tr(u8"Ìáʾ"), // ????
|
tr(u8"Ìáʾ"), // ????
|
||||||
QString(), // ???¡¤??
|
QString(), // ???¡¤??
|
||||||
|
|
@ -88,7 +88,7 @@ void ImagePlaneAtiInterpDialog::onpushButtonImageLLASelect_clicked()
|
||||||
);
|
);
|
||||||
// ??????????????
|
// ??????????????
|
||||||
if (!fileNames.isEmpty()) {
|
if (!fileNames.isEmpty()) {
|
||||||
QString message = "????????§µ?\n";
|
QString message = "选中文件\n";
|
||||||
this->ui->lineEditImageLLAPath->setText(fileNames);
|
this->ui->lineEditImageLLAPath->setText(fileNames);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue