增加了 amp 转dB

pull/10/head
陈增辉 2025-04-21 09:56:53 +08:00
parent d45b397560
commit 11c7f9974d
3 changed files with 44 additions and 16 deletions

View File

@ -325,6 +325,9 @@ void BASECONSTVARIABLEAPI MultiLookRaster(QString inRasterPath, QString outRast
ErrorCode BASECONSTVARIABLEAPI Complex2PhaseRaster(QString inComplexPath, QString outRasterPath);
ErrorCode BASECONSTVARIABLEAPI Complex2dBRaster(QString inComplexPath, QString outRasterPath);
ErrorCode BASECONSTVARIABLEAPI Complex2AmpRaster(QString inComplexPath, QString outRasterPath);
ErrorCode BASECONSTVARIABLEAPI amp2dBRaster(QString inPath, QString outRasterPath);
ErrorCode BASECONSTVARIABLEAPI ResampleDEM(QString indemPath, QString outdemPath, double gridx, double gridy);

View File

@ -1437,7 +1437,7 @@ ErrorCode DEM2XYZRasterAndSlopRaster(QString dempath, QString demxyzpath, QStri
for (int max_rows_ids = 0; max_rows_ids < demds.height; max_rows_ids = max_rows_ids + line_invert) {
qDebug() << "dem -> XYZ [" << max_rows_ids*100.0/ demds.height << "] %" ;
Eigen::MatrixXd demdata = demds.getData(max_rows_ids, 0, line_invert, demds.width, 1);
Eigen::MatrixXd xyzdata_x = demdata.array() * 0;
@ -1488,17 +1488,17 @@ ErrorCode DEM2XYZRasterAndSlopRaster(QString dempath, QString demxyzpath, QStri
Eigen::MatrixXd demsloper_z = demsloperxyz.getData(start_ids - 1, 0, line_invert + 2, demxyz.width, 3);
Eigen::MatrixXd demsloper_angle = demsloperxyz.getData(start_ids - 1, 0, line_invert + 2, demxyz.width, 4);
Landpoint p0, p1, p2, p3, p4, pslopeVector, pp;
Vector3D slopeVector;
dem_rows = demsloper_x.rows();
dem_cols = demsloper_x.cols();
double sloperAngle = 0;
Vector3D Zaxis = { 0,0,1 };
double rowidx = 0, colidx = 0;
//#pragma omp parallel for
#pragma omp parallel for
for (long i = 1; i < dem_rows - 1; i++) {
Landpoint p0, p1, p2, p3, p4, pslopeVector, pp;
Vector3D slopeVector;
double sloperAngle = 0;
Vector3D Zaxis = { 0,0,1 };
double rowidx = 0, colidx = 0;
for (long j = 1; j < dem_cols - 1; j++) {
rowidx = i + startlineid;
colidx = j;
@ -1709,7 +1709,7 @@ ErrorCode Complex2PhaseRaster(QString inComplexPath, QString outRasterPath)
for (startrow = 0; startrow < inimg.height; startrow = startrow + blocklines) {
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, 1);
imgArrb1 = imgArr.array().arg();
ampimg.saveImage(imgArrb1, startrow, 0, 1);
}
@ -1732,7 +1732,7 @@ ErrorCode Complex2dBRaster(QString inComplexPath, QString outRasterPath)
for (startrow = 0; startrow < inimg.height; startrow = startrow + blocklines) {
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, 1);
imgArrb1 = imgArr.array().abs().log10() * 20.0;
ampimg.saveImage(imgArrb1, startrow, 0, 1);
}
@ -1742,6 +1742,28 @@ ErrorCode Complex2dBRaster(QString inComplexPath, QString outRasterPath)
ErrorCode BASECONSTVARIABLEAPI amp2dBRaster(QString inPath, QString outRasterPath)
{
gdalImage inimg(inPath);
gdalImage dBimg = CreategdalImage(outRasterPath, inimg.height, inimg.width, inimg.band_num, inimg.gt, inimg.projection, true, true);
long blocklines = Memory1GB * 2 / 8 / inimg.width;
blocklines = blocklines < 100 ? 100 : blocklines;
Eigen::MatrixXd imgArrdB = Eigen::MatrixXd::Zero(blocklines, dBimg.width);
Eigen::MatrixXd imgArr = Eigen::MatrixXd::Zero(blocklines, inimg.width);
long startrow = 0;
for (startrow = 0; startrow < inimg.height; startrow = startrow + blocklines) {
imgArrdB = dBimg.getData(startrow, 0, blocklines, inimg.width, 1);
imgArr = inimg.getData(startrow, 0, blocklines, inimg.width, 1);
imgArrdB = imgArr.array().log10() * 20.0;
dBimg.saveImage(imgArrdB, startrow, 0, 1);
}
qDebug() << "影像写入到:" << outRasterPath;
return ErrorCode::SUCCESS;
}
void MultiLookRaster(QString inRasterPath, QString outRasterPath, long looklineNumrow, long looklineNumCol)

View File

@ -231,21 +231,24 @@ ErrorCode RD_PSTN(double& refrange, double& lamda, double& timeR, double& R, dou
for (int i = 0; i < 50; i++) {
polyfitmodel.getSatelliteOribtNode(timeR, node, antfalg);
R1 = std::sqrt(std::pow(node.Px - tx, 2) + std::pow(node.Py - ty, 2) + std::pow(node.Pz - tz, 2));
dplerTheory1 = (-2 / lamda / R1) * ((node.Px - tx) * (node.Vx /*+ EARTHWE * ty*/) + (node.Py - ty) * (node.Vy /*- EARTHWE * tz*/) + (node.Pz - tz) * (node.Vz - 0));
//dplerTheory1 = (-2 / lamda / R1) * ((node.Px - tx) * (node.Vx + EARTHWE * ty) + (node.Py - ty) * (node.Vy - EARTHWE * tx) + (node.Pz - tz) * (node.Vz - 0));
dplerTheory1 = (-2 / lamda / R1) * ((node.Px - tx) * (node.Vx + 0) + (node.Py - ty) * (node.Vy -0) + (node.Pz - tz) * (node.Vz - 0));
dplerR = (R1 - refrange) * 1e6 / LIGHTSPEED; // GF3 计算公式
dplerNumber1 = d0 + dplerR * d1 + std::pow(dplerR, 2) * d2 + std::pow(dplerR, 3) * d3 + std::pow(dplerR, 4) * d4;
timeR2 = timeR + dt;
polyfitmodel.getSatelliteOribtNode(timeR2, node, antfalg);
R2 = std::sqrt(std::pow(node.Px - tx, 2) + std::pow(node.Py - ty, 2) + std::pow(node.Pz - tz, 2));
dplerTheory2 = (-2 / lamda/R2) * ((node.Px - tx) * (node.Vx/* + EARTHWE * ty*/) + (node.Py - ty) * (node.Vy /*- EARTHWE * tz*/) + (node.Pz - tz) * (node.Vz - 0));
//dplerTheory2 = (-2 / lamda/R2) * ((node.Px - tx) * (node.Vx + EARTHWE * ty) + (node.Py - ty) * (node.Vy - EARTHWE * tx) + (node.Pz - tz) * (node.Vz - 0));
dplerTheory2 = (-2 / lamda/R2) * ((node.Px - tx) * (node.Vx +0) + (node.Py - ty) * (node.Vy -0) + (node.Pz - tz) * (node.Vz - 0));
//dplerR = (R2 - refrange) * 1e6 / LIGHTSPEED; // GF3 ¼ÆË㹫ʽ
//dplerNumber2 = d0 + dplerR * d1 + std::pow(dplerR, 2) * d2 + std::pow(dplerR, 3) * d3 + std::pow(dplerR, 4) * d4;
inct = (dplerTheory2-dplerNumber1) / (dplerTheory2-dplerTheory1 );
inct = dt*(dplerTheory2-dplerNumber1) / (dplerTheory2 - dplerTheory1);
if (std::abs(dplerNumber1 - dplerTheory2) < 1e-6 || std::abs(inct) < 1.0e-4) {
break;
}
inct = std::abs(inct) < 10 ?inct*1.0e-2:inct*dt;
inct = std::abs(inct) < 10 ?inct:inct*1e-2;
timeR = timeR - inct;
}
R = R1; // 斜距
@ -603,7 +606,7 @@ ErrorCode GF3RDProcess(QString inxmlPath, QString indemPath, QString outworkdir,
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) {
if (GF3RDCreateLookTable(inxmlPath, resampleDEMPath, outworkdir, outlooktablePath, outlocalAnglePath,true) != ErrorCode::SUCCESS) {
qDebug() << u8"查找表生成错误:\t" + getFileNameWidthoutExtend(inxmlPath);
return ErrorCode::FAIL;
}