parent
3c1fd3a91a
commit
4553521991
|
@ -154,7 +154,7 @@ struct Vector3_single {
|
|||
|
||||
|
||||
/*********************************************** FEKO仿真参数 ********************************************************************/
|
||||
struct SatellitePos {
|
||||
extern "C" struct SatellitePos {
|
||||
double time;
|
||||
double Px ;
|
||||
double Py ;
|
||||
|
@ -165,7 +165,7 @@ struct SatellitePos {
|
|||
};
|
||||
|
||||
|
||||
struct SatelliteAntPos {
|
||||
extern "C" struct SatelliteAntPos {
|
||||
double time; // 0
|
||||
double Px;
|
||||
double Py;
|
||||
|
@ -188,7 +188,7 @@ struct SatelliteAntPos {
|
|||
};
|
||||
|
||||
|
||||
struct PatternImageDesc {
|
||||
extern "C" struct PatternImageDesc {
|
||||
long phinum;
|
||||
long thetanum;
|
||||
double startTheta;
|
||||
|
|
|
@ -135,6 +135,44 @@ Landpoint XYZ2LLA(const Landpoint& XYZ) {
|
|||
|
||||
|
||||
|
||||
void XYZ2BLH_FixedHeight(double x, double y, double z,double ati, Landpoint& point) {
|
||||
const double a = 6378137.0; // WGS84长半轴
|
||||
const double f = 1.0 / 298.257223563;
|
||||
const double e2 = 2 * f - f * f; // 第一偏心率平方
|
||||
|
||||
// 计算经度L (弧度)
|
||||
const double L_rad = std::atan2(y, x);
|
||||
point.lon = L_rad * 180.0 / M_PI; // 转为度
|
||||
|
||||
const double p = std::sqrt(x * x + y * y);
|
||||
const double H = ati; // 使用已知高度
|
||||
|
||||
// 初始纬度估算(考虑已知高度H)
|
||||
double B_rad = std::atan2(z, p * (1 - e2 * (a / (a + H))));
|
||||
|
||||
// 迭代计算纬度B(固定H)
|
||||
for (int i = 0; i < 10; ++i) { // 已知H时迭代次数减少
|
||||
const double sin_B = std::sin(B_rad);
|
||||
const double N = a / std::sqrt(1 - e2 * sin_B * sin_B);
|
||||
const double delta = e2 * N / (N + H); // 高度固定时的修正项
|
||||
|
||||
const double B_new = std::atan2(z, p * (1 - delta));
|
||||
|
||||
if (std::abs(B_new - B_rad) < 1e-9) {
|
||||
B_rad = B_new;
|
||||
break;
|
||||
}
|
||||
B_rad = B_new;
|
||||
}
|
||||
|
||||
point.lat = B_rad * 180.0 / M_PI; // 弧度转度
|
||||
|
||||
// 经度范围修正 [-180°, 180°]
|
||||
point.lon = std::fmod(point.lon + 360.0, 360.0);
|
||||
if (point.lon > 180.0) point.lon -= 360.0;
|
||||
point.ati = ati;
|
||||
}
|
||||
|
||||
|
||||
double getAngle(const Landpoint& a, const Landpoint& b)
|
||||
{
|
||||
|
|
|
@ -30,6 +30,7 @@ Eigen::MatrixXd BASECONSTVARIABLEAPI LLA2XYZ(Eigen::MatrixXd landpoint);
|
|||
/// <returns>经纬度--degree</returns>
|
||||
Landpoint BASECONSTVARIABLEAPI XYZ2LLA(const Landpoint& XYZ);
|
||||
|
||||
void BASECONSTVARIABLEAPI XYZ2BLH_FixedHeight(double x, double y, double z, double ati, Landpoint& point);
|
||||
|
||||
Landpoint BASECONSTVARIABLEAPI operator +(const Landpoint& p1, const Landpoint& p2);
|
||||
|
||||
|
|
|
@ -32,5 +32,10 @@ QString QToolAbstract::getToolName()
|
|||
}
|
||||
|
||||
void QToolAbstract::excute()
|
||||
{
|
||||
this->run();
|
||||
}
|
||||
|
||||
void QToolAbstract::run()
|
||||
{
|
||||
}
|
||||
|
|
|
@ -27,6 +27,8 @@ public slots:
|
|||
public:
|
||||
QVector<QString> toolPath;
|
||||
QString toolname;
|
||||
public:
|
||||
virtual void run();
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
@ -0,0 +1,204 @@
|
|||
#include "GPUBaseTool.h"
|
||||
#include "GPUBPTool.cuh"
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
#include <cmath>
|
||||
#include <complex>
|
||||
#include <device_launch_parameters.h>
|
||||
#include <cuda_runtime.h>
|
||||
#include <cublas_v2.h>
|
||||
#include <cuComplex.h>
|
||||
|
||||
#include "BaseConstVariable.h"
|
||||
#include "GPUBPImageNet.cuh"
|
||||
|
||||
#ifndef MAX_ITER
|
||||
#define EPSILON 1e-12
|
||||
#define MAX_ITER 50
|
||||
#endif
|
||||
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.14159265358979323846
|
||||
#endif
|
||||
|
||||
|
||||
__global__ void kernel_TimeBPImageGridNet(
|
||||
double* antPx, double* antPy, double* antPz,
|
||||
double* antDirx, double* antDiry, double* antDirz,
|
||||
double* imgx, double* imgy, double* imgz,
|
||||
long prfcount, long freqpoints, double meanH,
|
||||
double Rnear, double dx) {
|
||||
|
||||
long idx = blockIdx.x * blockDim.x + threadIdx.x;
|
||||
long pixelcount = prfcount * freqpoints;
|
||||
long prfid = idx / freqpoints;
|
||||
long Rid = idx % freqpoints;
|
||||
if (idx < pixelcount) {
|
||||
// 计算坐标
|
||||
Vector3 S = { antPx[prfid], antPy[prfid], antPz[prfid] }; // 卫星位置 (m)
|
||||
Vector3 ray = { antDirx[prfid], antDiry[prfid], antDirz[prfid] }; // 视线方向
|
||||
double H = meanH; // 平均高程
|
||||
double R = Rnear + dx * Rid; // 目标距离
|
||||
// 参数校验
|
||||
if (R <= 0 || H < -WGS84_A * 0.1 || H > WGS84_A * 0.1) {
|
||||
//printf("参数错误:\n H范围:±%.1f km\n R必须>0\n", WGS84_A * 0.1 / 1000);
|
||||
imgx[idx] = 0;
|
||||
imgy[idx] = 0;
|
||||
imgz[idx] = 0;
|
||||
return;
|
||||
//printf("idx=%d;prfid=%d;Rid=%d;S=[%f , %f ,%f ];ray=[%f ,%f ,%f ];H=%f;R=%f,imgP=[%f ,%f , %f ];Rextend\n",
|
||||
// idx, prfid, Rid, S.x, S.y, S.z, ray.x, ray.y, ray.z, H, R,imgx[idx],imgy[idx],imgz[idx]);
|
||||
// 参数校验
|
||||
//return;
|
||||
}
|
||||
|
||||
// Step 1: 计算交点T
|
||||
Vector3 T = compute_T(S, ray, H);
|
||||
if (isnan(T.x)) {
|
||||
imgx[idx] = 0;
|
||||
imgy[idx] = 0;
|
||||
imgz[idx] = 0;
|
||||
//printf("idx=%d;prfid=%d;Rid=%d;Tnan\n",
|
||||
// idx, prfid, Rid, S.x, S.y, S.z, ray.x, ray.y, ray.z, H, R,T.x,T.y,T.z, imgx[idx], imgy[idx], imgz[idx]);
|
||||
return;
|
||||
}
|
||||
|
||||
// Step 2: 计算目标点P
|
||||
|
||||
Vector3 P;// = compute_P(S, T, R, H);
|
||||
{ // 计算P
|
||||
Vector3 ex, ey, ez; // 平面基函数
|
||||
Vector3 ST = vec_normalize(vec_sub(T, S));// S->T
|
||||
Vector3 SO = vec_normalize(vec_sub(Vector3{ 0, 0, 0 }, S)); // S->O
|
||||
|
||||
|
||||
Vector3 st1 = vec_sub(T, S);
|
||||
double R0 = sqrt(st1.x * st1.x + st1.y * st1.y + st1.z * st1.z);
|
||||
ez = vec_normalize(vec_cross(SO, ST)); // Z 轴
|
||||
ey = vec_normalize(vec_cross(ez, SO)); // Y 轴 与 ST 同向 --这个结论在星地几何约束,便是显然的;
|
||||
ex = vec_normalize(SO); //X轴
|
||||
|
||||
|
||||
|
||||
double h2 = (WGS84_A + H) * (WGS84_A + H);
|
||||
double b2 = WGS84_B * WGS84_B;
|
||||
double R2 = R * R;
|
||||
double A = R2 * ((ex.x * ex.x + ex.y * ex.y) / h2 + (ex.z * ex.z) / b2);
|
||||
double B = R2 * ((ex.x * ey.x + ex.y * ey.y) / h2 + (ex.z * ey.z) / b2) * 2;
|
||||
double C = R2 * ((ey.x * ey.x + ey.y * ey.y) / h2 + (ey.z * ey.z) / b2);
|
||||
double D = 1 - ((S.x * S.x + S.y * S.y) / h2 + (S.z * S.z) / b2);
|
||||
double E = 2 * R * ((S.x * ex.x + S.y * ex.y) / h2 + (S.z * ex.z) / b2);
|
||||
double F = 2 * R * ((S.x * ey.x + S.y * ey.y) / h2 + (S.z * ey.z) / b2);
|
||||
double Q0 = angleBetweenVectors(SO, ST, false);
|
||||
double dQ = 0;
|
||||
double fQ = 0;
|
||||
double dfQ = 0;
|
||||
double Q = R < R0 ? Q0 - 1e-3 : Q0 + 1e-3;
|
||||
|
||||
//printf("A=%f;B=%f;C=%f;D=%f;E=%f;F=%f;Q=%f;\
|
||||
// S=[%f , %f ,%f ];\
|
||||
// T=[%f , %f ,%f ];\
|
||||
// ex=[%f , %f ,%f ];\
|
||||
// ey=[%f , %f ,%f ];\
|
||||
// ez=[%f , %f ,%f ];\
|
||||
//ray=[%f ,%f ,%f ];\
|
||||
//H=%f;R=%f;;\n",A,B,C,D,E,F,Q,
|
||||
// S.x,S.y,S.z,
|
||||
// T.x,T.y,T.z ,
|
||||
// ex.x,ex.y,ex.z,
|
||||
// ey.x,ey.y,ey.z,
|
||||
// ez.x,ez.y,ez.z,
|
||||
// ray.x, ray.y, ray.z,
|
||||
// H, R);
|
||||
// return;
|
||||
|
||||
// 牛顿迭代法
|
||||
for (int iter = 0; iter < MAX_ITER * 10; ++iter) {
|
||||
fQ = A * cos(Q) * cos(Q) + B * sin(Q) * cos(Q) + C * sin(Q) * sin(Q) + E * cos(Q) + F * sin(Q) - D;
|
||||
dfQ = (C - A) * sin(2 * Q) + B * cos(2 * Q) - E * sin(Q) + F * cos(Q);
|
||||
dQ = fQ / dfQ;
|
||||
if (abs(dQ) < 1e-8) {
|
||||
//printf("iter=%d;check Q0=%f;Q=%f;dQ=%f;fQ=%f;dfQ=%f;break\n", iter, Q0, Q, dQ, fQ, dfQ);
|
||||
break;
|
||||
}
|
||||
else {
|
||||
dQ = (abs(dQ) < d2r * 3) ? dQ : (abs(dQ) / dQ * d2r * 3);
|
||||
Q = Q - dQ;
|
||||
//printf("iter=%d;check Q0=%f;Q=%f;dQ=%f;fQ=%f;dfQ=%f;\n", iter, Q0, Q, dQ, fQ, dfQ);
|
||||
}
|
||||
|
||||
}
|
||||
//printf("check Q0=%f;Q=%f;\n", Q0, Q);
|
||||
double t1 = R * cos(Q);
|
||||
double t2 = R * sin(Q);
|
||||
P = Vector3{
|
||||
S.x + t1 * ex.x + t2 * ey.x, //因为 t3=0;
|
||||
S.y + t1 * ex.y + t2 * ey.y,
|
||||
S.z + t1 * ex.z + t2 * ey.z,
|
||||
};
|
||||
double check = (P.x * P.x + P.y * P.y) / ((WGS84_A + H) * (WGS84_A + H))
|
||||
+ P.z * P.z / (WGS84_B * WGS84_B);
|
||||
if (isnan(Q) || isinf(Q) || fabs(check - 1.0) > 1e-6) {
|
||||
P = Vector3{ 0,0,0 };
|
||||
imgx[idx] = 0;
|
||||
imgy[idx] = 0;
|
||||
imgz[idx] = 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
double Rt = sqrt(pow(S.x - T.x, 2) + pow(S.y - T.y, 2) + pow(S.z - T.z, 2));
|
||||
double Rp = sqrt(pow(S.x - P.x, 2) + pow(S.y - P.y, 2) + pow(S.z - P.z, 2));
|
||||
double Rop = sqrt(pow(P.x, 2) + pow(P.y, 2) + pow(P.z, 2));
|
||||
|
||||
if (!isnan(P.x) && (Rop > WGS84_A * 0.3) && (Rop < WGS84_A * 3)) {
|
||||
|
||||
imgx[idx] = P.x;
|
||||
imgy[idx] = P.y;
|
||||
imgz[idx] = P.z;
|
||||
return;
|
||||
//printf("idx=%d; S=[%f , %f ,%f ]; H=%f;R=%f;RP=%f;Rr=%f;imgT=[%f ,%f ,%f ];imgP=[%f ,%f , %f ]; \n",
|
||||
// idx, S.x, S.y, S.z, H, R, Rp, Rt,T.x, T.y, T.z, P.x, P.y, P.z);
|
||||
}
|
||||
else {
|
||||
imgx[idx] = 0;
|
||||
imgy[idx] = 0;
|
||||
imgz[idx] = 0;
|
||||
printf("idx=%d; S=[%f , %f ,%f ]; H=%f;R=%f;RP=%f;Rr=%f;imgT=[%f ,%f ,%f ];imgP=[%f ,%f , %f ]; ERROR\n",
|
||||
idx, S.x, S.y, S.z, H, R, Rp, Rt, T.x, T.y, T.z, P.x, P.y, P.z);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void TIMEBPCreateImageGrid(double* antPx, double* antPy, double* antPz,
|
||||
double* antDirx, double* antDiry, double* antDirz,
|
||||
double* imgx, double* imgy, double* imgz,
|
||||
long prfcount, long freqpoints, double meanH,
|
||||
double Rnear, double dx
|
||||
)
|
||||
{
|
||||
long pixelcount = prfcount * freqpoints;
|
||||
int grid_size = (pixelcount + BLOCK_SIZE - 1) / BLOCK_SIZE;
|
||||
|
||||
kernel_TimeBPImageGridNet << <grid_size, BLOCK_SIZE >> > (
|
||||
antPx, antPy, antPz,
|
||||
antDirx, antDiry, antDirz,
|
||||
imgx, imgy, imgz,
|
||||
prfcount, freqpoints, meanH,
|
||||
Rnear, dx);
|
||||
PrintLasterError("TIMEBPCreateImageGrid");
|
||||
cudaDeviceSynchronize();
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
#ifndef __GPUBPIMAGENET_CUH___
|
||||
#define __GPUBPIMAGENET_CUH___
|
||||
|
||||
|
||||
#include "BaseConstVariable.h"
|
||||
#include "GPUTool.cuh"
|
||||
#include <cuda_runtime.h>
|
||||
#include <device_launch_parameters.h>
|
||||
#include <cublas_v2.h>
|
||||
#include <cuComplex.h>
|
||||
#include "GPUTool.cuh"
|
||||
#include "GPUBPTool.cuh"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
extern "C" void TIMEBPCreateImageGrid(
|
||||
double* antPx, double* antPy, double* antPz, // ÎÀÐÇ×ø±ê S
|
||||
double* antDirx, double* antDiry, double* antDirz, //
|
||||
double* imgx, double* imgy, double* imgz,
|
||||
long prfcount, long freqpoints, double meanH,
|
||||
double Rnear, double dx
|
||||
);
|
||||
|
||||
|
||||
|
||||
#endif
|
|
@ -0,0 +1,173 @@
|
|||
#include "ImageNetOperator.h"
|
||||
#include "LogInfoCls.h"
|
||||
#include "PrintMsgToQDebug.h"
|
||||
#include <QDebug>
|
||||
#include "ImageOperatorBase.h"
|
||||
#include "GPUBaseTool.h"
|
||||
#include "GPUBPImageNet.cuh"
|
||||
|
||||
|
||||
void InitCreateImageXYZProcess(QString& outImageLLPath, QString& outImageXYZPath, QString& InEchoGPSDataPath,
|
||||
double& NearRange, double& RangeResolution, int64_t& RangeNum)
|
||||
{
|
||||
qDebug() << "---------------------------------------------------------------------------------";
|
||||
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;
|
||||
qDebug() << u8"2.斜距网格参数:";
|
||||
qDebug() << u8"近距离:\t" << NearRange;
|
||||
qDebug() << u8"分辨率:\t" << RangeResolution;
|
||||
qDebug() << u8"网格点数:\t" << RangeNum;
|
||||
qDebug() << u8"3.输出文件参数:";
|
||||
gdalImage outimgll = CreategdalImageDouble(outImageLLPath, antimg.height,RangeNum, 3,true,true);
|
||||
gdalImage outimgxyz = CreategdalImageDouble(outImageXYZPath, antimg.height, RangeNum, 3, true, true);
|
||||
qDebug() << u8"成像平面文件(经纬度)网格路径:\t" << outImageLLPath;
|
||||
qDebug() << u8"成像平面文件(XYZ)网格路径:\t" << outImageXYZPath;
|
||||
qDebug() << u8"4.开始创建成像网格XYZ";
|
||||
long prfcount = antimg.height;
|
||||
long rangeNum = RangeNum;
|
||||
double Rnear = NearRange;
|
||||
double dx = RangeResolution;
|
||||
|
||||
long blockRangeCount = Memory1GB / sizeof(double) / 4 / prfcount *6;
|
||||
blockRangeCount = blockRangeCount < 1 ? 1 : blockRangeCount;
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
std::shared_ptr<double> d_Pxs((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice);
|
||||
std::shared_ptr<double> d_Pys((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice);
|
||||
std::shared_ptr<double> d_Pzs((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice);
|
||||
std::shared_ptr<double> d_AntDirectX((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice);
|
||||
std::shared_ptr<double> d_AntDirectY((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice);
|
||||
std::shared_ptr<double> d_AntDirectZ((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice);
|
||||
|
||||
HostToDevice(Pxs.get(), d_Pxs.get(), sizeof(double) * prfcount);
|
||||
HostToDevice(Pys.get(), d_Pys.get(), sizeof(double) * prfcount);
|
||||
HostToDevice(Pzs.get(), d_Pzs.get(), sizeof(double) * prfcount);
|
||||
HostToDevice(AntDirectX.get(), d_AntDirectX.get(), sizeof(double) * prfcount);
|
||||
HostToDevice(AntDirectY.get(), d_AntDirectY.get(), sizeof(double) * prfcount);
|
||||
HostToDevice(AntDirectZ.get(), d_AntDirectZ.get(), sizeof(double) * prfcount);
|
||||
|
||||
|
||||
for (long startcolidx = 0; startcolidx < RangeNum; startcolidx = startcolidx + blockRangeCount) {
|
||||
|
||||
long tempechocol = blockRangeCount;
|
||||
if (startcolidx + tempechocol >= RangeNum) {
|
||||
tempechocol = RangeNum - startcolidx;
|
||||
}
|
||||
qDebug() << " imgxyz :\t" << startcolidx << "\t-\t" << startcolidx + tempechocol << " / " << RangeNum;
|
||||
|
||||
std::shared_ptr<double> demx = readDataArr<double>(outimgxyz, 0, startcolidx, prfcount, tempechocol, 1, GDALREADARRCOPYMETHOD::VARIABLEMETHOD);
|
||||
std::shared_ptr<double> demy = readDataArr<double>(outimgxyz, 0, startcolidx, prfcount, tempechocol, 2, GDALREADARRCOPYMETHOD::VARIABLEMETHOD);
|
||||
std::shared_ptr<double> demz = readDataArr<double>(outimgxyz, 0, startcolidx, prfcount, tempechocol, 3, GDALREADARRCOPYMETHOD::VARIABLEMETHOD);
|
||||
|
||||
std::shared_ptr<double> h_demx((double*)mallocCUDAHost(sizeof(double) * prfcount * tempechocol), FreeCUDAHost);
|
||||
std::shared_ptr<double> h_demy((double*)mallocCUDAHost(sizeof(double) * prfcount * tempechocol), FreeCUDAHost);
|
||||
std::shared_ptr<double> h_demz((double*)mallocCUDAHost(sizeof(double) * prfcount * tempechocol), FreeCUDAHost);
|
||||
|
||||
#pragma omp parallel for
|
||||
for (long ii = 0; ii < prfcount; ii++) {
|
||||
for (long jj = 0; jj < tempechocol; jj++) {
|
||||
h_demx.get()[ii * tempechocol + jj] = demx.get()[ii * tempechocol + jj];
|
||||
h_demy.get()[ii * tempechocol + jj] = demy.get()[ii * tempechocol + jj];
|
||||
h_demz.get()[ii * tempechocol + jj] = demz.get()[ii * tempechocol + jj];
|
||||
}
|
||||
}
|
||||
|
||||
std::shared_ptr<double> d_demx((double*)mallocCUDADevice(sizeof(double) * prfcount * tempechocol), FreeCUDADevice);
|
||||
std::shared_ptr<double> d_demy((double*)mallocCUDADevice(sizeof(double) * prfcount * tempechocol), FreeCUDADevice);
|
||||
std::shared_ptr<double> d_demz((double*)mallocCUDADevice(sizeof(double) * prfcount * tempechocol), FreeCUDADevice);
|
||||
|
||||
HostToDevice(h_demx.get(), d_demx.get(), sizeof(double) * prfcount * tempechocol);
|
||||
HostToDevice(h_demy.get(), d_demy.get(), sizeof(double) * prfcount * tempechocol);
|
||||
HostToDevice(h_demz.get(), d_demz.get(), sizeof(double) * prfcount * tempechocol);
|
||||
|
||||
|
||||
TIMEBPCreateImageGrid(
|
||||
d_Pxs.get(), d_Pys.get(), d_Pzs.get(),
|
||||
d_AntDirectX.get(), d_AntDirectY.get(), d_AntDirectZ.get(),
|
||||
d_demx.get(), d_demy.get(), d_demz.get(),
|
||||
prfcount, tempechocol, 0,
|
||||
Rnear + dx * startcolidx, dx // 更新最近修读
|
||||
);
|
||||
|
||||
DeviceToHost(h_demx.get(), d_demx.get(), sizeof(double) * prfcount * tempechocol);
|
||||
DeviceToHost(h_demy.get(), d_demy.get(), sizeof(double) * prfcount * tempechocol);
|
||||
DeviceToHost(h_demz.get(), d_demz.get(), sizeof(double) * prfcount * tempechocol);
|
||||
|
||||
#pragma omp parallel for
|
||||
for (long ii = 0; ii < prfcount; ii++) {
|
||||
for (long jj = 0; jj < tempechocol; jj++) {
|
||||
demx.get()[ii * tempechocol + jj] = h_demx.get()[ii * tempechocol + jj];
|
||||
demy.get()[ii * tempechocol + jj] = h_demy.get()[ii * tempechocol + jj];
|
||||
demz.get()[ii * tempechocol + jj] = h_demz.get()[ii * tempechocol + jj];
|
||||
}
|
||||
}
|
||||
|
||||
outimgxyz.saveImage(demx, 0, startcolidx, prfcount, tempechocol, 1);
|
||||
outimgxyz.saveImage(demy, 0, startcolidx, prfcount, tempechocol, 2);
|
||||
outimgxyz.saveImage(demz, 0, startcolidx, prfcount, tempechocol, 3);
|
||||
|
||||
// 将XYZ转换为经纬度
|
||||
std::shared_ptr<double> demllx = readDataArr<double>(outimgll, 0, startcolidx, prfcount, tempechocol, 1, GDALREADARRCOPYMETHOD::VARIABLEMETHOD);
|
||||
std::shared_ptr<double> demlly = readDataArr<double>(outimgll, 0, startcolidx, prfcount, tempechocol, 2, GDALREADARRCOPYMETHOD::VARIABLEMETHOD);
|
||||
std::shared_ptr<double> demllz = readDataArr<double>(outimgll, 0, startcolidx, prfcount, tempechocol, 3, GDALREADARRCOPYMETHOD::VARIABLEMETHOD);
|
||||
|
||||
#pragma omp parallel for
|
||||
for (long ii = 0; ii < prfcount; ii++) {
|
||||
for (long jj = 0; jj < tempechocol; jj++) {
|
||||
double x = demx.get()[ii * tempechocol + jj];
|
||||
double y = demy.get()[ii * tempechocol + jj];
|
||||
double z = demz.get()[ii * tempechocol + jj];
|
||||
Landpoint point;
|
||||
XYZ2BLH_FixedHeight(x, y, z, 0, point);
|
||||
demllx.get()[ii * tempechocol + jj] = point.lon;
|
||||
demlly.get()[ii * tempechocol + jj] = point.lat;
|
||||
demllz.get()[ii * tempechocol + jj] = point.ati;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
outimgll.saveImage(demllx, 0, startcolidx, prfcount, tempechocol, 1);
|
||||
outimgll.saveImage(demlly, 0, startcolidx, prfcount, tempechocol, 2);
|
||||
outimgll.saveImage(demllz, 0, startcolidx, prfcount, tempechocol, 3);
|
||||
|
||||
}
|
||||
|
||||
qDebug() << u8"6.保存成像网格结果";
|
||||
qDebug() << "---------------------------------------------------------------------------------";
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
#pragma once
|
||||
#ifndef __ImageNetOperator__H_
|
||||
#define __ImageNetOperator__H_
|
||||
#include "BaseConstVariable.h"
|
||||
#include <QString>
|
||||
|
||||
|
||||
void InitCreateImageXYZProcess(QString& outImageLLPath, QString& outImageXYZPath, QString& InEchoGPSDataPath, double& NearRange, double& RangeResolution, int64_t& RangeNum);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
|
@ -0,0 +1,77 @@
|
|||
#include "InitCreateImageXYZDialog.h"
|
||||
#include "ui_InitCreateImageXYZDialog.h"
|
||||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
#include "ImageNetOperator.h"
|
||||
|
||||
InitCreateImageXYZDialog::InitCreateImageXYZDialog(QWidget *parent)
|
||||
: QDialog(parent), ui(new Ui::InitCreateImageXYZDialogClass)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
InitCreateImageXYZDialog::~InitCreateImageXYZDialog()
|
||||
{}
|
||||
|
||||
void InitCreateImageXYZDialog::on_pushButtonImageLLSelect_clicked()
|
||||
{
|
||||
QString fileNamePath = QFileDialog::getSaveFileName(
|
||||
this, // 父窗口
|
||||
tr(u8"保存经纬度成像网格"), // 标题
|
||||
QString(), // 默认路径
|
||||
tr(u8"ENVI Bin(*.bin);;ENVI Data(*.dat);;ENVI Data(*.data);;tiff影像(*.tif);;tiff影像(*.tiff)") // 文件过滤器
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
void InitCreateImageXYZDialog::on_pushButtonImageXYZSelect_clicked()
|
||||
{
|
||||
QString fileNamePath = QFileDialog::getSaveFileName(
|
||||
this, // 父窗口
|
||||
tr(u8"保存XYZ成像网格"), // 标题
|
||||
QString(), // 默认路径
|
||||
tr(u8"ENVI Bin(*.bin);;ENVI Data(*.dat);;ENVI Data(*.data);;tiff影像(*.tif);;tiff影像(*.tiff)") // 文件过滤器
|
||||
);
|
||||
}
|
||||
|
||||
void InitCreateImageXYZDialog::on_pushButtonEchoGPSDataSelect_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->lineEditEchoGPSDataPath->setText(fileNames);
|
||||
}
|
||||
else {
|
||||
QMessageBox::information(this, tr(u8"没有选择文件"), tr(u8"没有选择任何文件。"));
|
||||
}
|
||||
}
|
||||
|
||||
void InitCreateImageXYZDialog::on_buttonBox_accepted()
|
||||
{
|
||||
double NearRange = this->ui->doubleSpinBoxNearRange->value();
|
||||
double RangeResolution = this->ui->doubleSpinBoxRangeResolution->value();
|
||||
int64_t RangeNum = this->ui->spinBoxRangeNum->value();
|
||||
QString imageLLPath = this->ui->lineEditImageLLPath->text().trimmed();
|
||||
QString imageXYZPath = this->ui->lineEditImageXYZPath->text().trimmed();
|
||||
QString echoGPSDataPath = this->ui->lineEditEchoGPSDataPath->text().trimmed();
|
||||
|
||||
InitCreateImageXYZProcess(imageLLPath, imageXYZPath, echoGPSDataPath, NearRange, RangeResolution, RangeNum);
|
||||
if (imageLLPath.isEmpty() || imageXYZPath.isEmpty() || echoGPSDataPath.isEmpty()) {
|
||||
QMessageBox::information(this, tr(u8"没有选择文件"), tr(u8"没有选择任何文件。"));
|
||||
return;
|
||||
}
|
||||
QMessageBox::information(this, tr(u8"提示"), tr(u8"完成"));
|
||||
|
||||
}
|
||||
|
||||
void InitCreateImageXYZDialog::on_buttonBox_rejected()
|
||||
{
|
||||
this->close();
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
#pragma once
|
||||
#ifndef __InitCreateImageXYZDialog__HH__
|
||||
#define __InitCreateImageXYZDialog__HH__
|
||||
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
|
||||
namespace Ui {
|
||||
class InitCreateImageXYZDialogClass;
|
||||
}
|
||||
|
||||
|
||||
class InitCreateImageXYZDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
InitCreateImageXYZDialog(QWidget *parent = nullptr);
|
||||
~InitCreateImageXYZDialog();
|
||||
|
||||
|
||||
public :
|
||||
void on_pushButtonImageLLSelect_clicked();
|
||||
void on_pushButtonImageXYZSelect_clicked();
|
||||
void on_pushButtonEchoGPSDataSelect_clicked();
|
||||
void on_buttonBox_accepted();
|
||||
void on_buttonBox_rejected();
|
||||
|
||||
|
||||
private:
|
||||
Ui::InitCreateImageXYZDialogClass* ui;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
|
@ -0,0 +1,250 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>InitCreateImageXYZDialogClass</class>
|
||||
<widget class="QDialog" name="InitCreateImageXYZDialogClass">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>600</width>
|
||||
<height>400</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>初始化成像平面网格</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<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>成像网格(XYZ):</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QPushButton" name="pushButtonImageLLSelect">
|
||||
<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="pushButtonImageXYZSelect">
|
||||
<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="lineEditImageXYZPath">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>D:\Programme\vs2022\RasterMergeTest\LAMPCAE_SCANE-all-scane\BPImage\GF3BPImage</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="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<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="lineEditEchoGPSDataPath">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>D:\Programme\vs2022\RasterMergeTest\LAMPCAE_SCANE-all-scane\GF3_Simulation.xml</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="pushButtonEchoGPSDataSelect">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>选择</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="3">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="lineEditImageLLPath">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>D:\Programme\vs2022\RasterMergeTest\LAMPCAE_SCANE-all-scane\BPImage\GF3BPImage</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="3">
|
||||
<widget class="QScrollArea" name="scrollArea">
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="scrollAreaWidgetContents">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>580</width>
|
||||
<height>236</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>方位向参数</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>方位向的像素数与回波GPS脉冲数一致</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>距离向参数</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>近斜距</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QDoubleSpinBox" name="doubleSpinBoxRangeResolution">
|
||||
<property name="decimals">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>1000000000000000000.000000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.010000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QDoubleSpinBox" name="doubleSpinBoxNearRange">
|
||||
<property name="decimals">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>99999999999999991611392.000000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.000100000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>距离向间隔</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>距离向像素数</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QSpinBox" name="spinBoxRangeNum">
|
||||
<property name="maximum">
|
||||
<number>999999999</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -1,3 +1,7 @@
|
|||
#ifndef __GPUBPTOOL_CUH___
|
||||
#define __GPUBPTOOL_CUH___
|
||||
|
||||
|
||||
#include "BaseConstVariable.h"
|
||||
#include "GPUTool.cuh"
|
||||
#include <cuda_runtime.h>
|
||||
|
@ -7,7 +11,6 @@
|
|||
#include "GPUTool.cuh"
|
||||
|
||||
|
||||
|
||||
extern __device__ double angleBetweenVectors(Vector3 a, Vector3 b, bool returnDegrees = false);
|
||||
extern __device__ Vector3 vec_sub(Vector3 a, Vector3 b);
|
||||
extern __device__ double vec_dot(Vector3 a, Vector3 b);
|
||||
|
@ -21,3 +24,5 @@ extern __device__ double angleBetweenVectors_single(Vector3_single a, Vector3_s
|
|||
extern __device__ Vector3_single vec_sub_single(Vector3_single a, Vector3_single b);
|
||||
extern __device__ float vec_dot_single(Vector3_single a, Vector3_single b);
|
||||
extern __device__ Vector3_single vec_cross_single(Vector3_single a, Vector3_single b);
|
||||
|
||||
#endif
|
|
@ -24,152 +24,6 @@
|
|||
|
||||
|
||||
|
||||
__global__ void kernel_TimeBPImageGridNet(double* antPx, double* antPy, double* antPz,
|
||||
double* antDirx, double* antDiry, double* antDirz,
|
||||
double* imgx, double* imgy, double* imgz,
|
||||
long prfcount, long freqpoints, double meanH,
|
||||
double Rnear, double dx, double RefRange) {
|
||||
|
||||
long idx = blockIdx.x * blockDim.x + threadIdx.x;
|
||||
long pixelcount = prfcount * freqpoints;
|
||||
long prfid = idx / freqpoints;
|
||||
long Rid = idx % freqpoints;
|
||||
if (idx < pixelcount) {
|
||||
// 计算坐标
|
||||
Vector3 S = { antPx[prfid], antPy[prfid], antPz[prfid] }; // 卫星位置 (m)
|
||||
Vector3 ray = { antDirx[prfid], antDiry[prfid], antDirz[prfid] }; // 视线方向
|
||||
double H = meanH; // 平均高程
|
||||
double R = Rnear + dx * Rid; // 目标距离
|
||||
// 参数校验
|
||||
if (R <= 0 || H < -WGS84_A * 0.1 || H > WGS84_A * 0.1) {
|
||||
//printf("参数错误:\n H范围:±%.1f km\n R必须>0\n", WGS84_A * 0.1 / 1000);
|
||||
imgx[idx] = NAN;
|
||||
imgy[idx] = NAN;
|
||||
imgz[idx] = NAN;
|
||||
//printf("idx=%d;prfid=%d;Rid=%d;S=[%f , %f ,%f ];ray=[%f ,%f ,%f ];H=%f;R=%f,imgP=[%f ,%f , %f ];Rextend\n",
|
||||
// idx, prfid, Rid, S.x, S.y, S.z, ray.x, ray.y, ray.z, H, R,imgx[idx],imgy[idx],imgz[idx]);
|
||||
// 参数校验
|
||||
return;
|
||||
}
|
||||
|
||||
// Step 1: 计算交点T
|
||||
Vector3 T = compute_T(S, ray, H);
|
||||
if (isnan(T.x)) {
|
||||
imgx[idx] = NAN;
|
||||
imgy[idx] = NAN;
|
||||
imgz[idx] = NAN;
|
||||
//printf("idx=%d;prfid=%d;Rid=%d;Tnan\n",
|
||||
// idx, prfid, Rid, S.x, S.y, S.z, ray.x, ray.y, ray.z, H, R,T.x,T.y,T.z, imgx[idx], imgy[idx], imgz[idx]);
|
||||
return;
|
||||
}
|
||||
|
||||
// Step 2: 计算目标点P
|
||||
|
||||
Vector3 P;// = compute_P(S, T, R, H);
|
||||
{ // 计算P
|
||||
Vector3 ex, ey, ez; // 平面基函数
|
||||
Vector3 ST = vec_normalize(vec_sub(T, S));// S->T
|
||||
Vector3 SO = vec_normalize(vec_sub(Vector3{ 0, 0, 0 }, S)); // S->O
|
||||
|
||||
|
||||
Vector3 st1 = vec_sub(T, S);
|
||||
double R0 = sqrt(st1.x * st1.x + st1.y * st1.y + st1.z * st1.z);
|
||||
ez = vec_normalize(vec_cross(SO, ST)); // Z 轴
|
||||
ey = vec_normalize(vec_cross(ez, SO)); // Y 轴 与 ST 同向 --这个结论在星地几何约束,便是显然的;
|
||||
ex = vec_normalize(SO); //X轴
|
||||
|
||||
|
||||
|
||||
double h2 = (WGS84_A + H) * (WGS84_A + H);
|
||||
double b2 = WGS84_B * WGS84_B;
|
||||
double R2 = R * R;
|
||||
double A = R2 * ((ex.x * ex.x + ex.y * ex.y) / h2 + (ex.z * ex.z) / b2);
|
||||
double B = R2 * ((ex.x * ey.x + ex.y * ey.y) / h2 + (ex.z * ey.z) / b2) * 2;
|
||||
double C = R2 * ((ey.x * ey.x + ey.y * ey.y) / h2 + (ey.z * ey.z) / b2);
|
||||
double D = 1 - ((S.x * S.x + S.y * S.y) / h2 + (S.z * S.z) / b2);
|
||||
double E = 2*R * ((S.x * ex.x + S.y * ex.y) / h2 + (S.z * ex.z) / b2);
|
||||
double F = 2*R * ((S.x * ey.x + S.y * ey.y) / h2 + (S.z * ey.z) / b2);
|
||||
double Q0 = angleBetweenVectors(SO, ST, false);
|
||||
double dQ = 0;
|
||||
double fQ = 0;
|
||||
double dfQ = 0;
|
||||
double Q = R < R0 ? Q0 - 1e-3 : Q0 + 1e-3;
|
||||
|
||||
//printf("A=%f;B=%f;C=%f;D=%f;E=%f;F=%f;Q=%f;\
|
||||
// S=[%f , %f ,%f ];\
|
||||
// T=[%f , %f ,%f ];\
|
||||
// ex=[%f , %f ,%f ];\
|
||||
// ey=[%f , %f ,%f ];\
|
||||
// ez=[%f , %f ,%f ];\
|
||||
//ray=[%f ,%f ,%f ];\
|
||||
//H=%f;R=%f;;\n",A,B,C,D,E,F,Q,
|
||||
// S.x,S.y,S.z,
|
||||
// T.x,T.y,T.z ,
|
||||
// ex.x,ex.y,ex.z,
|
||||
// ey.x,ey.y,ey.z,
|
||||
// ez.x,ez.y,ez.z,
|
||||
// ray.x, ray.y, ray.z,
|
||||
// H, R);
|
||||
// return;
|
||||
|
||||
// 牛顿迭代法
|
||||
for (int iter = 0; iter < MAX_ITER * 10; ++iter) {
|
||||
fQ = A * cos(Q) * cos(Q) + B * sin(Q) * cos(Q) + C * sin(Q) * sin(Q) + E * cos(Q) + F * sin(Q) - D;
|
||||
dfQ = (C - A) * sin(2 * Q) + B * cos(2 * Q) - E * sin(Q) + F * cos(Q);
|
||||
dQ = fQ / dfQ;
|
||||
if (abs(dQ) < 1e-8) {
|
||||
//printf("iter=%d;check Q0=%f;Q=%f;dQ=%f;fQ=%f;dfQ=%f;break\n", iter, Q0, Q, dQ, fQ, dfQ);
|
||||
break;
|
||||
}
|
||||
else {
|
||||
dQ = (abs(dQ) < d2r * 3) ? dQ :( abs(dQ) / dQ * d2r* 3);
|
||||
Q = Q - dQ;
|
||||
//printf("iter=%d;check Q0=%f;Q=%f;dQ=%f;fQ=%f;dfQ=%f;\n", iter, Q0, Q, dQ, fQ, dfQ);
|
||||
}
|
||||
|
||||
}
|
||||
//printf("check Q0=%f;Q=%f;\n", Q0, Q);
|
||||
double t1 = R * cos(Q);
|
||||
double t2 = R * sin(Q);
|
||||
P = Vector3{
|
||||
S.x + t1 * ex.x + t2 * ey.x, //因为 t3=0;
|
||||
S.y + t1 * ex.y + t2 * ey.y,
|
||||
S.z + t1 * ex.z + t2 * ey.z,
|
||||
};
|
||||
double check = (P.x * P.x + P.y * P.y) / ((WGS84_A + H) * (WGS84_A + H))
|
||||
+ P.z * P.z / (WGS84_B * WGS84_B);
|
||||
if (isnan(Q) || isinf(Q) || fabs(check - 1.0) > 1e-6) {
|
||||
P = Vector3{ NAN,NAN,NAN };
|
||||
}
|
||||
}
|
||||
|
||||
double Rt = sqrt(pow(S.x - T.x, 2) + pow(S.y - T.y, 2) + pow(S.z - T.z, 2));
|
||||
double Rp = sqrt(pow(S.x - P.x, 2) + pow(S.y - P.y, 2) + pow(S.z - P.z, 2));
|
||||
double Rop = sqrt(pow( P.x, 2) + pow( P.y, 2) + pow( P.z, 2));
|
||||
|
||||
if (!isnan(P.x)&&( Rop>WGS84_A*0.3)&&(Rop<WGS84_A*3)) {
|
||||
|
||||
imgx[idx] = P.x;
|
||||
imgy[idx] = P.y;
|
||||
imgz[idx] = P.z;
|
||||
|
||||
//printf("idx=%d; S=[%f , %f ,%f ]; H=%f;R=%f;RP=%f;Rr=%f;imgT=[%f ,%f ,%f ];imgP=[%f ,%f , %f ]; \n",
|
||||
// idx, S.x, S.y, S.z, H, R, Rp, Rt,T.x, T.y, T.z, P.x, P.y, P.z);
|
||||
}
|
||||
else {
|
||||
imgx[idx] = NAN;
|
||||
imgy[idx] = NAN;
|
||||
imgz[idx] = NAN;
|
||||
printf("idx=%d; S=[%f , %f ,%f ]; H=%f;R=%f;RP=%f;Rr=%f;imgT=[%f ,%f ,%f ];imgP=[%f ,%f , %f ]; ERROR\n",
|
||||
idx, S.x, S.y, S.z, H, R, Rp, Rt, T.x, T.y, T.z, P.x, P.y, P.z);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
__device__ double computerR(double& Px, double& Py, double& Pz, double& Tx, double& Ty, double& Tz) {
|
||||
|
@ -402,25 +256,6 @@ __global__ void kernel_pixelTimeBP(
|
|||
|
||||
|
||||
extern "C" {
|
||||
void TIMEBPCreateImageGrid(double* antPx, double* antPy, double* antPz,
|
||||
double* antDirx, double* antDiry, double* antDirz,
|
||||
double* imgx, double* imgy, double* imgz,
|
||||
long prfcount, long freqpoints, double meanH,
|
||||
double Rnear, double dx, double RefRange
|
||||
)
|
||||
{
|
||||
long pixelcount = prfcount * freqpoints;
|
||||
int grid_size = (pixelcount + BLOCK_SIZE - 1) / BLOCK_SIZE;
|
||||
|
||||
kernel_TimeBPImageGridNet << <grid_size, BLOCK_SIZE >> > (
|
||||
antPx, antPy, antPz,
|
||||
antDirx, antDiry, antDirz,
|
||||
imgx, imgy, imgz,
|
||||
prfcount, freqpoints, meanH,
|
||||
Rnear, dx, RefRange);
|
||||
PrintLasterError("TIMEBPCreateImageGrid");
|
||||
cudaDeviceSynchronize();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -11,15 +11,6 @@
|
|||
|
||||
|
||||
|
||||
extern "C" void TIMEBPCreateImageGrid(
|
||||
double* antPx,double* antPy,double* antPz, // ÎÀÐÇ×ø±ê S
|
||||
double* antDirx,double* antDiry,double* antDirz, //
|
||||
double* imgx,double* imgy,double* imgz,
|
||||
long prfcount,long freqpoints,double meanH,
|
||||
double Rnear,double dx,double RefRange
|
||||
);
|
||||
|
||||
|
||||
|
||||
extern "C" void TimeBPImage(
|
||||
double* antPx, double* antPy, double* antPz,
|
||||
|
|
|
@ -12,6 +12,9 @@ QSimulationBPImage::QSimulationBPImage(QWidget *parent)
|
|||
: QDialog(parent),ui(new Ui::QSimulationBPImageClass)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->checkBox->setEnabled(false);
|
||||
ui->checkBox->setCheckable(true);
|
||||
ui->checkBox->setChecked(true);
|
||||
|
||||
QObject::connect(ui->pushButtonEchoSelect, SIGNAL(clicked()), this, SLOT(onpushButtonEchoSelectClicked()));
|
||||
QObject::connect(ui->pushButtonImageSelect, SIGNAL(clicked()), this, SLOT(onpushButtonImageSelectClicked()));
|
||||
|
@ -97,12 +100,8 @@ void QSimulationBPImage::onbtnaccepted()
|
|||
TBPimag.setImageL1(imagL1);
|
||||
long cpucore_num = std::thread::hardware_concurrency();
|
||||
TBPimag.setGPU(true);
|
||||
if (ui->checkBox->isChecked()) {
|
||||
TBPimag.ProcessWithGridNet(cpucore_num,ui->lineEdit->text().trimmed());
|
||||
}
|
||||
else {
|
||||
TBPimag.Process(cpucore_num);
|
||||
}
|
||||
TBPimag.ProcessWithGridNet(cpucore_num,ui->lineEdit->text().trimmed());
|
||||
|
||||
this->show();
|
||||
QMessageBox::information(this,u8"成像",u8"成像结束");
|
||||
|
||||
|
|
|
@ -14,171 +14,6 @@
|
|||
#include <GPUBpSimulation.cuh>
|
||||
|
||||
|
||||
void CreatePixelXYZ(std::shared_ptr<EchoL0Dataset> echoL0ds, QString outPixelXYZPath)
|
||||
{
|
||||
long bandwidth = echoL0ds->getBandwidth();
|
||||
double Rnear = echoL0ds->getNearRange();
|
||||
double Rfar = echoL0ds->getFarRange();
|
||||
double refRange = echoL0ds->getRefPhaseRange();
|
||||
double dx = LIGHTSPEED / 2.0 / bandwidth; // c/2b
|
||||
|
||||
|
||||
// 创建坐标系统
|
||||
long prfcount = echoL0ds->getPluseCount();
|
||||
long freqcount = echoL0ds->getPlusePoints();
|
||||
Eigen::MatrixXd gt = Eigen::MatrixXd::Zero(2, 3);
|
||||
gt(0, 0) = 0;
|
||||
gt(0, 1) = 1;
|
||||
gt(0, 2) = 0;
|
||||
gt(1, 0) = 0;
|
||||
gt(1, 1) = 0;
|
||||
gt(1, 2) = 1;
|
||||
gdalImage xyzRaster = CreategdalImage(outPixelXYZPath, prfcount, freqcount, 3, gt, QString(""), false, true,true,GDT_Float64);
|
||||
std::shared_ptr<double> antpos = echoL0ds->getAntPos();
|
||||
dx = (echoL0ds->getFarRange()-echoL0ds->getNearRange())/(echoL0ds->getPlusePoints()-1);
|
||||
Rnear = echoL0ds->getNearRange();
|
||||
double Rref = echoL0ds->getRefPhaseRange();
|
||||
double centerInc = echoL0ds->getCenterAngle()*d2r;
|
||||
long echocol = Memory1GB * 1.0 / 8 / 4 / prfcount * 6;
|
||||
qDebug() << "echocol:\t " << echocol ;
|
||||
echocol = echocol < 1 ? 1: echocol;
|
||||
|
||||
|
||||
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);
|
||||
|
||||
{
|
||||
std::shared_ptr<double> antpos = echoL0ds->getAntPos();
|
||||
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();
|
||||
}
|
||||
|
||||
std::shared_ptr<double> d_Pxs((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice);
|
||||
std::shared_ptr<double> d_Pys((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice);
|
||||
std::shared_ptr<double> d_Pzs((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice);
|
||||
std::shared_ptr<double> d_AntDirectX((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice);
|
||||
std::shared_ptr<double> d_AntDirectY((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice);
|
||||
std::shared_ptr<double> d_AntDirectZ((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice);
|
||||
|
||||
HostToDevice(Pxs.get(), d_Pxs.get(), sizeof(double) * prfcount);
|
||||
HostToDevice(Pys.get(), d_Pys.get(), sizeof(double) * prfcount);
|
||||
HostToDevice(Pzs.get(), d_Pzs.get(), sizeof(double) * prfcount);
|
||||
HostToDevice(AntDirectX.get(), d_AntDirectX.get(), sizeof(double) * prfcount);
|
||||
HostToDevice(AntDirectY.get(), d_AntDirectY.get(), sizeof(double) * prfcount);
|
||||
HostToDevice(AntDirectZ.get(), d_AntDirectZ.get(), sizeof(double) * prfcount);
|
||||
|
||||
|
||||
for (long startcolidx = 0; startcolidx < freqcount; startcolidx = startcolidx + echocol) {
|
||||
|
||||
long tempechocol = echocol;
|
||||
if (startcolidx + tempechocol >= freqcount) {
|
||||
tempechocol = freqcount - startcolidx;
|
||||
}
|
||||
qDebug() << "\r[" << QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss.zzz") << "] imgxyz :\t" << startcolidx << "\t-\t" << startcolidx + tempechocol << " / " << freqcount ;
|
||||
|
||||
std::shared_ptr<double> demx = readDataArr<double>(xyzRaster, 0, startcolidx, prfcount, tempechocol, 1, GDALREADARRCOPYMETHOD::VARIABLEMETHOD);
|
||||
std::shared_ptr<double> demy = readDataArr<double>(xyzRaster, 0, startcolidx, prfcount, tempechocol, 2, GDALREADARRCOPYMETHOD::VARIABLEMETHOD);
|
||||
std::shared_ptr<double> demz = readDataArr<double>(xyzRaster, 0, startcolidx, prfcount, tempechocol, 3, GDALREADARRCOPYMETHOD::VARIABLEMETHOD);
|
||||
|
||||
std::shared_ptr<double> h_demx((double*)mallocCUDAHost(sizeof(double) * prfcount*tempechocol), FreeCUDAHost);
|
||||
std::shared_ptr<double> h_demy((double*)mallocCUDAHost(sizeof(double) * prfcount*tempechocol), FreeCUDAHost);
|
||||
std::shared_ptr<double> h_demz((double*)mallocCUDAHost(sizeof(double) * prfcount*tempechocol), FreeCUDAHost);
|
||||
|
||||
#pragma omp parallel for
|
||||
for (long ii = 0; ii < prfcount; ii++) {
|
||||
for (long jj = 0; jj < tempechocol; jj++) {
|
||||
h_demx.get()[ii*tempechocol+jj]=demx.get()[ii*tempechocol+jj];
|
||||
h_demy.get()[ii*tempechocol+jj]=demy.get()[ii*tempechocol+jj];
|
||||
h_demz.get()[ii*tempechocol+jj]=demz.get()[ii*tempechocol+jj];
|
||||
}
|
||||
}
|
||||
|
||||
std::shared_ptr<double> d_demx((double*)mallocCUDADevice(sizeof(double) * prfcount * tempechocol), FreeCUDADevice);
|
||||
std::shared_ptr<double> d_demy((double*)mallocCUDADevice(sizeof(double) * prfcount * tempechocol), FreeCUDADevice);
|
||||
std::shared_ptr<double> d_demz((double*)mallocCUDADevice(sizeof(double) * prfcount * tempechocol), FreeCUDADevice);
|
||||
|
||||
HostToDevice(h_demx.get(), d_demx.get(), sizeof(double) * prfcount * tempechocol);
|
||||
HostToDevice(h_demy.get(), d_demy.get(), sizeof(double) * prfcount * tempechocol);
|
||||
HostToDevice(h_demz.get(), d_demz.get(), sizeof(double) * prfcount * tempechocol);
|
||||
|
||||
|
||||
TIMEBPCreateImageGrid(
|
||||
d_Pxs.get(), d_Pys.get(), d_Pzs.get(),
|
||||
d_AntDirectX.get(), d_AntDirectY.get(), d_AntDirectZ.get(),
|
||||
d_demx.get(), d_demy.get(), d_demz.get(),
|
||||
prfcount, tempechocol, 1000,
|
||||
Rnear+dx* startcolidx, dx, refRange // 更新最近修读
|
||||
);
|
||||
|
||||
DeviceToHost(h_demx.get(), d_demx.get(), sizeof(double) * prfcount * tempechocol);
|
||||
DeviceToHost(h_demy.get(), d_demy.get(), sizeof(double) * prfcount * tempechocol);
|
||||
DeviceToHost(h_demz.get(), d_demz.get(), sizeof(double) * prfcount * tempechocol);
|
||||
|
||||
#pragma omp parallel for
|
||||
for (long ii = 0; ii < prfcount; ii++) {
|
||||
for (long jj = 0; jj < tempechocol; jj++) {
|
||||
demx.get()[ii * tempechocol + jj]=h_demx.get()[ii * tempechocol + jj] ;
|
||||
demy.get()[ii * tempechocol + jj]=h_demy.get()[ii * tempechocol + jj] ;
|
||||
demz.get()[ii * tempechocol + jj]=h_demz.get()[ii * tempechocol + jj] ;
|
||||
}
|
||||
}
|
||||
|
||||
xyzRaster.saveImage(demx, 0, startcolidx,prfcount,tempechocol, 1);
|
||||
xyzRaster.saveImage(demy, 0, startcolidx,prfcount,tempechocol, 2);
|
||||
xyzRaster.saveImage(demz, 0, startcolidx,prfcount,tempechocol, 3);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void TBPImageProcess(QString echofile, QString outImageFolder, QString imagePlanePath,long num_thread)
|
||||
{
|
||||
std::shared_ptr<EchoL0Dataset> echoL0ds(new EchoL0Dataset);
|
||||
echoL0ds->Open(echofile);
|
||||
|
||||
std::shared_ptr< SARSimulationImageL1Dataset> imagL1(new SARSimulationImageL1Dataset);
|
||||
imagL1->setCenterAngle(echoL0ds->getCenterAngle());
|
||||
imagL1->setCenterFreq(echoL0ds->getCenterFreq());
|
||||
imagL1->setNearRange(echoL0ds->getNearRange());
|
||||
imagL1->setRefRange((echoL0ds->getNearRange() + echoL0ds->getFarRange()) / 2);
|
||||
imagL1->setFarRange(echoL0ds->getFarRange());
|
||||
imagL1->setFs(echoL0ds->getFs());
|
||||
imagL1->setLookSide(echoL0ds->getLookSide());
|
||||
|
||||
imagL1->OpenOrNew(outImageFolder, echoL0ds->getSimulationTaskName(), echoL0ds->getPluseCount(), echoL0ds->getPlusePoints());
|
||||
|
||||
|
||||
TBPImageAlgCls TBPimag;
|
||||
TBPimag.setEchoL0(echoL0ds);
|
||||
TBPimag.setImageL1(imagL1);
|
||||
TBPimag.setImagePlanePath(imagePlanePath);
|
||||
|
||||
TBPimag.Process(num_thread);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void TBPImageAlgCls::setImagePlanePath(QString INimagePlanePath)
|
||||
{
|
||||
|
@ -209,20 +44,7 @@ std::shared_ptr<SARSimulationImageL1Dataset> TBPImageAlgCls::getImageL0()
|
|||
{
|
||||
return this->L1ds;
|
||||
}
|
||||
|
||||
ErrorCode TBPImageAlgCls::Process(long num_thread)
|
||||
{
|
||||
|
||||
qDebug() << u8"开始成像";
|
||||
|
||||
|
||||
qDebug() << u8"创建成像平面的XYZ";
|
||||
QString outRasterXYZ = JoinPath(this->L1ds->getoutFolderPath(), this->L0ds->getSimulationTaskName() + "_xyz.bin");
|
||||
CreatePixelXYZ(this->L0ds, outRasterXYZ);
|
||||
|
||||
return this->ProcessWithGridNet(num_thread, outRasterXYZ);
|
||||
|
||||
}
|
||||
|
||||
ErrorCode TBPImageAlgCls::ProcessWithGridNet(long num_thread,QString xyzRasterPath)
|
||||
{
|
||||
|
@ -490,6 +312,7 @@ void TBPImageAlgCls::EchoFreqToTime()
|
|||
host_echoArr.get()[ii * outColCount + jj] = make_cuComplex(echoArr.get()[ii * inColCount + jj].real(), echoArr.get()[ii * inColCount + jj].imag());
|
||||
}
|
||||
}
|
||||
|
||||
#pragma omp parallel for
|
||||
for (long ii = 0; ii < tempechoBlockline * outColCount; ii++) {
|
||||
host_IFFTechoArr.get()[ii] = make_cuComplex(0, 0);
|
||||
|
@ -538,3 +361,149 @@ bool TBPImageAlgCls::checkZeros(double* data, long long len)
|
|||
return flag;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//
|
||||
|
||||
//
|
||||
//void CreatePixelXYZ(std::shared_ptr<EchoL0Dataset> echoL0ds, QString outPixelXYZPath)
|
||||
//{
|
||||
// long bandwidth = echoL0ds->getBandwidth();
|
||||
// double Rnear = echoL0ds->getNearRange();
|
||||
// double Rfar = echoL0ds->getFarRange();
|
||||
// double refRange = echoL0ds->getRefPhaseRange();
|
||||
// double dx = LIGHTSPEED / 2.0 / bandwidth; // c/2b
|
||||
//
|
||||
//
|
||||
// // 创建坐标系统
|
||||
// long prfcount = echoL0ds->getPluseCount();
|
||||
// long freqcount = echoL0ds->getPlusePoints();
|
||||
// Eigen::MatrixXd gt = Eigen::MatrixXd::Zero(2, 3);
|
||||
// gt(0, 0) = 0;
|
||||
// gt(0, 1) = 1;
|
||||
// gt(0, 2) = 0;
|
||||
// gt(1, 0) = 0;
|
||||
// gt(1, 1) = 0;
|
||||
// gt(1, 2) = 1;
|
||||
// gdalImage xyzRaster = CreategdalImage(outPixelXYZPath, prfcount, freqcount, 3, gt, QString(""), false, true,true,GDT_Float64);
|
||||
// std::shared_ptr<double> antpos = echoL0ds->getAntPos();
|
||||
// dx = (echoL0ds->getFarRange()-echoL0ds->getNearRange())/(echoL0ds->getPlusePoints()-1);
|
||||
// Rnear = echoL0ds->getNearRange();
|
||||
// double Rref = echoL0ds->getRefPhaseRange();
|
||||
// double centerInc = echoL0ds->getCenterAngle()*d2r;
|
||||
// long echocol = Memory1GB * 1.0 / 8 / 4 / prfcount * 6;
|
||||
// qDebug() << "echocol:\t " << echocol ;
|
||||
// echocol = echocol < 1 ? 1: echocol;
|
||||
//
|
||||
//
|
||||
// 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);
|
||||
//
|
||||
// {
|
||||
// std::shared_ptr<double> antpos = echoL0ds->getAntPos();
|
||||
// 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();
|
||||
// }
|
||||
//
|
||||
// std::shared_ptr<double> d_Pxs((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice);
|
||||
// std::shared_ptr<double> d_Pys((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice);
|
||||
// std::shared_ptr<double> d_Pzs((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice);
|
||||
// std::shared_ptr<double> d_AntDirectX((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice);
|
||||
// std::shared_ptr<double> d_AntDirectY((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice);
|
||||
// std::shared_ptr<double> d_AntDirectZ((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice);
|
||||
//
|
||||
// HostToDevice(Pxs.get(), d_Pxs.get(), sizeof(double) * prfcount);
|
||||
// HostToDevice(Pys.get(), d_Pys.get(), sizeof(double) * prfcount);
|
||||
// HostToDevice(Pzs.get(), d_Pzs.get(), sizeof(double) * prfcount);
|
||||
// HostToDevice(AntDirectX.get(), d_AntDirectX.get(), sizeof(double) * prfcount);
|
||||
// HostToDevice(AntDirectY.get(), d_AntDirectY.get(), sizeof(double) * prfcount);
|
||||
// HostToDevice(AntDirectZ.get(), d_AntDirectZ.get(), sizeof(double) * prfcount);
|
||||
//
|
||||
//
|
||||
// for (long startcolidx = 0; startcolidx < freqcount; startcolidx = startcolidx + echocol) {
|
||||
//
|
||||
// long tempechocol = echocol;
|
||||
// if (startcolidx + tempechocol >= freqcount) {
|
||||
// tempechocol = freqcount - startcolidx;
|
||||
// }
|
||||
// qDebug() << "\r[" << QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss.zzz") << "] imgxyz :\t" << startcolidx << "\t-\t" << startcolidx + tempechocol << " / " << freqcount ;
|
||||
//
|
||||
// std::shared_ptr<double> demx = readDataArr<double>(xyzRaster, 0, startcolidx, prfcount, tempechocol, 1, GDALREADARRCOPYMETHOD::VARIABLEMETHOD);
|
||||
// std::shared_ptr<double> demy = readDataArr<double>(xyzRaster, 0, startcolidx, prfcount, tempechocol, 2, GDALREADARRCOPYMETHOD::VARIABLEMETHOD);
|
||||
// std::shared_ptr<double> demz = readDataArr<double>(xyzRaster, 0, startcolidx, prfcount, tempechocol, 3, GDALREADARRCOPYMETHOD::VARIABLEMETHOD);
|
||||
//
|
||||
// std::shared_ptr<double> h_demx((double*)mallocCUDAHost(sizeof(double) * prfcount*tempechocol), FreeCUDAHost);
|
||||
// std::shared_ptr<double> h_demy((double*)mallocCUDAHost(sizeof(double) * prfcount*tempechocol), FreeCUDAHost);
|
||||
// std::shared_ptr<double> h_demz((double*)mallocCUDAHost(sizeof(double) * prfcount*tempechocol), FreeCUDAHost);
|
||||
//
|
||||
//#pragma omp parallel for
|
||||
// for (long ii = 0; ii < prfcount; ii++) {
|
||||
// for (long jj = 0; jj < tempechocol; jj++) {
|
||||
// h_demx.get()[ii*tempechocol+jj]=demx.get()[ii*tempechocol+jj];
|
||||
// h_demy.get()[ii*tempechocol+jj]=demy.get()[ii*tempechocol+jj];
|
||||
// h_demz.get()[ii*tempechocol+jj]=demz.get()[ii*tempechocol+jj];
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// std::shared_ptr<double> d_demx((double*)mallocCUDADevice(sizeof(double) * prfcount * tempechocol), FreeCUDADevice);
|
||||
// std::shared_ptr<double> d_demy((double*)mallocCUDADevice(sizeof(double) * prfcount * tempechocol), FreeCUDADevice);
|
||||
// std::shared_ptr<double> d_demz((double*)mallocCUDADevice(sizeof(double) * prfcount * tempechocol), FreeCUDADevice);
|
||||
//
|
||||
// HostToDevice(h_demx.get(), d_demx.get(), sizeof(double) * prfcount * tempechocol);
|
||||
// HostToDevice(h_demy.get(), d_demy.get(), sizeof(double) * prfcount * tempechocol);
|
||||
// HostToDevice(h_demz.get(), d_demz.get(), sizeof(double) * prfcount * tempechocol);
|
||||
//
|
||||
//
|
||||
// TIMEBPCreateImageGrid(
|
||||
// d_Pxs.get(), d_Pys.get(), d_Pzs.get(),
|
||||
// d_AntDirectX.get(), d_AntDirectY.get(), d_AntDirectZ.get(),
|
||||
// d_demx.get(), d_demy.get(), d_demz.get(),
|
||||
// prfcount, tempechocol, 0,
|
||||
// Rnear+dx* startcolidx, dx, refRange // 更新最近修读
|
||||
// );
|
||||
//
|
||||
// DeviceToHost(h_demx.get(), d_demx.get(), sizeof(double) * prfcount * tempechocol);
|
||||
// DeviceToHost(h_demy.get(), d_demy.get(), sizeof(double) * prfcount * tempechocol);
|
||||
// DeviceToHost(h_demz.get(), d_demz.get(), sizeof(double) * prfcount * tempechocol);
|
||||
//
|
||||
//#pragma omp parallel for
|
||||
// for (long ii = 0; ii < prfcount; ii++) {
|
||||
// for (long jj = 0; jj < tempechocol; jj++) {
|
||||
// demx.get()[ii * tempechocol + jj]=h_demx.get()[ii * tempechocol + jj] ;
|
||||
// demy.get()[ii * tempechocol + jj]=h_demy.get()[ii * tempechocol + jj] ;
|
||||
// demz.get()[ii * tempechocol + jj]=h_demz.get()[ii * tempechocol + jj] ;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// xyzRaster.saveImage(demx, 0, startcolidx,prfcount,tempechocol, 1);
|
||||
// xyzRaster.saveImage(demy, 0, startcolidx,prfcount,tempechocol, 2);
|
||||
// xyzRaster.saveImage(demz, 0, startcolidx,prfcount,tempechocol, 3);
|
||||
// }
|
||||
//
|
||||
//}
|
||||
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ public:
|
|||
std::shared_ptr<SARSimulationImageL1Dataset> getImageL0();
|
||||
|
||||
public:
|
||||
ErrorCode Process(long num_thread);
|
||||
|
||||
ErrorCode ProcessWithGridNet(long num_thread, QString xyzRasterPath);
|
||||
void setGPU(bool flag);
|
||||
bool getGPU();
|
||||
|
@ -69,23 +69,3 @@ private://
|
|||
private:
|
||||
bool checkZeros(double* data, long long len);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
void CreatePixelXYZ(std::shared_ptr<EchoL0Dataset> echoL0ds,QString outPixelXYZPath);
|
||||
|
||||
|
||||
void TBPImageProcess(QString echofile,QString outImageFolder,QString imagePlanePath,long num_thread);
|
||||
|
||||
//
|
||||
//void TBPImageGridNet(
|
||||
// std::shared_ptr<double> antPx, std::shared_ptr<double> antPy, std::shared_ptr<double> antPz,
|
||||
// std::shared_ptr<double> img_x, std::shared_ptr<double> img_y, std::shared_ptr<double> img_z,
|
||||
// std::shared_ptr<std::complex<double>> echoArr,
|
||||
// std::shared_ptr<std::complex<double>> img_arr,
|
||||
// double freq, double dx, double Rnear, double Rfar, double refRange,
|
||||
// long rowcount, long colcount,
|
||||
// long prfcount, long freqcount,
|
||||
// long startPRFId, long startRowID
|
||||
//);
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "QCreateSARIntensityByLookTableDialog.h"
|
||||
#include "QtSimulationGeoSARSigma0Dialog.h"
|
||||
#include "QtLinearToIntenisityDialog.h"
|
||||
#include "InitCreateImageXYZDialog.h"
|
||||
|
||||
SARSimlulationRFPCToolButton::SARSimlulationRFPCToolButton(QWidget* parent)
|
||||
{
|
||||
|
@ -75,6 +76,7 @@ void RegisterPreToolBox(LAMPMainWidget::RasterMainWidget* mainwindows, ToolBoxWi
|
|||
emit toolbox->addBoxToolItemSIGNAL(new QCreateSARIntensityByLookTableToolButton(toolbox));
|
||||
emit toolbox->addBoxToolItemSIGNAL(new QtSimulationGeoSARSigma0ToolButton(toolbox));
|
||||
emit toolbox->addBoxToolItemSIGNAL(new QtLinearToIntenisityToolButton(toolbox));
|
||||
emit toolbox->addBoxToolItemSIGNAL(new InitCreateImageXYZToolButton(toolbox));
|
||||
|
||||
}
|
||||
|
||||
|
@ -141,4 +143,24 @@ void QtLinearToIntenisityToolButton::excute()
|
|||
{
|
||||
QtLinearToIntenisityDialog* dialog = new QtLinearToIntenisityDialog;
|
||||
dialog->show();
|
||||
}
|
||||
}
|
||||
|
||||
InitCreateImageXYZToolButton::InitCreateImageXYZToolButton(QWidget* parent)
|
||||
{
|
||||
this->toolPath = QVector<QString>(0);
|
||||
this->toolPath.push_back(u8"成像工具库");
|
||||
this->toolname = QString(u8"1.构建成像粗平面");
|
||||
}
|
||||
|
||||
InitCreateImageXYZToolButton::~InitCreateImageXYZToolButton()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void InitCreateImageXYZToolButton::run()
|
||||
{
|
||||
InitCreateImageXYZDialog* dialog = new InitCreateImageXYZDialog;
|
||||
dialog->show();
|
||||
}
|
||||
|
||||
|
|
@ -98,6 +98,15 @@ public slots:
|
|||
};
|
||||
|
||||
|
||||
class SIMULATIONSARTOOL_EXPORT InitCreateImageXYZToolButton : public QToolAbstract {
|
||||
Q_OBJECT
|
||||
public:
|
||||
InitCreateImageXYZToolButton(QWidget* parent = nullptr);
|
||||
~InitCreateImageXYZToolButton();
|
||||
public :
|
||||
virtual void run() override;
|
||||
|
||||
};
|
||||
|
||||
|
||||
extern "C" SIMULATIONSARTOOL_EXPORT void RegisterPreToolBox(LAMPMainWidget::RasterMainWidget* mainwindows, ToolBoxWidget* toolbox);
|
||||
|
|
|
@ -105,7 +105,7 @@
|
|||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<IncludePath>..\..\BaseCommonLibrary;..\..\BaseCommonLibrary\BaseTool;..\..\BaseCommonLibrary\ToolAbstract;..\..\GPUBaseLib\GPUTool;.\SimulationSAR;.;..\..\LAMPSARProcessProgram\ToolBoxManager;..\..\RasterMainWidgetGUI\RasterMainWidget;..\..\RasterProcessToolWidget;..\..\RasterMainWidgetGUI;.\PowerSimulationIncoherent;..\..\ImageshowTool;..\..\ImageshowTool\Imageshow;$(VC_IncludePath);$(WindowsSDK_IncludePath)</IncludePath>
|
||||
<IncludePath>..\..\BaseCommonLibrary;..\..\BaseCommonLibrary\BaseTool;..\..\BaseCommonLibrary\ToolAbstract;..\..\GPUBaseLib\GPUTool;.\SARImage;.\SimulationSAR;.;..\..\LAMPSARProcessProgram\ToolBoxManager;..\..\RasterMainWidgetGUI\RasterMainWidget;..\..\RasterProcessToolWidget;..\..\RasterMainWidgetGUI;.\PowerSimulationIncoherent;..\..\ImageshowTool;..\..\ImageshowTool\Imageshow;$(VC_IncludePath);$(WindowsSDK_IncludePath)</IncludePath>
|
||||
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\Toolbox\</OutDir>
|
||||
<TargetName>PluginTool_$(ProjectName)</TargetName>
|
||||
<CopyLocalProjectReference>true</CopyLocalProjectReference>
|
||||
|
@ -214,6 +214,8 @@
|
|||
<ClCompile Include="PowerSimulationIncoherent\QSimulationSARPolynomialOrbitModel.cpp" />
|
||||
<ClCompile Include="PowerSimulationIncoherent\QtLinearToIntenisityDialog.cpp" />
|
||||
<ClCompile Include="PowerSimulationIncoherent\QtSimulationGeoSARSigma0Dialog.cpp" />
|
||||
<ClCompile Include="SARImage\ImageNetOperator.cpp" />
|
||||
<ClCompile Include="SARImage\InitCreateImageXYZDialog.cpp" />
|
||||
<ClCompile Include="SimulationSAR\QImageSARRFPC.cpp" />
|
||||
<ClCompile Include="SimulationSAR\QSARLookTableSimualtionGUI.cpp" />
|
||||
<ClCompile Include="SimulationSAR\QSimulationBPImage.cpp" />
|
||||
|
@ -226,6 +228,7 @@
|
|||
<ClCompile Include="SimulationSAR\TBPImageAlgCls.cpp" />
|
||||
<ClCompile Include="UnitTestMain.cpp" />
|
||||
<CudaCompile Include="GPUBpSimulation.cu" />
|
||||
<CudaCompile Include="SARImage\GPUBPImageNet.cu" />
|
||||
<CudaCompile Include="Sigma0ClsReflect.cu" />
|
||||
<CudaCompile Include="SimulationSAR\GPURFPC_single.cu" />
|
||||
<CudaCompile Include="SimulationSAR\GPUTBPImage.cu" />
|
||||
|
@ -237,6 +240,9 @@
|
|||
<QtMoc Include="PowerSimulationIncoherent\QCreateSARIntensityByLookTableDialog.h" />
|
||||
<QtMoc Include="PowerSimulationIncoherent\QtLinearToIntenisityDialog.h" />
|
||||
<QtMoc Include="PowerSimulationIncoherent\QtSimulationGeoSARSigma0Dialog.h" />
|
||||
<QtMoc Include="SARImage\InitCreateImageXYZDialog.h" />
|
||||
<ClInclude Include="SARImage\GPUBPImageNet.cuh" />
|
||||
<ClInclude Include="SARImage\ImageNetOperator.h" />
|
||||
<ClInclude Include="SimulationSARToolAPI.h" />
|
||||
<ClInclude Include="simulationsartool_global.h" />
|
||||
<QtMoc Include="SimulationSAR\QImageSARRFPC.h" />
|
||||
|
@ -271,6 +277,7 @@
|
|||
<QtUic Include="PowerSimulationIncoherent\QSimulationSARPolynomialOrbitModel.ui" />
|
||||
<QtUic Include="PowerSimulationIncoherent\QtLinearToIntenisityDialog.ui" />
|
||||
<QtUic Include="PowerSimulationIncoherent\QtSimulationGeoSARSigma0Dialog.ui" />
|
||||
<QtUic Include="SARImage\InitCreateImageXYZDialog.ui" />
|
||||
<QtUic Include="SimulationSAR\QImageSARRFPC.ui" />
|
||||
<QtUic Include="SimulationSAR\QSARLookTableSimualtionGUI.ui" />
|
||||
<QtUic Include="SimulationSAR\QSimulationBPImage.ui" />
|
||||
|
|
|
@ -27,6 +27,9 @@
|
|||
<Filter Include="PowerSimulationIncoherent">
|
||||
<UniqueIdentifier>{9b848585-2348-400d-b12a-dd79a2a71007}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="SARImage">
|
||||
<UniqueIdentifier>{3380934c-6b95-45eb-8d70-d8b58e0e9de3}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="simulationsartool_global.h">
|
||||
|
@ -71,6 +74,12 @@
|
|||
<ClInclude Include="SimulationSAR\GPURFPC_single.cuh">
|
||||
<Filter>SimulationSAR</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="SARImage\ImageNetOperator.h">
|
||||
<Filter>SARImage</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="SARImage\GPUBPImageNet.cuh">
|
||||
<Filter>SARImage</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="SimulationSAR\QImageSARRFPC.cpp">
|
||||
|
@ -124,6 +133,12 @@
|
|||
<ClCompile Include="PowerSimulationIncoherent\QtSimulationGeoSARSigma0Dialog.cpp">
|
||||
<Filter>PowerSimulationIncoherent</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SARImage\InitCreateImageXYZDialog.cpp">
|
||||
<Filter>SARImage</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SARImage\ImageNetOperator.cpp">
|
||||
<Filter>SARImage</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<QtUic Include="SimulationSAR\QImageSARRFPC.ui">
|
||||
|
@ -153,6 +168,9 @@
|
|||
<QtUic Include="PowerSimulationIncoherent\QtSimulationGeoSARSigma0Dialog.ui">
|
||||
<Filter>PowerSimulationIncoherent</Filter>
|
||||
</QtUic>
|
||||
<QtUic Include="SARImage\InitCreateImageXYZDialog.ui">
|
||||
<Filter>SARImage</Filter>
|
||||
</QtUic>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<QtMoc Include="SimulationSAR\QImageSARRFPC.h">
|
||||
|
@ -185,6 +203,9 @@
|
|||
<QtMoc Include="PowerSimulationIncoherent\QtSimulationGeoSARSigma0Dialog.h">
|
||||
<Filter>PowerSimulationIncoherent</Filter>
|
||||
</QtMoc>
|
||||
<QtMoc Include="SARImage\InitCreateImageXYZDialog.h">
|
||||
<Filter>SARImage</Filter>
|
||||
</QtMoc>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CudaCompile Include="SimulationSAR\GPURFPC.cu">
|
||||
|
@ -220,5 +241,8 @@
|
|||
<CudaCompile Include="Sigma0ClsReflect.cu">
|
||||
<Filter>SimulationSAR</Filter>
|
||||
</CudaCompile>
|
||||
<CudaCompile Include="SARImage\GPUBPImageNet.cu">
|
||||
<Filter>SARImage</Filter>
|
||||
</CudaCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
Loading…
Reference in New Issue