From bdaa4f22f77d9bce53c79abe13e0488c4bd95bf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=A2=9E=E8=BE=89?= <3045316072@qq.com> Date: Wed, 2 Apr 2025 03:00:56 +0800 Subject: [PATCH 01/44] =?UTF-8?q?=E4=BF=9D=E7=95=99=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GPUBaseLib/GPUTool/GPUTool.cuh | 6 +- .../SimulationSAR/BPBasic0_CUDA.cu | 4 +- .../SimulationSAR/GPURFPC.cu | 204 ++++++++++-------- .../SimulationSAR/RFPCProcessCls.cpp | 6 +- .../SimulationSAR/SigmaDatabase.cpp | 21 +- .../SimulationSAR/TBPImageAlgCls.cpp | 1 + 6 files changed, 136 insertions(+), 106 deletions(-) diff --git a/GPUBaseLib/GPUTool/GPUTool.cuh b/GPUBaseLib/GPUTool/GPUTool.cuh index 6c513e3..b380dc5 100644 --- a/GPUBaseLib/GPUTool/GPUTool.cuh +++ b/GPUBaseLib/GPUTool/GPUTool.cuh @@ -20,13 +20,15 @@ /** CUDA 调用参数 ************************************************************************************/ #define BLOCK_SIZE 256 #define SHAREMEMORY_BYTE 49152 -#define SHAREMEMORY_FLOAT_HALF 6144 -#define SHAREMEMORY_FLOAT_HALF_STEP 24 +#define SHAREMEMORY_FLOAT_HALF_STEP 2 +#define SHAREMEMORY_FLOAT_HALF SHAREMEMORY_FLOAT_HALF_STEP*BLOCK_SIZE + #define SHAREMEMORY_DEM_STEP 768 #define SHAREMEMORY_Reflect 612 + enum LAMPGPUDATETYPE { LAMP_LONG, LAMP_FLOAT, diff --git a/Toolbox/SimulationSARTool/SimulationSAR/BPBasic0_CUDA.cu b/Toolbox/SimulationSARTool/SimulationSAR/BPBasic0_CUDA.cu index 718d73b..cdf1705 100644 --- a/Toolbox/SimulationSARTool/SimulationSAR/BPBasic0_CUDA.cu +++ b/Toolbox/SimulationSARTool/SimulationSAR/BPBasic0_CUDA.cu @@ -110,7 +110,7 @@ __global__ void processPulseKernel( im_final[idx].x += phCorr.x; im_final[idx].y += phCorr.y; //printf("r_start=%e;dr=%e;nR=%d\n", r_start, dr, nR); - //if (abs(phCorr.x) > 1e-100 || abs(phCorr.y > 1e-100)) { + if (abs(phCorr.x) > 1e-100 || abs(phCorr.y > 1e-100)) { //printf( // "[DEBUG] prfid=%-4ld | idx=%-8lld\n" // " Ant: X=%-18.10e Y=%-18.10e Z=%-18.10e\n" @@ -133,7 +133,7 @@ __global__ void processPulseKernel( // phCorr.x, phCorr.y, // im_final[idx].x, im_final[idx].y //); - //} + } } void bpBasic0CUDA(GPUDATA& data, int flag,double* h_R) { diff --git a/Toolbox/SimulationSARTool/SimulationSAR/GPURFPC.cu b/Toolbox/SimulationSARTool/SimulationSAR/GPURFPC.cu index 0f92e29..049b07b 100644 --- a/Toolbox/SimulationSARTool/SimulationSAR/GPURFPC.cu +++ b/Toolbox/SimulationSARTool/SimulationSAR/GPURFPC.cu @@ -487,8 +487,8 @@ __global__ void Kernel_Computer_R_amp_NoAntPattern( double Pt, double refPhaseRange, double NearR, double FarR, - double maxGain,double GainWeight, - double* d_temp_R, double* d_temp_amps// 计算输出 + double maxGain, double GainWeight, + float* d_temp_R, float* d_temp_amps// 计算输出 ) { long long idx = blockIdx.x * blockDim.x + threadIdx.x; // 获取当前的线程编码 long long prfId = idx / SHAREMEMORY_FLOAT_HALF; @@ -509,12 +509,23 @@ __global__ void Kernel_Computer_R_amp_NoAntPattern( if (RstRFarR) { + + if (prfId > 200) { + printf("error prfId:%d ,idx:%d RstR:%e antP=[%e,%e,%e] ,gp=[%e,%e,%e]\n", prfId, idx, RstR, + antp.Px, antp.Py, antp.Pz, gp.Tx, gp.Ty, gp.Tz + ); + } + d_temp_R[idx] = 0; d_temp_amps[idx] = 0; return; } else { - + if (prfId > 200) { + printf(" prfId:%d ,idx:%d RstR:%e antP=[%e,%e,%e] ,gp=[%e,%e,%e]\n", prfId, idx, RstR, + antp.Px, antp.Py, antp.Pz, gp.Tx, gp.Ty, gp.Tz + ); + } RstX = RstX / RstR; RstY = RstY / RstR; RstZ = RstZ / RstR; @@ -525,8 +536,8 @@ __global__ void Kernel_Computer_R_amp_NoAntPattern( float slopR = sqrtf(slopeX * slopeX + slopeY * slopeY + slopeZ * slopeZ); // if (slopR > 1e-3) { - - float localangle = acosf((RstX * slopeX + RstY * slopeY + RstZ * slopeZ) / ( slopR)); + float dotAB = RstX * slopeX + RstY * slopeY + RstZ * slopeZ; + float localangle = acosf(dotAB / (slopR)); if (localangle < 0 || localangle >= LAMP_CUDA_PI / 2 || isnan(localangle)) { d_temp_R[idx] = 0; @@ -542,91 +553,113 @@ __global__ void Kernel_Computer_R_amp_NoAntPattern( + antp.antDirectY * antp.antDirectY + antp.antDirectZ * antp.antDirectZ); - float diectAngle = -1*(RstX*antp.antDirectX+ - RstY*antp.antDirectY+ - RstZ*antp.antDirectZ) / (antDirectR ); + float diectAngle = -1 * (RstX * antp.antDirectX + + RstY * antp.antDirectY + + RstZ * antp.antDirectZ) / (antDirectR); diectAngle = acosf(diectAngle);// 弧度制 diectAngle = diectAngle * GainWeight; float ampGain = 1; - ampGain=2 * maxGain * (1 - (powf(diectAngle,2) / 6) + ampGain = 2 * maxGain * (1 - (powf(diectAngle, 2) / 6) + (powf(diectAngle, 4) / 120) - (powf(diectAngle, 6) / 5040)); //dB - + ampGain = powf(10.0, ampGain / 10.0); ampGain = ampGain / (PI4POW2 * powf(RstR, 4)); // 反射强度 float sigma = GPU_getSigma0dB(sigma0Params, localangle); sigma = powf(10.0, sigma / 10.0); - double temp_amp = double(ampGain * Pt * sigma); - double temp_R = double(RstR - refPhaseRange); + float temp_amp = float(ampGain * Pt * sigma); + float temp_R = float(double(RstR - refPhaseRange)); - bool isNan = !(isnan(temp_amp) || isnan(temp_R) || isinf(temp_amp) || isinf(temp_R)); + if (isnan(temp_amp) || isnan(temp_R) || isinf(temp_amp) || isinf(temp_R)) { + printf("amp is nan or R is nan,amp=%f;R=%f; \n", temp_amp, temp_R); + d_temp_R[idx] = 0; + d_temp_amps[idx] = 0; + return; + } + else { - d_temp_amps[idx] = temp_amp * isNan; - d_temp_R[idx] = temp_R * isNan; + d_temp_amps[idx] = temp_amp ; + d_temp_R[idx] = temp_R; - return; + return; + } } } } + else { + d_temp_R[idx] = 0; + d_temp_amps[idx] = 0; + return; + } + } -__global__ void CUDA_Kernel_Computer_echo_NoAntPattern_Optimized( - double* d_temp_R, double* d_temp_amps, long posNum, +__global__ void CUDA_Kernel_Computer_echo_NoAntPattern( + float* d_temp_R, float* d_temp_amps, double f0, double dfreq, - long FreqPoints, // 当前频率的分块 - long maxfreqnum, // 最大脉冲值 + long maxfreqnum, long nextfreqNum,// 最大脉冲值 cuComplex* echodata, long temp_PRF_Count ) { - // 使用动态共享内存,根据线程块大小调整 - extern __shared__ double s_data[]; - double* s_R = s_data; - double* s_amp = s_data + blockDim.x; + __shared__ float s_R[SHAREMEMORY_FLOAT_HALF]; // 注意一个完整的block_size 共享相同内存 + __shared__ float s_amp[SHAREMEMORY_FLOAT_HALF]; - const int tid = threadIdx.x; - const int prfId = blockIdx.x; - const int fId = tid; // 每个线程处理一个频率点 + long long tid = threadIdx.x; + long long bid = blockIdx.x; + long long idx = bid * blockDim.x + tid; + long long prfId = idx / nextfreqNum; // 脉冲ID + long long fId = idx % nextfreqNum;//频率ID - double factorjTemp = RFPCPIDIVLIGHT * (f0 + fId * dfreq); - cuComplex echo = make_cuComplex(0.0f, 0.0f); - - // 分块加载数据并计算 - for (int block_offset = 0; block_offset < posNum; block_offset += blockDim.x) { - int psid = block_offset + tid; - int pixelId = prfId * posNum + psid; - - // 加载当前块到共享内存 - if (psid < posNum) { - s_R[tid] = static_cast(d_temp_R[pixelId]); - s_amp[tid] = static_cast(d_temp_amps[pixelId]); + long long psid = 0; + long long pixelId = 0; + for (long ii = 0; ii < SHAREMEMORY_FLOAT_HALF_STEP; ii++) { // SHAREMEMORY_FLOAT_HALF_STEP * BLOCK_SIZE=SHAREMEMORY_FLOAT_HALF + psid = ii * BLOCK_SIZE + tid; + pixelId = prfId * SHAREMEMORY_FLOAT_HALF + psid; + s_R[psid] = d_temp_R[pixelId]; + s_amp[psid] = d_temp_amps[pixelId]; + if (prfId > 200) { + printf("prfId:%d ,idx:%d s_R:%f S_amp:%f \n", prfId, idx, s_R[psid], s_amp[psid]); } - else { - s_R[tid] = 0.0f; - s_amp[tid] = 0.0f; - } - __syncthreads(); - - // 计算当前块的贡献 - for (int dataid = 0; dataid < blockDim.x; ++dataid) { - float temp_phi =fmod( s_R[dataid] * factorjTemp,2*PI); - float temp_amp = s_amp[dataid]; - float sin_phi, cos_phi; - sincosf(temp_phi, &sin_phi, &cos_phi); - echo.x += temp_amp * cos_phi; - echo.y += temp_amp * sin_phi; - } - __syncthreads(); } - // 只处理有效的频率点和PRF - if (prfId < temp_PRF_Count && fId < FreqPoints && fId < maxfreqnum) { - const int echo_ID = prfId * maxfreqnum + fId; - atomicAdd(&echodata[echo_ID].x, echo.x); - atomicAdd(&echodata[echo_ID].y, echo.y); + __syncthreads(); // 确定所有待处理数据都已经进入程序中 + + + + + if (fId < maxfreqnum && prfId < temp_PRF_Count) { + + long echo_ID = prfId * maxfreqnum + fId; // 计算对应的回波位置 + double factorjTemp = RFPCPIDIVLIGHT * (f0 + fId * dfreq); + cuComplex echo = make_cuComplex(0, 0); + + for (long dataid = 0; dataid < SHAREMEMORY_FLOAT_HALF; dataid++) { + + float temp_real = 0; + float temp_imag = 0; + double R = s_R[dataid]; + float temp_phi = fmod(R * factorjTemp, 2 * PI); + float temp_amp = s_amp[dataid]; + sincosf(temp_phi, &temp_imag, &temp_real); + echo.x = echo.x + (temp_amp * temp_real); + echo.y = echo.y + (temp_amp * temp_imag); + //if (dataid > 5000) { + // printf("echo_ID=%d; dataid=%d;ehodata=(%f,%f);R=%f;amp=%f;\n", echo_ID, dataid, temp_real, temp_imag, s_R[0], s_amp[0]); + //} + if (isnan(temp_phi) || isnan(temp_amp) || isnan(echo.x) || isnan(echo.y) + || isinf(temp_phi) || isinf(temp_amp) || isinf(echo.x) || isinf(echo.y) + ) { + printf("[amp,phi,real,imag]=[%f,%f,%f,%f];\n", temp_amp, temp_phi, echo.x, echo.y); + } + + } + + echodata[echo_ID] = cuCaddf(echodata[echo_ID], echo); + } } @@ -638,23 +671,23 @@ extern "C" void ProcessRFPCTask(RFPCTask& task, long devid) { size_t pixelcount = task.prfNum * task.freqNum; size_t grid_size = (pixelcount + BLOCK_SIZE - 1) / BLOCK_SIZE; - printf("computer pixelcount goalnum gridsize blocksize prfnum %zu,%zu ,%zu,%d ,%d \n", pixelcount, task.targetnum, grid_size, BLOCK_SIZE,task.prfNum); + printf("computer pixelcount goalnum gridsize blocksize prfnum %zu,%zu ,%zu,%d ,%d \n", pixelcount, task.targetnum, grid_size, BLOCK_SIZE, task.prfNum); printf("Dev:%d ,freqnum:%d , prfnum:%d ,Rref: %e ,Rnear : %e ,Rfar: %e , StartFreq: %e ,DeletFreq: %e \n", devid, task.freqNum, task.prfNum, task.Rref, task.Rnear, task.Rfar, task.startFreq, task.stepFreq); - double* d_R = (double*)mallocCUDADevice(task.prfNum * SHAREMEMORY_FLOAT_HALF * sizeof(double), devid); - double* d_amps = (double*)mallocCUDADevice(task.prfNum * SHAREMEMORY_FLOAT_HALF * sizeof(double), devid); + float* d_R = (float*)mallocCUDADevice(task.prfNum * SHAREMEMORY_FLOAT_HALF * sizeof(float), devid); + float* d_amps = (float*)mallocCUDADevice(task.prfNum * SHAREMEMORY_FLOAT_HALF * sizeof(float), devid); long BLOCK_FREQNUM = NextBlockPad(task.freqNum, BLOCK_SIZE); // 256*freqBlockID long cudaBlocknum = 0; - long freqpoints = BLOCK_FREQNUM; - - printf("freqpoints:%d\n", freqpoints); + long freqpoints = BLOCK_SIZE; + + printf("freqpoints:%d\n", task.freqNum); long prfcount = task.prfNum; long process = 0; for (long sTi = 0; sTi < task.targetnum; sTi = sTi + SHAREMEMORY_FLOAT_HALF) { cudaBlocknum = (task.prfNum * SHAREMEMORY_FLOAT_HALF + BLOCK_SIZE - 1) / BLOCK_SIZE; - Kernel_Computer_R_amp_NoAntPattern << > >( + Kernel_Computer_R_amp_NoAntPattern << > > ( task.antlist, prfcount, task.goallist, @@ -664,39 +697,26 @@ extern "C" void ProcessRFPCTask(RFPCTask& task, long devid) task.Pt, task.Rref, task.Rnear, task.Rfar, - task.maxGain,task.GainWeight, + task.maxGain, task.GainWeight, d_R, d_amps// 计算输出 - ); + ); PrintLasterError("CUDA_Kernel_Computer_R_amp"); cudaDeviceSynchronize(); - dim3 blocks(task.prfNum); - dim3 threads(BLOCK_SIZE); - - size_t shared_mem_size = 2 * BLOCK_SIZE * sizeof(double); - - CUDA_Kernel_Computer_echo_NoAntPattern_Optimized << > > ( - d_R, d_amps, SHAREMEMORY_FLOAT_HALF, - task.startFreq/1e9, task.stepFreq / 1e9, - freqpoints, task.freqNum, - task.d_echoData, - task.prfNum - ); - - //cudaBlocknum = (task.prfNum * BLOCK_FREQNUM + BLOCK_SIZE - 1) / BLOCK_SIZE; - //CUDA_Kernel_Computer_echo_NoAntPattern << > > ( - // d_R, d_amps, SHAREMEMORY_FLOAT_HALF, - // task.startFreq/1e9, task.stepFreq / 1e9, - // freqpoints, task.freqNum, - // task.d_echoData, - // task.prfNum - // ); + cudaBlocknum = (task.prfNum * BLOCK_FREQNUM + BLOCK_SIZE- 1) / BLOCK_SIZE; + CUDA_Kernel_Computer_echo_NoAntPattern << > > ( + d_R, d_amps, + task.startFreq / 1e9, task.stepFreq / 1e9, + task.freqNum, BLOCK_FREQNUM, + task.d_echoData, + task.prfNum + ); PrintLasterError("CUDA_Kernel_Computer_echo"); cudaDeviceSynchronize(); if ((sTi * 100.0 / task.targetnum) - process >= 10) { process = sTi * 100.0 / task.targetnum; - PRINT("device ID : %d , TargetID [%f]: %d / %d finished %d\n",devid, sTi * 100.0 / task.targetnum, sTi, task.targetnum,devid); + PRINT("device ID : %d , TargetID [%f]: %d / %d finished %d\n", devid, sTi * 100.0 / task.targetnum, sTi, task.targetnum, devid); } } @@ -707,7 +727,7 @@ extern "C" void ProcessRFPCTask(RFPCTask& task, long devid) FreeCUDADevice(d_amps); } - + #endif diff --git a/Toolbox/SimulationSARTool/SimulationSAR/RFPCProcessCls.cpp b/Toolbox/SimulationSARTool/SimulationSAR/RFPCProcessCls.cpp index 65b8203..e704c0f 100644 --- a/Toolbox/SimulationSARTool/SimulationSAR/RFPCProcessCls.cpp +++ b/Toolbox/SimulationSARTool/SimulationSAR/RFPCProcessCls.cpp @@ -1120,12 +1120,14 @@ ErrorCode RFPCProcessCls::RFPCMainProcess_GPU_NoAntPattern(size_t startprfid, si // 鍒嗗潡璁$畻 for (const auto& pair : clsGoalStateDict) { long clsid = pair.first; + task.sigma0_cls = clsCUDASigmaParamsDict[clsid]; size_t clscount = clsCountDict[clsid]; - PRINT("Process Class ID : %d , Count: %d Device: %d\n", clsid, clscount,devId); + PRINT("Process Class ID : %d , Count: %d Device: %d , sigma Prams :[%f,%f,%f,%f,%f,%F]\n", clsid, clscount,devId, + task.sigma0_cls.p1, task.sigma0_cls.p2, task.sigma0_cls.p3, task.sigma0_cls.p4, task.sigma0_cls.p5, task.sigma0_cls.p6); task.targetnum = clscount; task.goallist = (GoalState*)mallocCUDADevice(clscount * sizeof(GoalState), devId); HostToDevice(clsGoalStateDict[clsid].get(), task.goallist, sizeof(GoalState) * clscount); - task.sigma0_cls = clsCUDASigmaParamsDict[clsid]; + ProcessRFPCTask(task, devId); FreeCUDADevice(task.goallist); } diff --git a/Toolbox/SimulationSARTool/SimulationSAR/SigmaDatabase.cpp b/Toolbox/SimulationSARTool/SimulationSAR/SigmaDatabase.cpp index dbd5f65..1ac11b5 100644 --- a/Toolbox/SimulationSARTool/SimulationSAR/SigmaDatabase.cpp +++ b/Toolbox/SimulationSARTool/SimulationSAR/SigmaDatabase.cpp @@ -30,50 +30,55 @@ SigmaDatabase::SigmaDatabase() this->VH_sigmaParam.insert(std::pair(0, SigmaParam{ 0,0,0, 0, 0,0 })); this->VV_sigmaParam.insert(std::pair(0, SigmaParam{ 0,0,0, 0, 0,0 })); + this->HH_sigmaParam.insert(std::pair(10, SigmaParam{ -21.1019701821713, 9.00621457243906, 6.52932182540331, -1.11157376729893, -15.8022895411007, 11.4690828129602 })); + this->HH_sigmaParam.insert(std::pair(20, SigmaParam{ -43.6677042155964, 32.0245140457417, 0.511060658303930, -2.68482232690106, 6.29783274559538, 1.96648609622833 })); + this->HH_sigmaParam.insert(std::pair(40, SigmaParam{ 50.97, -62.9, -0.0968, 1.604, -4.637, 6.108 })); + this->HH_sigmaParam.insert(std::pair(60, SigmaParam{ -12.45,23.3097,3.187,-2.482,8.244,0.3632 })); + ////12 - //this->HH_sigmaParam.insert(std::pair(12, SigmaParam{ -21.1019701821713, 9.00621457243906, 6.52932182540331, - 1.11157376729893, - 15.8022895411007, 11.4690828129602 })); + this->HH_sigmaParam.insert(std::pair(12, SigmaParam{ -21.1019701821713, 9.00621457243906, 6.52932182540331, - 1.11157376729893, - 15.8022895411007, 11.4690828129602 })); //this->HV_sigmaParam.insert(std::pair(12, SigmaParam{ -30.0103645753547, 27.1700862271921, 11.8007376386356, - 0.933835390422269, - 16.4640776105300, 11.8318838032267 })); //this->VH_sigmaParam.insert(std::pair(12, SigmaParam{ -30.0103645753547, 27.1700862271921, 11.8007376386356, -0.933835390422269, -16.4640776105300, 11.8318838032267 })); //this->VV_sigmaParam.insert(std::pair(12, SigmaParam{ -21.1019701821713, 9.00621457243906, 6.52932182540331, -1.11157376729893, -15.8022895411007, 11.4690828129602 })); ////22 - //this->HH_sigmaParam.insert(std::pair(22, SigmaParam{ -43.6677042155964, 32.0245140457417, 0.511060658303930, - 2.68482232690106, 6.29783274559538, 1.96648609622833 })); + this->HH_sigmaParam.insert(std::pair(22, SigmaParam{ -43.6677042155964, 32.0245140457417, 0.511060658303930, - 2.68482232690106, 6.29783274559538, 1.96648609622833 })); //this->HV_sigmaParam.insert(std::pair(22, SigmaParam{ -36.3971634075803, 13.1296247093899, 1.12707368693158, - 1.88195857790977, 6.57450737122974, 2.11755051297951 })); //this->VH_sigmaParam.insert(std::pair(22, SigmaParam{ -36.3971634075803, 13.1296247093899, 1.12707368693158, -1.88195857790977, 6.57450737122974, 2.11755051297951 })); //this->VV_sigmaParam.insert(std::pair(22, SigmaParam{ -43.6677042155964, 32.0245140457417, 0.511060658303930, -2.68482232690106, 6.29783274559538, 1.96648609622833 })); ////30 - //this->HH_sigmaParam.insert(std::pair(30, SigmaParam{ -59.1080014669385, 47.6710707363975, 0.300193452564135, - 3.93463636916976, 5.99799798331127, - 10.3772604045974 })); + this->HH_sigmaParam.insert(std::pair(30, SigmaParam{ -59.1080014669385, 47.6710707363975, 0.300193452564135, - 3.93463636916976, 5.99799798331127, - 10.3772604045974 })); //this->HV_sigmaParam.insert(std::pair(30, SigmaParam{ -55.1864353240982, 32.2453149408716, 0.333758208816865, - 3.38774208141056, 6.12774897769798, - 10.1192846531823 })); //this->VH_sigmaParam.insert(std::pair(30, SigmaParam{ -55.1864353240982, 32.2453149408716, 0.333758208816865, - 3.38774208141056, 6.12774897769798, - 10.1192846531823 })); //this->VV_sigmaParam.insert(std::pair(30, SigmaParam{ -59.1080014669385, 47.6710707363975, 0.300193452564135, -3.93463636916976, 5.99799798331127, -10.3772604045974 })); ////50 - //this->HH_sigmaParam.insert(std::pair(50, SigmaParam{ -22.9105602882378, 8170.54100628307, 15.4916054293135, - 0.970580847008280, 28.9025325818511, - 21.4319176514170 })); + this->HH_sigmaParam.insert(std::pair(50, SigmaParam{ -22.9105602882378, 8170.54100628307, 15.4916054293135, - 0.970580847008280, 28.9025325818511, - 21.4319176514170 })); //this->HV_sigmaParam.insert(std::pair(50, SigmaParam{ -39.7459019584805, 151.391039247574, 5.17117231380975, - 4.10303899418773, 8.04893424718507, - 3.17171678851531 })); //this->VH_sigmaParam.insert(std::pair(50, SigmaParam{ -39.7459019584805, 151.391039247574, 5.17117231380975, -4.10303899418773, 8.04893424718507, -3.17171678851531 })); //this->VV_sigmaParam.insert(std::pair(50, SigmaParam{ -22.9105602882378, 8170.54100628307, 15.4916054293135, -0.970580847008280, 28.9025325818511, -21.4319176514170 })); ////61 - //this->HH_sigmaParam.insert(std::pair(61, SigmaParam{ 27.2590864500905, 95.6840751800642, 3.98975084647232, 50.3262749621072, 3.09962879546370, - 5.10400310274333 })); + this->HH_sigmaParam.insert(std::pair(61, SigmaParam{ 27.2590864500905, 95.6840751800642, 3.98975084647232, 50.3262749621072, 3.09962879546370, - 5.10400310274333 })); //this->HV_sigmaParam.insert(std::pair(61, SigmaParam{ -65.9799383836613, 106.831320929437, 1.53821651203361, 0.704332523237733, 36.3654715437260, - 13.7449876973719 })); //this->VH_sigmaParam.insert(std::pair(61, SigmaParam{ -65.9799383836613, 106.831320929437, 1.53821651203361, 0.704332523237733, 36.3654715437260, -13.7449876973719 })); //this->VV_sigmaParam.insert(std::pair(61, SigmaParam{ 27.2590864500905, 95.6840751800642, 3.98975084647232, 50.3262749621072, 3.09962879546370, -5.10400310274333 })); ////62 - //this->HH_sigmaParam.insert(std::pair(62, SigmaParam{ -34.3961764495281, 21.7503968763591, 1.15914650010176, - 2.83950292185421, 10.3519995095232, 2.75293811408200 })); + this->HH_sigmaParam.insert(std::pair(62, SigmaParam{ -34.3961764495281, 21.7503968763591, 1.15914650010176, - 2.83950292185421, 10.3519995095232, 2.75293811408200 })); //this->HV_sigmaParam.insert(std::pair(62, SigmaParam{ -34.0710914034599, 14.1778732014224, 3.47049853590805, - 1.73813229616801, 10.9627971440838, 2.19731364578002 })); //this->VH_sigmaParam.insert(std::pair(62, SigmaParam{ -34.0710914034599, 14.1778732014224, 3.47049853590805, -1.73813229616801, 10.9627971440838, 2.19731364578002 })); //this->VV_sigmaParam.insert(std::pair(62, SigmaParam{ -34.3961764495281, 21.7503968763591, 1.15914650010176, -2.83950292185421, 10.3519995095232, 2.75293811408200 })); ////80 - //this->HH_sigmaParam.insert(std::pair(80, SigmaParam{ -5.76486750987210, - 7.80014668607246, 0.0880097904597720, - 5.44564720816575, - 0.530358195545799, 1.04332202699956 })); + this->HH_sigmaParam.insert(std::pair(80, SigmaParam{ -5.76486750987210, - 7.80014668607246, 0.0880097904597720, - 5.44564720816575, - 0.530358195545799, 1.04332202699956 })); //this->HV_sigmaParam.insert(std::pair(80, SigmaParam{ 484.928701445606, - 0.992170190244375, - 1.98914783519718, - 507.127544388772, 0.195180814149377, 6.21339949756719 })); //this->VH_sigmaParam.insert(std::pair(80, SigmaParam{ 484.928701445606, -0.992170190244375, -1.98914783519718, -507.127544388772, 0.195180814149377, 6.21339949756719 })); //this->VV_sigmaParam.insert(std::pair(80, SigmaParam{ -5.76486750987210, -7.80014668607246, 0.0880097904597720, -5.44564720816575, -0.530358195545799, 1.04332202699956 })); ////90 - //this->HH_sigmaParam.insert(std::pair(90, SigmaParam{ -20.1761798059391, 13.2752519275021, 2.74667225608397, 3.63052241744923, 8.99932188120922, 34.8246533269446 })); + this->HH_sigmaParam.insert(std::pair(90, SigmaParam{ -20.1761798059391, 13.2752519275021, 2.74667225608397, 3.63052241744923, 8.99932188120922, 34.8246533269446 })); //this->HV_sigmaParam.insert(std::pair(90, SigmaParam{ -26.8776515733889, 10.4251866500052, 8.43273666535992, 4.33165922141213, 8.68204389555939, - 2.51718779582920 })); //this->VH_sigmaParam.insert(std::pair(90, SigmaParam{ -26.8776515733889, 10.4251866500052, 8.43273666535992, 4.33165922141213, 8.68204389555939, - 2.51718779582920 })); //this->VV_sigmaParam.insert(std::pair(90, SigmaParam{ -20.1761798059391, 13.2752519275021, 2.74667225608397, 3.63052241744923, 8.99932188120922, 34.8246533269446 })); diff --git a/Toolbox/SimulationSARTool/SimulationSAR/TBPImageAlgCls.cpp b/Toolbox/SimulationSARTool/SimulationSAR/TBPImageAlgCls.cpp index 8286a6b..7e2cd86 100644 --- a/Toolbox/SimulationSARTool/SimulationSAR/TBPImageAlgCls.cpp +++ b/Toolbox/SimulationSARTool/SimulationSAR/TBPImageAlgCls.cpp @@ -337,6 +337,7 @@ ErrorCode TBPImageAlgCls::ProcessGPU() h_data.AntZ = (double*)mallocCUDAHost(sizeof(double) * block_pfrcount); qDebug() << "r_vec [0]:\t" << h_data.r_vec[0]; + qDebug() << "r_vec [end]:\t" << h_data.r_vec[h_data.Nfft-1]; qDebug() << "Range resolution(m):\t" << step; qDebug() << "range Scence(m):\t" << maxWr; qDebug() << "start Freq:\t" << centerFreq - bandwidth / 2; From 934a39cbff8c61d8eba7b0b5d484f94f50bde8f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=A2=9E=E8=BE=89?= <3045316072@qq.com> Date: Wed, 2 Apr 2025 10:28:51 +0800 Subject: [PATCH 02/44] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E5=8F=82=E6=95=B0=EF=BC=8C=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E7=94=A8=E4=BA=8E=E6=A3=80=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SimulationSAR/GPURFPC.cu | 73 +++++++++++-------- .../SimulationSAR/GPURFPC.cuh | 8 +- .../SimulationSAR/QImageSARRFPC.ui | 6 +- .../SimulationSAR/RFPCProcessCls.cpp | 18 ++++- 4 files changed, 65 insertions(+), 40 deletions(-) diff --git a/Toolbox/SimulationSARTool/SimulationSAR/GPURFPC.cu b/Toolbox/SimulationSARTool/SimulationSAR/GPURFPC.cu index 049b07b..bb27ce1 100644 --- a/Toolbox/SimulationSARTool/SimulationSAR/GPURFPC.cu +++ b/Toolbox/SimulationSARTool/SimulationSAR/GPURFPC.cu @@ -490,7 +490,10 @@ __global__ void Kernel_Computer_R_amp_NoAntPattern( double maxGain, double GainWeight, float* d_temp_R, float* d_temp_amps// 计算输出 ) { - long long idx = blockIdx.x * blockDim.x + threadIdx.x; // 获取当前的线程编码 + long long tid = threadIdx.x; + long long bid = blockIdx.x; + long long dmx = blockDim.x; + long long idx = bid*dmx+tid; // 获取当前的线程编码 long long prfId = idx / SHAREMEMORY_FLOAT_HALF; long long posId = idx % SHAREMEMORY_FLOAT_HALF + startPosId; // 当前线程对应的影像点 @@ -506,26 +509,13 @@ __global__ void Kernel_Computer_R_amp_NoAntPattern( double RstZ = antp.Pz - gp.Tz; double RstR = sqrt(RstX * RstX + RstY * RstY + RstZ * RstZ); // 矢量距离 - - if (RstRFarR) { - - if (prfId > 200) { - printf("error prfId:%d ,idx:%d RstR:%e antP=[%e,%e,%e] ,gp=[%e,%e,%e]\n", prfId, idx, RstR, - antp.Px, antp.Py, antp.Pz, gp.Tx, gp.Ty, gp.Tz - ); - } - - d_temp_R[idx] = 0; + d_temp_R[idx] = RstR; d_temp_amps[idx] = 0; return; } else { - if (prfId > 200) { - printf(" prfId:%d ,idx:%d RstR:%e antP=[%e,%e,%e] ,gp=[%e,%e,%e]\n", prfId, idx, RstR, - antp.Px, antp.Py, antp.Pz, gp.Tx, gp.Ty, gp.Tz - ); - } + RstX = RstX / RstR; RstY = RstY / RstR; RstZ = RstZ / RstR; @@ -540,8 +530,8 @@ __global__ void Kernel_Computer_R_amp_NoAntPattern( float localangle = acosf(dotAB / (slopR)); if (localangle < 0 || localangle >= LAMP_CUDA_PI / 2 || isnan(localangle)) { - d_temp_R[idx] = 0; - d_temp_amps[idx] = 0; + d_temp_R[idx] = RstR; + d_temp_amps[idx] = localangle; return; } else {} @@ -572,21 +562,35 @@ __global__ void Kernel_Computer_R_amp_NoAntPattern( sigma = powf(10.0, sigma / 10.0); float temp_amp = float(ampGain * Pt * sigma); - float temp_R = float(double(RstR - refPhaseRange)); + float temp_R = float(RstR - refPhaseRange); if (isnan(temp_amp) || isnan(temp_R) || isinf(temp_amp) || isinf(temp_R)) { - printf("amp is nan or R is nan,amp=%f;R=%f; \n", temp_amp, temp_R); - d_temp_R[idx] = 0; - d_temp_amps[idx] = 0; return; } else { - - d_temp_amps[idx] = temp_amp ; - d_temp_R[idx] = temp_R; - - return; + d_temp_amps[idx] = temp_amp ; + d_temp_R[idx] = temp_R ; + //if (prfId > 200) { + // printf("idx:%lld , prfid:%lld , d_temp_amp=%e,d_temp_R=%e\n", idx, prfId,d_temp_amps[idx], d_temp_R[idx]); + //} + //return; } + //if (isnan(temp_amp) || isnan(temp_R) || isinf(temp_amp) || isinf(temp_R)) { + // printf("amp is nan or R is nan,amp=%f;R=%f; \n", temp_amp, temp_R); + // d_temp_R[idx] = 0; + // d_temp_amps[idx] = 0; + // return; + //} + //else { + // if (prfId > 200) { + // printf("error prfId:%ld RstR:%e antP=[%e,%e,%e] ,gp=[%e,%e,%e],temp_amp=%e,temp_R=%e\n", prfId, RstR, + // antp.Px, antp.Py, antp.Pz, gp.Tx, gp.Ty, gp.Tz, + // temp_amp, temp_R); + // } + // d_temp_amps[idx] = temp_amp; + // d_temp_R[idx] = temp_R; + // return; + //} } } } @@ -622,7 +626,9 @@ __global__ void CUDA_Kernel_Computer_echo_NoAntPattern( s_R[psid] = d_temp_R[pixelId]; s_amp[psid] = d_temp_amps[pixelId]; if (prfId > 200) { - printf("prfId:%d ,idx:%d s_R:%f S_amp:%f \n", prfId, idx, s_R[psid], s_amp[psid]); + printf(" s_R=%e S_amp=%e d_temp_R=%e d_temp_amps=%e idx=%lld prfid=%lld\n", s_R[psid], s_amp[psid], + d_temp_R[pixelId], d_temp_amps[pixelId], idx, prfId + ); } } @@ -667,7 +673,7 @@ __global__ void CUDA_Kernel_Computer_echo_NoAntPattern( /** 分块处理 ****************************************************************************************************************/ -extern "C" void ProcessRFPCTask(RFPCTask& task, long devid) +extern "C" void ProcessRFPCTask(RFPCTask& task, long devid, float* h_R, float* h_amp) { size_t pixelcount = task.prfNum * task.freqNum; size_t grid_size = (pixelcount + BLOCK_SIZE - 1) / BLOCK_SIZE; @@ -686,6 +692,7 @@ extern "C" void ProcessRFPCTask(RFPCTask& task, long devid) long prfcount = task.prfNum; long process = 0; for (long sTi = 0; sTi < task.targetnum; sTi = sTi + SHAREMEMORY_FLOAT_HALF) { + cudaBlocknum = (task.prfNum * SHAREMEMORY_FLOAT_HALF + BLOCK_SIZE - 1) / BLOCK_SIZE; Kernel_Computer_R_amp_NoAntPattern << > > ( task.antlist, @@ -703,6 +710,9 @@ extern "C" void ProcessRFPCTask(RFPCTask& task, long devid) PrintLasterError("CUDA_Kernel_Computer_R_amp"); cudaDeviceSynchronize(); + DeviceToHost(h_R, d_R, task.prfNum * SHAREMEMORY_FLOAT_HALF * sizeof(float)); + DeviceToHost(h_amp, d_amps, task.prfNum * SHAREMEMORY_FLOAT_HALF * sizeof(float)); + break; cudaBlocknum = (task.prfNum * BLOCK_FREQNUM + BLOCK_SIZE- 1) / BLOCK_SIZE; CUDA_Kernel_Computer_echo_NoAntPattern << > > ( @@ -718,6 +728,11 @@ extern "C" void ProcessRFPCTask(RFPCTask& task, long devid) process = sTi * 100.0 / task.targetnum; PRINT("device ID : %d , TargetID [%f]: %d / %d finished %d\n", devid, sTi * 100.0 / task.targetnum, sTi, task.targetnum, devid); } + + + + + } diff --git a/Toolbox/SimulationSARTool/SimulationSAR/GPURFPC.cuh b/Toolbox/SimulationSARTool/SimulationSAR/GPURFPC.cuh index 48ec1be..0515694 100644 --- a/Toolbox/SimulationSARTool/SimulationSAR/GPURFPC.cuh +++ b/Toolbox/SimulationSARTool/SimulationSAR/GPURFPC.cuh @@ -16,11 +16,7 @@ extern "C" struct SateState { - double Px, Py, Pz, Vx, Vy, Vz; - //double antXaxisX, antXaxisY, antXaxisZ; - //double antYaxisX, antYaxisY, antYaxisZ; - //double antZaxisX, antZaxisY, antZaxisZ; - double antDirectX, antDirectY, antDirectZ; + double Px, Py, Pz, Vx, Vy, Vz,antDirectX, antDirectY, antDirectZ; }; @@ -152,7 +148,7 @@ extern "C" void CUDA_RFPC_MainProcess( extern "C" double* hostSigmaData_toDevice(int devid); -extern "C" void ProcessRFPCTask(RFPCTask& task,long devid); +extern "C" void ProcessRFPCTask(RFPCTask& task,long devid,float* h_R,float* h_amp); diff --git a/Toolbox/SimulationSARTool/SimulationSAR/QImageSARRFPC.ui b/Toolbox/SimulationSARTool/SimulationSAR/QImageSARRFPC.ui index 3d6693a..5d7afcf 100644 --- a/Toolbox/SimulationSARTool/SimulationSAR/QImageSARRFPC.ui +++ b/Toolbox/SimulationSARTool/SimulationSAR/QImageSARRFPC.ui @@ -103,7 +103,7 @@ - D:/FZSimulation/LTDQ/Input/LandCover.dat + D:/FZSimulation/LTDQ/Input/testEcho/LandCover.dat @@ -233,7 +233,7 @@ - D:/FZSimulation/LTDQ/Input/DEM_XYZ.dat + D:/FZSimulation/LTDQ/Input/testEcho/DEMXYZ.dat @@ -350,7 +350,7 @@ - D:/FZSimulation/LTDQ/Input/DEM_Sloper.dat + D:/FZSimulation/LTDQ/Input/testEcho/DEMSloper.dat diff --git a/Toolbox/SimulationSARTool/SimulationSAR/RFPCProcessCls.cpp b/Toolbox/SimulationSARTool/SimulationSAR/RFPCProcessCls.cpp index e704c0f..fe5dc8a 100644 --- a/Toolbox/SimulationSARTool/SimulationSAR/RFPCProcessCls.cpp +++ b/Toolbox/SimulationSARTool/SimulationSAR/RFPCProcessCls.cpp @@ -1114,9 +1114,18 @@ ErrorCode RFPCProcessCls::RFPCMainProcess_GPU_NoAntPattern(size_t startprfid, si task.antlist = (SateState*)mallocCUDADevice(prfcount * sizeof(SateState), devId); HostToDevice(h_antlist.get(), task.antlist, sizeof(SateState) * prfcount); - + printf("h_antlist: %e,%e,%e,%e,%e,%e,%e,%e,%e \n", + h_antlist.get()[0].Px, h_antlist.get()[0].Py, h_antlist.get()[0].Pz, + h_antlist.get()[0].Vx, h_antlist.get()[0].Vy, h_antlist.get()[0].Vz, + h_antlist.get()[0].antDirectX, h_antlist.get()[0].antDirectY, h_antlist.get()[0].antDirectZ + ); + testOutAmpArr(QString("antlist_%1.dat").arg(devId), (double*)(h_antlist.get()), prfcount, 9); } + + float* h_R = (float*)mallocCUDAHost(sizeof(float) * prfcount * SHAREMEMORY_FLOAT_HALF); //2GB 璺濈 + float* h_amp = (float*)mallocCUDAHost(sizeof(float) * prfcount * SHAREMEMORY_FLOAT_HALF);//2GB 寮哄害 + // 鍒嗗潡璁$畻 for (const auto& pair : clsGoalStateDict) { long clsid = pair.first; @@ -1128,7 +1137,12 @@ ErrorCode RFPCProcessCls::RFPCMainProcess_GPU_NoAntPattern(size_t startprfid, si task.goallist = (GoalState*)mallocCUDADevice(clscount * sizeof(GoalState), devId); HostToDevice(clsGoalStateDict[clsid].get(), task.goallist, sizeof(GoalState) * clscount); - ProcessRFPCTask(task, devId); + + + + ProcessRFPCTask(task, devId, h_R, h_amp); + testOutDataArr(QString("h_R_%1.bin").arg(devId), h_R, prfcount, SHAREMEMORY_FLOAT_HALF); + exit(-1); FreeCUDADevice(task.goallist); } From 3c1fd3a91a57f57063a6dc9cae590277f284cac1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=A2=9E=E8=BE=89?= <3045316072@qq.com> Date: Wed, 2 Apr 2025 16:47:01 +0800 Subject: [PATCH 03/44] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E4=BA=86=E6=88=90?= =?UTF-8?q?=E5=83=8F=E6=A3=80=E7=B4=A2=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GPUBaseLib/GPUTool/GPUTool.cuh | 2 +- .../SimulationSAR/GPURFPC.cu | 93 +++++++------------ .../SimulationSAR/QImageSARRFPC.ui | 6 +- .../SimulationSAR/RFPCProcessCls.cpp | 13 ++- 4 files changed, 45 insertions(+), 69 deletions(-) diff --git a/GPUBaseLib/GPUTool/GPUTool.cuh b/GPUBaseLib/GPUTool/GPUTool.cuh index b380dc5..c2bd1d4 100644 --- a/GPUBaseLib/GPUTool/GPUTool.cuh +++ b/GPUBaseLib/GPUTool/GPUTool.cuh @@ -21,7 +21,7 @@ #define BLOCK_SIZE 256 #define SHAREMEMORY_BYTE 49152 #define SHAREMEMORY_FLOAT_HALF_STEP 2 -#define SHAREMEMORY_FLOAT_HALF SHAREMEMORY_FLOAT_HALF_STEP*BLOCK_SIZE +#define SHAREMEMORY_FLOAT_HALF 512 #define SHAREMEMORY_DEM_STEP 768 #define SHAREMEMORY_Reflect 612 diff --git a/Toolbox/SimulationSARTool/SimulationSAR/GPURFPC.cu b/Toolbox/SimulationSARTool/SimulationSAR/GPURFPC.cu index bb27ce1..62b3a4d 100644 --- a/Toolbox/SimulationSARTool/SimulationSAR/GPURFPC.cu +++ b/Toolbox/SimulationSARTool/SimulationSAR/GPURFPC.cu @@ -490,16 +490,14 @@ __global__ void Kernel_Computer_R_amp_NoAntPattern( double maxGain, double GainWeight, float* d_temp_R, float* d_temp_amps// 计算输出 ) { - long long tid = threadIdx.x; - long long bid = blockIdx.x; - long long dmx = blockDim.x; - long long idx = bid*dmx+tid; // 获取当前的线程编码 - long long prfId = idx / SHAREMEMORY_FLOAT_HALF; - long long posId = idx % SHAREMEMORY_FLOAT_HALF + startPosId; // 当前线程对应的影像点 - - //if (prfId > 20000) { - // printf("prfid %d,PRFCount : %d\n", prfId, PRFCount); - //} + int tid = threadIdx.x; + int bid = blockIdx.x; + int dmx = blockDim.x; + int idx = bid*dmx+tid; // 获取当前的线程编码 + int prfId = idx / SHAREMEMORY_FLOAT_HALF; + int posId = idx % SHAREMEMORY_FLOAT_HALF + startPosId; // 当前线程对应的影像点 + //d_temp_R[idx] = pixelcount; + //d_temp_amps[idx] = posId; if (prfId < PRFCount && posId < pixelcount) { SateState antp = antlist[prfId]; @@ -510,7 +508,7 @@ __global__ void Kernel_Computer_R_amp_NoAntPattern( double RstR = sqrt(RstX * RstX + RstY * RstY + RstZ * RstZ); // 矢量距离 if (RstRFarR) { - d_temp_R[idx] = RstR; + d_temp_R[idx] = 0; d_temp_amps[idx] = 0; return; } @@ -530,8 +528,8 @@ __global__ void Kernel_Computer_R_amp_NoAntPattern( float localangle = acosf(dotAB / (slopR)); if (localangle < 0 || localangle >= LAMP_CUDA_PI / 2 || isnan(localangle)) { - d_temp_R[idx] = RstR; - d_temp_amps[idx] = localangle; + d_temp_R[idx] = 0; + d_temp_amps[idx] = 0; return; } else {} @@ -562,41 +560,24 @@ __global__ void Kernel_Computer_R_amp_NoAntPattern( sigma = powf(10.0, sigma / 10.0); float temp_amp = float(ampGain * Pt * sigma); - float temp_R = float(RstR - refPhaseRange); - + double temp_R = RstR - refPhaseRange; if (isnan(temp_amp) || isnan(temp_R) || isinf(temp_amp) || isinf(temp_R)) { + d_temp_R[idx] = 0; + d_temp_amps[idx] = 0; return; } else { - d_temp_amps[idx] = temp_amp ; - d_temp_R[idx] = temp_R ; - //if (prfId > 200) { - // printf("idx:%lld , prfid:%lld , d_temp_amp=%e,d_temp_R=%e\n", idx, prfId,d_temp_amps[idx], d_temp_R[idx]); - //} - //return; + d_temp_amps[idx] = temp_amp; + d_temp_R[idx] =static_cast(temp_R); + return; } - //if (isnan(temp_amp) || isnan(temp_R) || isinf(temp_amp) || isinf(temp_R)) { - // printf("amp is nan or R is nan,amp=%f;R=%f; \n", temp_amp, temp_R); - // d_temp_R[idx] = 0; - // d_temp_amps[idx] = 0; - // return; - //} - //else { - // if (prfId > 200) { - // printf("error prfId:%ld RstR:%e antP=[%e,%e,%e] ,gp=[%e,%e,%e],temp_amp=%e,temp_R=%e\n", prfId, RstR, - // antp.Px, antp.Py, antp.Pz, gp.Tx, gp.Ty, gp.Tz, - // temp_amp, temp_R); - // } - // d_temp_amps[idx] = temp_amp; - // d_temp_R[idx] = temp_R; - // return; - //} + } } } else { d_temp_R[idx] = 0; - d_temp_amps[idx] = 0; + d_temp_amps[idx] =0; return; } @@ -612,24 +593,20 @@ __global__ void CUDA_Kernel_Computer_echo_NoAntPattern( __shared__ float s_R[SHAREMEMORY_FLOAT_HALF]; // 注意一个完整的block_size 共享相同内存 __shared__ float s_amp[SHAREMEMORY_FLOAT_HALF]; - long long tid = threadIdx.x; - long long bid = blockIdx.x; - long long idx = bid * blockDim.x + tid; - long long prfId = idx / nextfreqNum; // 脉冲ID - long long fId = idx % nextfreqNum;//频率ID + long tid = threadIdx.x; + long bid = blockIdx.x; + long idx = bid * blockDim.x + tid; + long prfId = idx / nextfreqNum; // 脉冲ID + long fId = idx % nextfreqNum;//频率ID - long long psid = 0; - long long pixelId = 0; + long psid = 0; + long pixelId = 0; for (long ii = 0; ii < SHAREMEMORY_FLOAT_HALF_STEP; ii++) { // SHAREMEMORY_FLOAT_HALF_STEP * BLOCK_SIZE=SHAREMEMORY_FLOAT_HALF psid = ii * BLOCK_SIZE + tid; pixelId = prfId * SHAREMEMORY_FLOAT_HALF + psid; s_R[psid] = d_temp_R[pixelId]; s_amp[psid] = d_temp_amps[pixelId]; - if (prfId > 200) { - printf(" s_R=%e S_amp=%e d_temp_R=%e d_temp_amps=%e idx=%lld prfid=%lld\n", s_R[psid], s_amp[psid], - d_temp_R[pixelId], d_temp_amps[pixelId], idx, prfId - ); - } + } __syncthreads(); // 确定所有待处理数据都已经进入程序中 @@ -656,11 +633,11 @@ __global__ void CUDA_Kernel_Computer_echo_NoAntPattern( //if (dataid > 5000) { // printf("echo_ID=%d; dataid=%d;ehodata=(%f,%f);R=%f;amp=%f;\n", echo_ID, dataid, temp_real, temp_imag, s_R[0], s_amp[0]); //} - if (isnan(temp_phi) || isnan(temp_amp) || isnan(echo.x) || isnan(echo.y) - || isinf(temp_phi) || isinf(temp_amp) || isinf(echo.x) || isinf(echo.y) - ) { - printf("[amp,phi,real,imag]=[%f,%f,%f,%f];\n", temp_amp, temp_phi, echo.x, echo.y); - } + //if (isnan(temp_phi) || isnan(temp_amp) || isnan(echo.x) || isnan(echo.y) + // || isinf(temp_phi) || isinf(temp_amp) || isinf(echo.x) || isinf(echo.y) + // ) { + // printf("[amp,phi,real,imag]=[%f,%f,%f,%f];\n", temp_amp, temp_phi, echo.x, echo.y); + //} } @@ -710,9 +687,9 @@ extern "C" void ProcessRFPCTask(RFPCTask& task, long devid, float* h_R, float* h PrintLasterError("CUDA_Kernel_Computer_R_amp"); cudaDeviceSynchronize(); - DeviceToHost(h_R, d_R, task.prfNum * SHAREMEMORY_FLOAT_HALF * sizeof(float)); - DeviceToHost(h_amp, d_amps, task.prfNum * SHAREMEMORY_FLOAT_HALF * sizeof(float)); - break; + //DeviceToHost(h_R, d_R, task.prfNum * SHAREMEMORY_FLOAT_HALF * sizeof(float)); + //DeviceToHost(h_amp, d_amps, task.prfNum * SHAREMEMORY_FLOAT_HALF * sizeof(float)); + //break; cudaBlocknum = (task.prfNum * BLOCK_FREQNUM + BLOCK_SIZE- 1) / BLOCK_SIZE; CUDA_Kernel_Computer_echo_NoAntPattern << > > ( diff --git a/Toolbox/SimulationSARTool/SimulationSAR/QImageSARRFPC.ui b/Toolbox/SimulationSARTool/SimulationSAR/QImageSARRFPC.ui index 5d7afcf..9ff2ec6 100644 --- a/Toolbox/SimulationSARTool/SimulationSAR/QImageSARRFPC.ui +++ b/Toolbox/SimulationSARTool/SimulationSAR/QImageSARRFPC.ui @@ -103,7 +103,7 @@ - D:/FZSimulation/LTDQ/Input/testEcho/LandCover.dat + D:/FZSimulation/LTDQ/Input/DEM30/LandCover.dat @@ -233,7 +233,7 @@ - D:/FZSimulation/LTDQ/Input/testEcho/DEMXYZ.dat + D:/FZSimulation/LTDQ/Input/DEM30/DEM_XYZ.dat @@ -350,7 +350,7 @@ - D:/FZSimulation/LTDQ/Input/testEcho/DEMSloper.dat + D:/FZSimulation/LTDQ/Input/DEM30/DEM_Sloper.dat diff --git a/Toolbox/SimulationSARTool/SimulationSAR/RFPCProcessCls.cpp b/Toolbox/SimulationSARTool/SimulationSAR/RFPCProcessCls.cpp index fe5dc8a..7001179 100644 --- a/Toolbox/SimulationSARTool/SimulationSAR/RFPCProcessCls.cpp +++ b/Toolbox/SimulationSARTool/SimulationSAR/RFPCProcessCls.cpp @@ -1119,7 +1119,7 @@ ErrorCode RFPCProcessCls::RFPCMainProcess_GPU_NoAntPattern(size_t startprfid, si h_antlist.get()[0].Vx, h_antlist.get()[0].Vy, h_antlist.get()[0].Vz, h_antlist.get()[0].antDirectX, h_antlist.get()[0].antDirectY, h_antlist.get()[0].antDirectZ ); - testOutAmpArr(QString("antlist_%1.dat").arg(devId), (double*)(h_antlist.get()), prfcount, 9); + //testOutAmpArr(QString("antlist_%1.dat").arg(devId), (double*)(h_antlist.get()), prfcount, 9); } @@ -1136,13 +1136,11 @@ ErrorCode RFPCProcessCls::RFPCMainProcess_GPU_NoAntPattern(size_t startprfid, si task.targetnum = clscount; task.goallist = (GoalState*)mallocCUDADevice(clscount * sizeof(GoalState), devId); HostToDevice(clsGoalStateDict[clsid].get(), task.goallist, sizeof(GoalState) * clscount); - - - ProcessRFPCTask(task, devId, h_R, h_amp); - testOutDataArr(QString("h_R_%1.bin").arg(devId), h_R, prfcount, SHAREMEMORY_FLOAT_HALF); - exit(-1); + //testOutDataArr(QString("h_R_%1.bin").arg(devId), h_R, prfcount, SHAREMEMORY_FLOAT_HALF); + //testOutDataArr(QString("h_amp_%1.bin").arg(devId), h_amp, prfcount, SHAREMEMORY_FLOAT_HALF); + //exit(-1); FreeCUDADevice(task.goallist); } @@ -1153,7 +1151,8 @@ ErrorCode RFPCProcessCls::RFPCMainProcess_GPU_NoAntPattern(size_t startprfid, si FreeCUDADevice(task.d_echoData); FreeCUDADevice(task.antlist); //FreeCUDADevice(task.goallist); - + FreeCUDAHost(h_R); + FreeCUDAHost(h_amp); } PRINT("dem cover processbar: [100 precent]\n"); From 45535219911847bc3a2319d472f78d4198e33753 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=A2=9E=E8=BE=89?= <3045316072@qq.com> Date: Sat, 5 Apr 2025 12:16:22 +0800 Subject: [PATCH 04/44] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=96=9C=E8=B7=9D?= =?UTF-8?q?=E6=88=90=E5=83=8F=E7=AC=AC=E4=B8=80=E4=B8=AA=E5=B7=A5=E5=85=B7?= =?UTF-8?q?=EF=BC=9A=20=E6=88=90=E5=83=8F=E6=8A=95=E5=BD=B1=E7=B2=97?= =?UTF-8?q?=E5=B9=B3=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BaseTool/BaseConstVariable.h | 6 +- BaseCommonLibrary/BaseTool/GeoOperator.cpp | 38 ++ BaseCommonLibrary/BaseTool/GeoOperator.h | 1 + .../ToolAbstract/QToolAbstract.cpp | 5 + .../ToolAbstract/QToolAbstract.h | 2 + .../SARImage/GPUBPImageNet.cu | 204 +++++++++++ .../SARImage/GPUBPImageNet.cuh | 28 ++ .../SARImage/ImageNetOperator.cpp | 173 ++++++++++ .../SARImage/ImageNetOperator.h | 16 + .../SARImage/InitCreateImageXYZDialog.cpp | 77 +++++ .../SARImage/InitCreateImageXYZDialog.h | 36 ++ .../SARImage/InitCreateImageXYZDialog.ui | 250 ++++++++++++++ .../SimulationSAR/GPUBPTool.cuh | 7 +- .../SimulationSAR/GPUTBPImage.cu | 165 --------- .../SimulationSAR/GPUTBPImage.cuh | 9 - .../SimulationSAR/QSimulationBPImage.cpp | 11 +- .../SimulationSAR/TBPImageAlgCls.cpp | 325 ++++++++---------- .../SimulationSAR/TBPImageAlgCls.h | 22 +- .../SimulationSARTool/SimulationSARTool.cpp | 24 +- Toolbox/SimulationSARTool/SimulationSARTool.h | 9 + .../SimulationSARTool.vcxproj | 9 +- .../SimulationSARTool.vcxproj.filters | 24 ++ 22 files changed, 1056 insertions(+), 385 deletions(-) create mode 100644 Toolbox/SimulationSARTool/SARImage/GPUBPImageNet.cu create mode 100644 Toolbox/SimulationSARTool/SARImage/GPUBPImageNet.cuh create mode 100644 Toolbox/SimulationSARTool/SARImage/ImageNetOperator.cpp create mode 100644 Toolbox/SimulationSARTool/SARImage/ImageNetOperator.h create mode 100644 Toolbox/SimulationSARTool/SARImage/InitCreateImageXYZDialog.cpp create mode 100644 Toolbox/SimulationSARTool/SARImage/InitCreateImageXYZDialog.h create mode 100644 Toolbox/SimulationSARTool/SARImage/InitCreateImageXYZDialog.ui diff --git a/BaseCommonLibrary/BaseTool/BaseConstVariable.h b/BaseCommonLibrary/BaseTool/BaseConstVariable.h index f16210d..9707cb0 100644 --- a/BaseCommonLibrary/BaseTool/BaseConstVariable.h +++ b/BaseCommonLibrary/BaseTool/BaseConstVariable.h @@ -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; diff --git a/BaseCommonLibrary/BaseTool/GeoOperator.cpp b/BaseCommonLibrary/BaseTool/GeoOperator.cpp index 9784c3a..5a1d12a 100644 --- a/BaseCommonLibrary/BaseTool/GeoOperator.cpp +++ b/BaseCommonLibrary/BaseTool/GeoOperator.cpp @@ -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) { diff --git a/BaseCommonLibrary/BaseTool/GeoOperator.h b/BaseCommonLibrary/BaseTool/GeoOperator.h index 6d4eb8a..a2c42cc 100644 --- a/BaseCommonLibrary/BaseTool/GeoOperator.h +++ b/BaseCommonLibrary/BaseTool/GeoOperator.h @@ -30,6 +30,7 @@ Eigen::MatrixXd BASECONSTVARIABLEAPI LLA2XYZ(Eigen::MatrixXd landpoint); /// 缁忕含搴--degree 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); diff --git a/BaseCommonLibrary/ToolAbstract/QToolAbstract.cpp b/BaseCommonLibrary/ToolAbstract/QToolAbstract.cpp index 302abc3..a20a9c5 100644 --- a/BaseCommonLibrary/ToolAbstract/QToolAbstract.cpp +++ b/BaseCommonLibrary/ToolAbstract/QToolAbstract.cpp @@ -32,5 +32,10 @@ QString QToolAbstract::getToolName() } void QToolAbstract::excute() +{ + this->run(); +} + +void QToolAbstract::run() { } diff --git a/BaseCommonLibrary/ToolAbstract/QToolAbstract.h b/BaseCommonLibrary/ToolAbstract/QToolAbstract.h index 5f00324..fda74f6 100644 --- a/BaseCommonLibrary/ToolAbstract/QToolAbstract.h +++ b/BaseCommonLibrary/ToolAbstract/QToolAbstract.h @@ -27,6 +27,8 @@ public slots: public: QVector toolPath; QString toolname; +public: + virtual void run(); }; /* diff --git a/Toolbox/SimulationSARTool/SARImage/GPUBPImageNet.cu b/Toolbox/SimulationSARTool/SARImage/GPUBPImageNet.cu new file mode 100644 index 0000000..c5e94a2 --- /dev/null +++ b/Toolbox/SimulationSARTool/SARImage/GPUBPImageNet.cu @@ -0,0 +1,204 @@ +#include "GPUBaseTool.h" +#include "GPUBPTool.cuh" +#include +#include +#include +#include +#include +#include +#include +#include + +#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 << > > ( + antPx, antPy, antPz, + antDirx, antDiry, antDirz, + imgx, imgy, imgz, + prfcount, freqpoints, meanH, + Rnear, dx); + PrintLasterError("TIMEBPCreateImageGrid"); + cudaDeviceSynchronize(); +} diff --git a/Toolbox/SimulationSARTool/SARImage/GPUBPImageNet.cuh b/Toolbox/SimulationSARTool/SARImage/GPUBPImageNet.cuh new file mode 100644 index 0000000..e62e525 --- /dev/null +++ b/Toolbox/SimulationSARTool/SARImage/GPUBPImageNet.cuh @@ -0,0 +1,28 @@ +#ifndef __GPUBPIMAGENET_CUH___ +#define __GPUBPIMAGENET_CUH___ + + +#include "BaseConstVariable.h" +#include "GPUTool.cuh" +#include +#include +#include +#include +#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 \ No newline at end of file diff --git a/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.cpp b/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.cpp new file mode 100644 index 0000000..08011a9 --- /dev/null +++ b/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.cpp @@ -0,0 +1,173 @@ +#include "ImageNetOperator.h" +#include "LogInfoCls.h" +#include "PrintMsgToQDebug.h" +#include +#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 Pxs((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); + std::shared_ptr Pys((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); + std::shared_ptr Pzs((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); + std::shared_ptr AntDirectX((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); + std::shared_ptr AntDirectY((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); + std::shared_ptr AntDirectZ((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); + + { + long colnum = 19; + std::shared_ptr antpos =readDataArr(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 d_Pxs((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice); + std::shared_ptr d_Pys((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice); + std::shared_ptr d_Pzs((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice); + std::shared_ptr d_AntDirectX((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice); + std::shared_ptr d_AntDirectY((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice); + std::shared_ptr 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 demx = readDataArr(outimgxyz, 0, startcolidx, prfcount, tempechocol, 1, GDALREADARRCOPYMETHOD::VARIABLEMETHOD); + std::shared_ptr demy = readDataArr(outimgxyz, 0, startcolidx, prfcount, tempechocol, 2, GDALREADARRCOPYMETHOD::VARIABLEMETHOD); + std::shared_ptr demz = readDataArr(outimgxyz, 0, startcolidx, prfcount, tempechocol, 3, GDALREADARRCOPYMETHOD::VARIABLEMETHOD); + + std::shared_ptr h_demx((double*)mallocCUDAHost(sizeof(double) * prfcount * tempechocol), FreeCUDAHost); + std::shared_ptr h_demy((double*)mallocCUDAHost(sizeof(double) * prfcount * tempechocol), FreeCUDAHost); + std::shared_ptr 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 d_demx((double*)mallocCUDADevice(sizeof(double) * prfcount * tempechocol), FreeCUDADevice); + std::shared_ptr d_demy((double*)mallocCUDADevice(sizeof(double) * prfcount * tempechocol), FreeCUDADevice); + std::shared_ptr 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 demllx = readDataArr(outimgll, 0, startcolidx, prfcount, tempechocol, 1, GDALREADARRCOPYMETHOD::VARIABLEMETHOD); + std::shared_ptr demlly = readDataArr(outimgll, 0, startcolidx, prfcount, tempechocol, 2, GDALREADARRCOPYMETHOD::VARIABLEMETHOD); + std::shared_ptr demllz = readDataArr(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() << "---------------------------------------------------------------------------------"; +} diff --git a/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.h b/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.h new file mode 100644 index 0000000..3410a8f --- /dev/null +++ b/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.h @@ -0,0 +1,16 @@ +#pragma once +#ifndef __ImageNetOperator__H_ +#define __ImageNetOperator__H_ +#include "BaseConstVariable.h" +#include + + +void InitCreateImageXYZProcess(QString& outImageLLPath, QString& outImageXYZPath, QString& InEchoGPSDataPath, double& NearRange, double& RangeResolution, int64_t& RangeNum); + + + + + + + +#endif diff --git a/Toolbox/SimulationSARTool/SARImage/InitCreateImageXYZDialog.cpp b/Toolbox/SimulationSARTool/SARImage/InitCreateImageXYZDialog.cpp new file mode 100644 index 0000000..68228d8 --- /dev/null +++ b/Toolbox/SimulationSARTool/SARImage/InitCreateImageXYZDialog.cpp @@ -0,0 +1,77 @@ +#include "InitCreateImageXYZDialog.h" +#include "ui_InitCreateImageXYZDialog.h" +#include +#include +#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(); +} diff --git a/Toolbox/SimulationSARTool/SARImage/InitCreateImageXYZDialog.h b/Toolbox/SimulationSARTool/SARImage/InitCreateImageXYZDialog.h new file mode 100644 index 0000000..a334c35 --- /dev/null +++ b/Toolbox/SimulationSARTool/SARImage/InitCreateImageXYZDialog.h @@ -0,0 +1,36 @@ +#pragma once +#ifndef __InitCreateImageXYZDialog__HH__ +#define __InitCreateImageXYZDialog__HH__ + + +#include + + +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 \ No newline at end of file diff --git a/Toolbox/SimulationSARTool/SARImage/InitCreateImageXYZDialog.ui b/Toolbox/SimulationSARTool/SARImage/InitCreateImageXYZDialog.ui new file mode 100644 index 0000000..9ca01ed --- /dev/null +++ b/Toolbox/SimulationSARTool/SARImage/InitCreateImageXYZDialog.ui @@ -0,0 +1,250 @@ + + + InitCreateImageXYZDialogClass + + + + 0 + 0 + 600 + 400 + + + + 鍒濆鍖栨垚鍍忓钩闈㈢綉鏍 + + + + + + + 0 + 30 + + + + 鎴愬儚缃戞牸锛圶YZ锛夛細 + + + + + + + + 0 + 30 + + + + 閫夋嫨 + + + + + + + + 0 + 30 + + + + 閫夋嫨 + + + + + + + + 0 + 30 + + + + D:\Programme\vs2022\RasterMergeTest\LAMPCAE_SCANE-all-scane\BPImage\GF3BPImage + + + + + + + + 0 + 30 + + + + 鎴愬儚缃戞牸锛堢粡绾害锛夛細 + + + + + + + + 0 + 30 + + + + 鍥炴尝GPS杞ㄩ亾鑺傜偣锛 + + + + + + + + 0 + 30 + + + + D:\Programme\vs2022\RasterMergeTest\LAMPCAE_SCANE-all-scane\GF3_Simulation.xml + + + + + + + + 0 + 30 + + + + 閫夋嫨 + + + + + + + + 0 + 30 + + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + 0 + 30 + + + + D:\Programme\vs2022\RasterMergeTest\LAMPCAE_SCANE-all-scane\BPImage\GF3BPImage + + + + + + + true + + + + + 0 + 0 + 580 + 236 + + + + + + + 鏂逛綅鍚戝弬鏁 + + + + + + 鏂逛綅鍚戠殑鍍忕礌鏁颁笌鍥炴尝GPS鑴夊啿鏁颁竴鑷 + + + + + + + + + + 璺濈鍚戝弬鏁 + + + + + + 杩戞枩璺 + + + + + + + 3 + + + 1000000000000000000.000000000000000 + + + 0.010000000000000 + + + + + + + 5 + + + 99999999999999991611392.000000000000000 + + + 0.000100000000000 + + + + + + + 璺濈鍚戦棿闅 + + + + + + + 璺濈鍚戝儚绱犳暟 + + + + + + + 999999999 + + + + + + + + + + + + + + + + diff --git a/Toolbox/SimulationSARTool/SimulationSAR/GPUBPTool.cuh b/Toolbox/SimulationSARTool/SimulationSAR/GPUBPTool.cuh index 58bdca9..49682a8 100644 --- a/Toolbox/SimulationSARTool/SimulationSAR/GPUBPTool.cuh +++ b/Toolbox/SimulationSARTool/SimulationSAR/GPUBPTool.cuh @@ -1,3 +1,7 @@ +#ifndef __GPUBPTOOL_CUH___ +#define __GPUBPTOOL_CUH___ + + #include "BaseConstVariable.h" #include "GPUTool.cuh" #include @@ -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 \ No newline at end of file diff --git a/Toolbox/SimulationSARTool/SimulationSAR/GPUTBPImage.cu b/Toolbox/SimulationSARTool/SimulationSAR/GPUTBPImage.cu index 31b021b..2d7061d 100644 --- a/Toolbox/SimulationSARTool/SimulationSAR/GPUTBPImage.cu +++ b/Toolbox/SimulationSARTool/SimulationSAR/GPUTBPImage.cu @@ -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: 璁$畻鐩爣鐐筆 - - 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> > ( - antPx, antPy, antPz, - antDirx, antDiry, antDirz, - imgx, imgy, imgz, - prfcount, freqpoints, meanH, - Rnear, dx, RefRange); - PrintLasterError("TIMEBPCreateImageGrid"); - cudaDeviceSynchronize(); - } diff --git a/Toolbox/SimulationSARTool/SimulationSAR/GPUTBPImage.cuh b/Toolbox/SimulationSARTool/SimulationSAR/GPUTBPImage.cuh index 91314b9..f7d6989 100644 --- a/Toolbox/SimulationSARTool/SimulationSAR/GPUTBPImage.cuh +++ b/Toolbox/SimulationSARTool/SimulationSAR/GPUTBPImage.cuh @@ -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, diff --git a/Toolbox/SimulationSARTool/SimulationSAR/QSimulationBPImage.cpp b/Toolbox/SimulationSARTool/SimulationSAR/QSimulationBPImage.cpp index d70ccfd..918731d 100644 --- a/Toolbox/SimulationSARTool/SimulationSAR/QSimulationBPImage.cpp +++ b/Toolbox/SimulationSARTool/SimulationSAR/QSimulationBPImage.cpp @@ -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"成像结束"); diff --git a/Toolbox/SimulationSARTool/SimulationSAR/TBPImageAlgCls.cpp b/Toolbox/SimulationSARTool/SimulationSAR/TBPImageAlgCls.cpp index 7e2cd86..9b64590 100644 --- a/Toolbox/SimulationSARTool/SimulationSAR/TBPImageAlgCls.cpp +++ b/Toolbox/SimulationSARTool/SimulationSAR/TBPImageAlgCls.cpp @@ -14,171 +14,6 @@ #include -void CreatePixelXYZ(std::shared_ptr 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 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 Pxs((double*)mallocCUDAHost(sizeof(double)*prfcount), FreeCUDAHost); - std::shared_ptr Pys((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); - std::shared_ptr Pzs((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); - std::shared_ptr AntDirectX((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); - std::shared_ptr AntDirectY((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); - std::shared_ptr AntDirectZ((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); - - { - std::shared_ptr 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 d_Pxs((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice); - std::shared_ptr d_Pys((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice); - std::shared_ptr d_Pzs((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice); - std::shared_ptr d_AntDirectX((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice); - std::shared_ptr d_AntDirectY((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice); - std::shared_ptr 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 demx = readDataArr(xyzRaster, 0, startcolidx, prfcount, tempechocol, 1, GDALREADARRCOPYMETHOD::VARIABLEMETHOD); - std::shared_ptr demy = readDataArr(xyzRaster, 0, startcolidx, prfcount, tempechocol, 2, GDALREADARRCOPYMETHOD::VARIABLEMETHOD); - std::shared_ptr demz = readDataArr(xyzRaster, 0, startcolidx, prfcount, tempechocol, 3, GDALREADARRCOPYMETHOD::VARIABLEMETHOD); - - std::shared_ptr h_demx((double*)mallocCUDAHost(sizeof(double) * prfcount*tempechocol), FreeCUDAHost); - std::shared_ptr h_demy((double*)mallocCUDAHost(sizeof(double) * prfcount*tempechocol), FreeCUDAHost); - std::shared_ptr 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 d_demx((double*)mallocCUDADevice(sizeof(double) * prfcount * tempechocol), FreeCUDADevice); - std::shared_ptr d_demy((double*)mallocCUDADevice(sizeof(double) * prfcount * tempechocol), FreeCUDADevice); - std::shared_ptr 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 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 TBPImageAlgCls::getImageL0() { return this->L1ds; } - -ErrorCode TBPImageAlgCls::Process(long num_thread) -{ - - qDebug() << u8"寮濮嬫垚鍍"; - - - qDebug() << u8"鍒涘缓鎴愬儚骞抽潰鐨刋YZ"; - 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 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 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 Pxs((double*)mallocCUDAHost(sizeof(double)*prfcount), FreeCUDAHost); +// std::shared_ptr Pys((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); +// std::shared_ptr Pzs((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); +// std::shared_ptr AntDirectX((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); +// std::shared_ptr AntDirectY((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); +// std::shared_ptr AntDirectZ((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); +// +// { +// std::shared_ptr 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 d_Pxs((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice); +// std::shared_ptr d_Pys((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice); +// std::shared_ptr d_Pzs((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice); +// std::shared_ptr d_AntDirectX((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice); +// std::shared_ptr d_AntDirectY((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice); +// std::shared_ptr 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 demx = readDataArr(xyzRaster, 0, startcolidx, prfcount, tempechocol, 1, GDALREADARRCOPYMETHOD::VARIABLEMETHOD); +// std::shared_ptr demy = readDataArr(xyzRaster, 0, startcolidx, prfcount, tempechocol, 2, GDALREADARRCOPYMETHOD::VARIABLEMETHOD); +// std::shared_ptr demz = readDataArr(xyzRaster, 0, startcolidx, prfcount, tempechocol, 3, GDALREADARRCOPYMETHOD::VARIABLEMETHOD); +// +// std::shared_ptr h_demx((double*)mallocCUDAHost(sizeof(double) * prfcount*tempechocol), FreeCUDAHost); +// std::shared_ptr h_demy((double*)mallocCUDAHost(sizeof(double) * prfcount*tempechocol), FreeCUDAHost); +// std::shared_ptr 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 d_demx((double*)mallocCUDADevice(sizeof(double) * prfcount * tempechocol), FreeCUDADevice); +// std::shared_ptr d_demy((double*)mallocCUDADevice(sizeof(double) * prfcount * tempechocol), FreeCUDADevice); +// std::shared_ptr 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); +// } +// +//} + + diff --git a/Toolbox/SimulationSARTool/SimulationSAR/TBPImageAlgCls.h b/Toolbox/SimulationSARTool/SimulationSAR/TBPImageAlgCls.h index 61b925c..4fe8618 100644 --- a/Toolbox/SimulationSARTool/SimulationSAR/TBPImageAlgCls.h +++ b/Toolbox/SimulationSARTool/SimulationSAR/TBPImageAlgCls.h @@ -50,7 +50,7 @@ public: std::shared_ptr 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 echoL0ds,QString outPixelXYZPath); - - -void TBPImageProcess(QString echofile,QString outImageFolder,QString imagePlanePath,long num_thread); - -// -//void TBPImageGridNet( -// std::shared_ptr antPx, std::shared_ptr antPy, std::shared_ptr antPz, -// std::shared_ptr img_x, std::shared_ptr img_y, std::shared_ptr img_z, -// std::shared_ptr> echoArr, -// std::shared_ptr> img_arr, -// double freq, double dx, double Rnear, double Rfar, double refRange, -// long rowcount, long colcount, -// long prfcount, long freqcount, -// long startPRFId, long startRowID -//); diff --git a/Toolbox/SimulationSARTool/SimulationSARTool.cpp b/Toolbox/SimulationSARTool/SimulationSARTool.cpp index e726c24..8161f52 100644 --- a/Toolbox/SimulationSARTool/SimulationSARTool.cpp +++ b/Toolbox/SimulationSARTool/SimulationSARTool.cpp @@ -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(); -} \ No newline at end of file +} + +InitCreateImageXYZToolButton::InitCreateImageXYZToolButton(QWidget* parent) +{ + this->toolPath = QVector(0); + this->toolPath.push_back(u8"成像工具库"); + this->toolname = QString(u8"1.构建成像粗平面"); +} + +InitCreateImageXYZToolButton::~InitCreateImageXYZToolButton() +{ + +} + +void InitCreateImageXYZToolButton::run() +{ + InitCreateImageXYZDialog* dialog = new InitCreateImageXYZDialog; + dialog->show(); +} + + \ No newline at end of file diff --git a/Toolbox/SimulationSARTool/SimulationSARTool.h b/Toolbox/SimulationSARTool/SimulationSARTool.h index ae6cf44..58459d2 100644 --- a/Toolbox/SimulationSARTool/SimulationSARTool.h +++ b/Toolbox/SimulationSARTool/SimulationSARTool.h @@ -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); diff --git a/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj b/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj index 1f5abbb..5df57ed 100644 --- a/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj +++ b/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj @@ -105,7 +105,7 @@ - ..\..\BaseCommonLibrary;..\..\BaseCommonLibrary\BaseTool;..\..\BaseCommonLibrary\ToolAbstract;..\..\GPUBaseLib\GPUTool;.\SimulationSAR;.;..\..\LAMPSARProcessProgram\ToolBoxManager;..\..\RasterMainWidgetGUI\RasterMainWidget;..\..\RasterProcessToolWidget;..\..\RasterMainWidgetGUI;.\PowerSimulationIncoherent;..\..\ImageshowTool;..\..\ImageshowTool\Imageshow;$(VC_IncludePath);$(WindowsSDK_IncludePath) + ..\..\BaseCommonLibrary;..\..\BaseCommonLibrary\BaseTool;..\..\BaseCommonLibrary\ToolAbstract;..\..\GPUBaseLib\GPUTool;.\SARImage;.\SimulationSAR;.;..\..\LAMPSARProcessProgram\ToolBoxManager;..\..\RasterMainWidgetGUI\RasterMainWidget;..\..\RasterProcessToolWidget;..\..\RasterMainWidgetGUI;.\PowerSimulationIncoherent;..\..\ImageshowTool;..\..\ImageshowTool\Imageshow;$(VC_IncludePath);$(WindowsSDK_IncludePath) $(SolutionDir)$(Platform)\$(Configuration)\Toolbox\ PluginTool_$(ProjectName) true @@ -214,6 +214,8 @@ + + @@ -226,6 +228,7 @@ + @@ -237,6 +240,9 @@ + + + @@ -271,6 +277,7 @@ + diff --git a/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj.filters b/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj.filters index 6ca9c53..1399a37 100644 --- a/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj.filters +++ b/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj.filters @@ -27,6 +27,9 @@ {9b848585-2348-400d-b12a-dd79a2a71007} + + {3380934c-6b95-45eb-8d70-d8b58e0e9de3} + @@ -71,6 +74,12 @@ SimulationSAR + + SARImage + + + SARImage + @@ -124,6 +133,12 @@ PowerSimulationIncoherent + + SARImage + + + SARImage + @@ -153,6 +168,9 @@ PowerSimulationIncoherent + + SARImage + @@ -185,6 +203,9 @@ PowerSimulationIncoherent + + SARImage + @@ -220,5 +241,8 @@ SimulationSAR + + SARImage + \ No newline at end of file From 033db9e56995bd049eb7cf8313a9d6f2152172b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=A2=9E=E8=BE=89?= <3045316072@qq.com> Date: Sun, 6 Apr 2025 14:23:44 +0800 Subject: [PATCH 05/44] =?UTF-8?q?=E5=90=8C=E6=AD=A5=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SARImage/InitCreateImageXYZDialog.cpp | 31 ++++++++++++++++--- .../SARImage/InitCreateImageXYZDialog.h | 12 +++---- 2 files changed, 32 insertions(+), 11 deletions(-) diff --git a/Toolbox/SimulationSARTool/SARImage/InitCreateImageXYZDialog.cpp b/Toolbox/SimulationSARTool/SARImage/InitCreateImageXYZDialog.cpp index 68228d8..45b5fce 100644 --- a/Toolbox/SimulationSARTool/SARImage/InitCreateImageXYZDialog.cpp +++ b/Toolbox/SimulationSARTool/SARImage/InitCreateImageXYZDialog.cpp @@ -8,12 +8,17 @@ InitCreateImageXYZDialog::InitCreateImageXYZDialog(QWidget *parent) : QDialog(parent), ui(new Ui::InitCreateImageXYZDialogClass) { ui->setupUi(this); + connect(ui->pushButtonEchoGPSDataSelect, SIGNAL(clicked()), this, SLOT(onpushButtonEchoGPSDataSelect_clicked())); + connect(ui->pushButtonImageXYZSelect, SIGNAL(clicked()), this, SLOT(onpushButtonImageXYZSelect_clicked())); + connect(ui->pushButtonImageLLSelect, SIGNAL(clicked()), this, SLOT(onpushButtonImageLLSelect_clicked())); + connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(onbuttonBox_accepted())); + connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(onbuttonBox_rejected())); } InitCreateImageXYZDialog::~InitCreateImageXYZDialog() {} -void InitCreateImageXYZDialog::on_pushButtonImageLLSelect_clicked() +void InitCreateImageXYZDialog::onpushButtonImageLLSelect_clicked() { QString fileNamePath = QFileDialog::getSaveFileName( this, // 父窗口 @@ -21,10 +26,18 @@ void InitCreateImageXYZDialog::on_pushButtonImageLLSelect_clicked() QString(), // 默认路径 tr(u8"ENVI Bin(*.bin);;ENVI Data(*.dat);;ENVI Data(*.data);;tiff影像(*.tif);;tiff影像(*.tiff)") // 文件过滤器 ); + // 如果用户选择了文件 + if (!fileNamePath.isEmpty()) { + QString message = "选择的文件有:\n"; + this->ui->lineEditImageLLPath->setText(fileNamePath); + } + else { + QMessageBox::information(this, tr(u8"没有选择文件"), tr(u8"没有选择任何文件。")); + } } -void InitCreateImageXYZDialog::on_pushButtonImageXYZSelect_clicked() +void InitCreateImageXYZDialog::onpushButtonImageXYZSelect_clicked() { QString fileNamePath = QFileDialog::getSaveFileName( this, // 父窗口 @@ -32,9 +45,17 @@ void InitCreateImageXYZDialog::on_pushButtonImageXYZSelect_clicked() QString(), // 默认路径 tr(u8"ENVI Bin(*.bin);;ENVI Data(*.dat);;ENVI Data(*.data);;tiff影像(*.tif);;tiff影像(*.tiff)") // 文件过滤器 ); + // 如果用户选择了文件 + if (!fileNamePath.isEmpty()) { + QString message = "选择的文件有:\n"; + this->ui->lineEditImageXYZPath->setText(fileNamePath); + } + else { + QMessageBox::information(this, tr(u8"没有选择文件"), tr(u8"没有选择任何文件。")); + } } -void InitCreateImageXYZDialog::on_pushButtonEchoGPSDataSelect_clicked() +void InitCreateImageXYZDialog::onpushButtonEchoGPSDataSelect_clicked() { QString fileNames = QFileDialog::getOpenFileName( @@ -53,7 +74,7 @@ void InitCreateImageXYZDialog::on_pushButtonEchoGPSDataSelect_clicked() } } -void InitCreateImageXYZDialog::on_buttonBox_accepted() +void InitCreateImageXYZDialog::onbuttonBox_accepted() { double NearRange = this->ui->doubleSpinBoxNearRange->value(); double RangeResolution = this->ui->doubleSpinBoxRangeResolution->value(); @@ -71,7 +92,7 @@ void InitCreateImageXYZDialog::on_buttonBox_accepted() } -void InitCreateImageXYZDialog::on_buttonBox_rejected() +void InitCreateImageXYZDialog::onbuttonBox_rejected() { this->close(); } diff --git a/Toolbox/SimulationSARTool/SARImage/InitCreateImageXYZDialog.h b/Toolbox/SimulationSARTool/SARImage/InitCreateImageXYZDialog.h index a334c35..d4fb229 100644 --- a/Toolbox/SimulationSARTool/SARImage/InitCreateImageXYZDialog.h +++ b/Toolbox/SimulationSARTool/SARImage/InitCreateImageXYZDialog.h @@ -20,12 +20,12 @@ public: ~InitCreateImageXYZDialog(); -public : - void on_pushButtonImageLLSelect_clicked(); - void on_pushButtonImageXYZSelect_clicked(); - void on_pushButtonEchoGPSDataSelect_clicked(); - void on_buttonBox_accepted(); - void on_buttonBox_rejected(); +public slots : + void onpushButtonImageLLSelect_clicked(); + void onpushButtonImageXYZSelect_clicked(); + void onpushButtonEchoGPSDataSelect_clicked(); + void onbuttonBox_accepted(); + void onbuttonBox_rejected(); private: From 5f7b8ae9ea1f3813e5587feec100be0ad513fd74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=A2=9E=E8=BE=89?= <3045316072@qq.com> Date: Sun, 6 Apr 2025 14:29:35 +0800 Subject: [PATCH 06/44] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=87=87=E6=A0=B7?= =?UTF-8?q?=E5=B7=A5=E5=85=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BaseTool/BaseConstVariable.h | 3 + BaseCommonLibrary/BaseTool/FileOperator.h | 10 +- .../BaseTool/ImageOperatorBase.h | 8 +- .../BaseTool/gdalImageOperator.cpp | 4 +- .../SARImage/ImageNetOperator.cpp | 118 ++++++++++++++ .../SARImage/ImageNetOperator.h | 4 +- .../SARImage/ImagePlaneAtiInterpDialog.cpp | 112 +++++++++++++ .../SARImage/ImagePlaneAtiInterpDialog.h | 35 ++++ .../SARImage/ImagePlaneAtiInterpDialog.ui | 152 ++++++++++++++++++ .../SARImage/InitCreateImageXYZDialog.ui | 4 +- .../SimulationSARTool/SimulationSARTool.cpp | 19 ++- Toolbox/SimulationSARTool/SimulationSARTool.h | 10 ++ .../SimulationSARTool.vcxproj | 3 + .../SimulationSARTool.vcxproj.filters | 9 ++ 14 files changed, 475 insertions(+), 16 deletions(-) create mode 100644 Toolbox/SimulationSARTool/SARImage/ImagePlaneAtiInterpDialog.cpp create mode 100644 Toolbox/SimulationSARTool/SARImage/ImagePlaneAtiInterpDialog.h create mode 100644 Toolbox/SimulationSARTool/SARImage/ImagePlaneAtiInterpDialog.ui diff --git a/BaseCommonLibrary/BaseTool/BaseConstVariable.h b/BaseCommonLibrary/BaseTool/BaseConstVariable.h index 9707cb0..9c16a9d 100644 --- a/BaseCommonLibrary/BaseTool/BaseConstVariable.h +++ b/BaseCommonLibrary/BaseTool/BaseConstVariable.h @@ -15,6 +15,9 @@ +/** 瀹氫箟甯歌鏂囦欢鏍煎紡*********/ +#define ENVI_FILE_FORMAT_FILTER u8"ALL File(*.*);;ENVI Bin(*.bin);;ENVI Data(*.dat);;ENVI Data(*.data);;tiff褰卞儚(*.tif);;tiff褰卞儚(*.tiff)" +#define XML_FILE_FORMAT_FILTER u8"ALL File(*.*);;XML File(*.xml);;tiff褰卞儚(*.tiff)" // diff --git a/BaseCommonLibrary/BaseTool/FileOperator.h b/BaseCommonLibrary/BaseTool/FileOperator.h index 72d542a..b016ede 100644 --- a/BaseCommonLibrary/BaseTool/FileOperator.h +++ b/BaseCommonLibrary/BaseTool/FileOperator.h @@ -16,7 +16,7 @@ #include #include #include - + bool BASECONSTVARIABLEAPI isDirectory(const QString& path); bool BASECONSTVARIABLEAPI isExists(const QString& path); @@ -29,7 +29,7 @@ unsigned long BASECONSTVARIABLEAPI convertToULong(const QString& input); /// /// /// -std::vector BASECONSTVARIABLEAPI getFilelist(const QString& folderpath, const QString& FilenameExtension = ".*",int (*logfun)(QString logtext,int value)=nullptr); +std::vector BASECONSTVARIABLEAPI getFilelist(const QString& folderpath, const QString& FilenameExtension = ".*", int (*logfun)(QString logtext, int value) = nullptr); QString BASECONSTVARIABLEAPI getParantFolderNameFromPath(const QString& path); @@ -41,11 +41,11 @@ QString BASECONSTVARIABLEAPI getFileExtension(QString path); int BASECONSTVARIABLEAPI write_binfile(char* filepath, char* data, size_t data_len); -char* read_textfile(char* text_path, int* length); +char* read_textfile(char* text_path, int* length); -bool BASECONSTVARIABLEAPI exists_test(const QString& name); +bool BASECONSTVARIABLEAPI exists_test(const QString& name); -size_t BASECONSTVARIABLEAPI fsize(FILE* fp); +size_t BASECONSTVARIABLEAPI fsize(FILE* fp); QString BASECONSTVARIABLEAPI getParantFromPath(const QString& path); void BASECONSTVARIABLEAPI copyFile(const QString& sourcePath, const QString& destinationPath); diff --git a/BaseCommonLibrary/BaseTool/ImageOperatorBase.h b/BaseCommonLibrary/BaseTool/ImageOperatorBase.h index 060df9a..8b0b7ba 100644 --- a/BaseCommonLibrary/BaseTool/ImageOperatorBase.h +++ b/BaseCommonLibrary/BaseTool/ImageOperatorBase.h @@ -135,10 +135,10 @@ GDALDataType BASECONSTVARIABLEAPI getGDALDataType(QString fileptah); struct RasterExtend { - double min_x; //绾害 - double min_y;//缁忓害 - double max_x;//绾害 - double max_y;//缁忓害 + double min_x; + double min_y; + double max_x; + double max_y; }; diff --git a/BaseCommonLibrary/BaseTool/gdalImageOperator.cpp b/BaseCommonLibrary/BaseTool/gdalImageOperator.cpp index bce0668..d0c8c77 100644 --- a/BaseCommonLibrary/BaseTool/gdalImageOperator.cpp +++ b/BaseCommonLibrary/BaseTool/gdalImageOperator.cpp @@ -1228,8 +1228,8 @@ RasterExtend gdalImage::getExtend() double x1 = this->gt(0, 0); double y1 = this->gt(1, 0); - double x2 = this->gt(0, 0) + (this->width - 1) * gt(0, 1) + (0) * gt(0, 2); - double y2 = this->gt(1, 0) + (this->width - 1) * gt(1, 1) + (0) * gt(1, 2); + double x2 = this->gt(0, 0) + (this->width - 1) * gt(0, 1) + (0) * gt(0, 2); // 经 + double y2 = this->gt(1, 0) + (this->width - 1) * gt(1, 1) + (0) * gt(1, 2); // 纬 double x3 = this->gt(0, 0) + (0) * gt(0, 1) + (this->height - 1) * gt(0, 2); double y3 = this->gt(1, 0) + (0) * gt(1, 1) + (this->height - 1) * gt(1, 2); diff --git a/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.cpp b/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.cpp index 08011a9..065151d 100644 --- a/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.cpp +++ b/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.cpp @@ -5,6 +5,7 @@ #include "ImageOperatorBase.h" #include "GPUBaseTool.h" #include "GPUBPImageNet.cuh" +#include "BaseTool.h" void InitCreateImageXYZProcess(QString& outImageLLPath, QString& outImageXYZPath, QString& InEchoGPSDataPath, @@ -171,3 +172,120 @@ void InitCreateImageXYZProcess(QString& outImageLLPath, QString& outImageXYZPath qDebug() << u8"6.保存成像网格结果"; qDebug() << "---------------------------------------------------------------------------------"; } + +bool OverlapCheck(QString& ImageLLPath, QString& ImageDEMPath) +{ + // 检查DEM是否是WGS84坐标系 + long demEPSG = GetEPSGFromRasterFile(ImageDEMPath); + if (demEPSG != 4326) { + qDebug() << u8"DEM坐标系不是WGS84坐标系"; + return false; + } + + gdalImage demimg(ImageDEMPath); + gdalImage imgll(ImageLLPath); + + long imgheight = imgll.height; + long imgwidth = imgll.width; + Eigen::MatrixXd imglonArr = imgll.getData(0, 0, imgheight, imgwidth, 1); + Eigen::MatrixXd imglatArr = imgll.getData(0, 0, imgheight, imgwidth, 2); + + for (long i = 0; i < imgheight; i++) + { + for (long j = 0; j < imgwidth; j++) + { + double lon = imglonArr(i, j); // X + double lat = imglatArr(i, j); // Y + Landpoint point = imgll.getRow_Col(lon, lat); + imglonArr(i, j) = point.lon; + imglatArr(i, j) = point.lat; + } + } + + double minX = imglonArr.minCoeff(); + double maxX = imglonArr.maxCoeff(); + double minY = imglatArr.minCoeff(); + double maxY = imglatArr.maxCoeff(); + + if (minX<1 || maxX>demimg.width - 1 || minY<1 || maxY>demimg.height - 1) { + return false; + } + else { + return true; + } + + + +} + +void InterploateAtiByRefDEM(QString& ImageLLPath, QString& ImageDEMPath, QString& outImageLLAPath) +{ + gdalImage demimg(ImageDEMPath); + gdalImage imgll(ImageLLPath); + gdalImage outimgll = CreategdalImageDouble(outImageLLAPath, imgll.height, imgll.width, 3, true, true); + + long imgheight = imgll.height; + long imgwidth = imgll.width; + + 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); + + outimgll.saveImage(imglonArr, 0, 0, 1); + outimgll.saveImage(imglatArr, 0, 0, 2); + + for (long i = 0; i < imgheight; i++) { + for (long j = 0; j < imgwidth; j++) { + double lon = imglonArr(i, j); // X + double lat = imglatArr(i, j); // Y + Landpoint point = imgll.getRow_Col(lon, lat); + imglonArr(i, j) = point.lon; + imglatArr(i, j) = point.lat; + } + } + + for (long i = 0; i < imgheight; i++) { + for (long j = 0; j < imgwidth; j++) { + double imX = imglonArr(i, j); + double imY = imglatArr(i, j); + + Landpoint p0, p11, p21, p12, p22; + p0.lon = imX; + p0.lat = imY; + + p11.lon = floor(p0.lon); + p11.lat = floor(p0.lat); + + p12.lon = ceil(p0.lon); + p12.lat = floor(p0.lat); + + p21.lon = floor(p0.lon); + p21.lat = ceil(p0.lat); + + p22.lon = ceil(p0.lon); + p22.lat = ceil(p0.lat); + + p0.lon = p0.lon - p11.lon; + p0.lat = p0.lat - p11.lat; + + p12.lon = p12.lon - p11.lon; + p12.lat = p12.lat - p11.lat; + + p21.lon = p21.lon - p11.lon; + p21.lat = p21.lat - p11.lat; + + p22.lon = p22.lon - p11.lon; + p22.lat = p22.lat - p11.lat; + + p11.lon = p11.lon - p11.lon; + p11.lat = p11.lat - p11.lat; + + Bilinear_interpolation(p0, p11, p21, p12, p22); + imgatiArr(i, j) = p0.ati; + + } + } + outimgll.saveImage(imgatiArr, 0, 0, 3); + + qDebug() << u8"插值完成"; +} diff --git a/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.h b/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.h index 3410a8f..bef2c34 100644 --- a/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.h +++ b/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.h @@ -7,9 +7,9 @@ void InitCreateImageXYZProcess(QString& outImageLLPath, QString& outImageXYZPath, QString& InEchoGPSDataPath, double& NearRange, double& RangeResolution, int64_t& RangeNum); +bool OverlapCheck(QString& ImageLLPath, QString& ImageDEMPath); - - +void InterploateAtiByRefDEM(QString& ImageLLPath, QString& ImageDEMPath, QString& outImageLLAPath); diff --git a/Toolbox/SimulationSARTool/SARImage/ImagePlaneAtiInterpDialog.cpp b/Toolbox/SimulationSARTool/SARImage/ImagePlaneAtiInterpDialog.cpp new file mode 100644 index 0000000..775312e --- /dev/null +++ b/Toolbox/SimulationSARTool/SARImage/ImagePlaneAtiInterpDialog.cpp @@ -0,0 +1,112 @@ +#include "ImagePlaneAtiInterpDialog.h" +#include "ui_ImagePlaneAtiInterpDialog.h" +#include +#include +#include "BaseConstVariable.h" +#include "ImageNetOperator.h" + +ImagePlaneAtiInterpDialog::ImagePlaneAtiInterpDialog(QWidget *parent) + : QDialog(parent) + , ui(new Ui::ImagePlaneAtiInterpDialogClass) +{ + ui->setupUi(this); + + connect(ui->pushButtonImageLLASelect, SIGNAL(clicked()), this, SLOT(onpushButtonImageLLASelect_clicked())); + connect(ui->pushButtonImageNet0Select, SIGNAL(clicked()), this, SLOT(onpushButtonImageNet0Select_clicked())); + connect(ui->pushButtonRefRangeDEMSelect, SIGNAL(clicked()), this, SLOT(onpushButtonRefRangeDEMSelect_clicked())); + connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(onbuttonBoxAccepted())); + connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(onbuttonBoxRejected())); + + +} + +ImagePlaneAtiInterpDialog::~ImagePlaneAtiInterpDialog() +{} + +void ImagePlaneAtiInterpDialog::onpushButtonImageNet0Select_clicked() +{ + QString fileNames = QFileDialog::getOpenFileName( + this, + tr(u8"选择成像粗平面文件"), + QString(), + tr(ENVI_FILE_FORMAT_FILTER) + ); + + if (!fileNames.isEmpty()) { + QString message = "选中文件\n"; + this->ui->lineEditImageNet0Path->setText(fileNames); + } + else { + QMessageBox::information(this, tr(u8"提示"), tr(u8"没有选中文件")); + } +} + +void ImagePlaneAtiInterpDialog::onpushButtonRefRangeDEMSelect_clicked() +{ + QString fileNames = QFileDialog::getOpenFileName( + this, // ?????? + tr(u8"选择参考DEM"), // ???? + QString(), // ???·?? + tr(ENVI_FILE_FORMAT_FILTER) // ????????? + ); + // ?????????????? + if (!fileNames.isEmpty()) { + QString message = "选中文件\n"; + this->ui->lineEditRefRangeDEMPath->setText(fileNames); + } + else { + QMessageBox::information(this, tr(u8"提示"), tr(u8"没有选中文件")); + } +} + +void ImagePlaneAtiInterpDialog::onpushButtonImageLLASelect_clicked() +{ + QString fileNames = QFileDialog::getOpenFileName( + this, // ?????? + tr(u8"提示"), // ???? + QString(), // ???·?? + tr(ENVI_FILE_FORMAT_FILTER) // ????????? + ); + // ?????????????? + if (!fileNames.isEmpty()) { + QString message = "????????У?\n"; + this->ui->lineEditImageLLAPath->setText(fileNames); + } + else { + QMessageBox::information(this, tr(u8"提示"), tr(u8"没有选中文件")); + } +} + +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()) { + QMessageBox::warning(this, tr(u8"提示"), tr(u8"没有选中文件")); + return; + } + else { + + } + + if (OverlapCheck(imageNet0Path, refRangeDEMPath)) { // ????DEM??? + InterploateAtiByRefDEM(imageNet0Path, refRangeDEMPath, imageLLAPath); + + QMessageBox::information(nullptr, u8"提示", u8"completed!!"); + return; + + } + else { + QMessageBox::warning(nullptr,u8"警告",u8"DEM影像小于成像粗平面采样要求"); + return; + } +} + +void ImagePlaneAtiInterpDialog::onbuttonBoxRejected() +{ + this->close(); +} + + \ No newline at end of file diff --git a/Toolbox/SimulationSARTool/SARImage/ImagePlaneAtiInterpDialog.h b/Toolbox/SimulationSARTool/SARImage/ImagePlaneAtiInterpDialog.h new file mode 100644 index 0000000..1c59bd0 --- /dev/null +++ b/Toolbox/SimulationSARTool/SARImage/ImagePlaneAtiInterpDialog.h @@ -0,0 +1,35 @@ +#pragma once + +#ifndef __ImagePlaneAtiInterpDialog__HH__ +#define __ImagePlaneAtiInterpDialog__HH__ + +#include + +namespace Ui { + class ImagePlaneAtiInterpDialogClass; +} + + +class ImagePlaneAtiInterpDialog : public QDialog +{ + Q_OBJECT + +public: + ImagePlaneAtiInterpDialog(QWidget *parent = nullptr); + ~ImagePlaneAtiInterpDialog(); + +public /*slots*/: + + void onpushButtonImageNet0Select_clicked(); + void onpushButtonRefRangeDEMSelect_clicked(); + void onpushButtonImageLLASelect_clicked(); + void onbuttonBoxAccepted(); + void onbuttonBoxRejected(); + + +private: + Ui::ImagePlaneAtiInterpDialogClass* ui; +}; + + +#endif \ No newline at end of file diff --git a/Toolbox/SimulationSARTool/SARImage/ImagePlaneAtiInterpDialog.ui b/Toolbox/SimulationSARTool/SARImage/ImagePlaneAtiInterpDialog.ui new file mode 100644 index 0000000..00cbfeb --- /dev/null +++ b/Toolbox/SimulationSARTool/SARImage/ImagePlaneAtiInterpDialog.ui @@ -0,0 +1,152 @@ + + + ImagePlaneAtiInterpDialogClass + + + + 0 + 0 + 661 + 266 + + + + 鏍规嵁缁忕含搴︽彃鍊奸珮绋嬫暟鎹 + + + + + + + 0 + 30 + + + + 鎴愬儚缃戞牸锛堢粡绾害锛夛細 + + + + + + + + 0 + 30 + + + + + + + + + + + + 0 + 30 + + + + 閫夋嫨 + + + + + + + + 0 + 30 + + + + 鍙傝僁EM锛 + + + + + + + + 0 + 30 + + + + + + + + + + + + 0 + 30 + + + + 閫夋嫨 + + + + + + + + 0 + 30 + + + + 鎴愬儚绮楃綉鏍硷紙楂樼▼锛夛細 + + + + + + + + 0 + 30 + + + + + + + + + + + + 0 + 30 + + + + 閫夋嫨 + + + + + + + + 0 + 30 + + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + diff --git a/Toolbox/SimulationSARTool/SARImage/InitCreateImageXYZDialog.ui b/Toolbox/SimulationSARTool/SARImage/InitCreateImageXYZDialog.ui index 9ca01ed..38293bd 100644 --- a/Toolbox/SimulationSARTool/SARImage/InitCreateImageXYZDialog.ui +++ b/Toolbox/SimulationSARTool/SARImage/InitCreateImageXYZDialog.ui @@ -7,7 +7,7 @@ 0 0 600 - 400 + 403 @@ -155,7 +155,7 @@ 0 0 580 - 236 + 239 diff --git a/Toolbox/SimulationSARTool/SimulationSARTool.cpp b/Toolbox/SimulationSARTool/SimulationSARTool.cpp index 8161f52..bee3038 100644 --- a/Toolbox/SimulationSARTool/SimulationSARTool.cpp +++ b/Toolbox/SimulationSARTool/SimulationSARTool.cpp @@ -8,6 +8,8 @@ #include "QtSimulationGeoSARSigma0Dialog.h" #include "QtLinearToIntenisityDialog.h" #include "InitCreateImageXYZDialog.h" +#include "ImagePlaneAtiInterpDialog.h" + SARSimlulationRFPCToolButton::SARSimlulationRFPCToolButton(QWidget* parent) { @@ -77,6 +79,7 @@ void RegisterPreToolBox(LAMPMainWidget::RasterMainWidget* mainwindows, ToolBoxWi emit toolbox->addBoxToolItemSIGNAL(new QtSimulationGeoSARSigma0ToolButton(toolbox)); emit toolbox->addBoxToolItemSIGNAL(new QtLinearToIntenisityToolButton(toolbox)); emit toolbox->addBoxToolItemSIGNAL(new InitCreateImageXYZToolButton(toolbox)); + emit toolbox->addBoxToolItemSIGNAL(new ImagePlaneAtiInterpToolButton(toolbox)); } @@ -163,4 +166,18 @@ void InitCreateImageXYZToolButton::run() dialog->show(); } - \ No newline at end of file +ImagePlaneAtiInterpToolButton::ImagePlaneAtiInterpToolButton(QWidget* parent) +{ + this->toolPath = QVector(0); + this->toolPath.push_back(u8"成像工具库"); + this->toolname = QString(u8"2.粗平面映射DEM"); +} +ImagePlaneAtiInterpToolButton::~ImagePlaneAtiInterpToolButton() +{ +} + +void ImagePlaneAtiInterpToolButton::run() +{ + ImagePlaneAtiInterpDialog* dialog = new ImagePlaneAtiInterpDialog; + dialog->show(); +} diff --git a/Toolbox/SimulationSARTool/SimulationSARTool.h b/Toolbox/SimulationSARTool/SimulationSARTool.h index 58459d2..1d356f2 100644 --- a/Toolbox/SimulationSARTool/SimulationSARTool.h +++ b/Toolbox/SimulationSARTool/SimulationSARTool.h @@ -109,6 +109,16 @@ public : }; +class SIMULATIONSARTOOL_EXPORT ImagePlaneAtiInterpToolButton : public QToolAbstract { + Q_OBJECT +public: + ImagePlaneAtiInterpToolButton(QWidget* parent = nullptr); + ~ImagePlaneAtiInterpToolButton(); +public: + virtual void run() override; + +}; + extern "C" SIMULATIONSARTOOL_EXPORT void RegisterPreToolBox(LAMPMainWidget::RasterMainWidget* mainwindows, ToolBoxWidget* toolbox); diff --git a/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj b/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj index 5df57ed..2cf6ee0 100644 --- a/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj +++ b/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj @@ -215,6 +215,7 @@ + @@ -243,6 +244,7 @@ + @@ -277,6 +279,7 @@ + diff --git a/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj.filters b/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj.filters index 1399a37..6c8fd72 100644 --- a/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj.filters +++ b/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj.filters @@ -80,6 +80,9 @@ SARImage + + SARImage + @@ -139,6 +142,9 @@ SARImage + + SARImage + @@ -171,6 +177,9 @@ SARImage + + SARImage + From c43df32af50117dd3cd2b7c81ff8af80c1dfdd21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=A2=9E=E8=BE=89?= <3045316072@qq.com> Date: Sun, 6 Apr 2025 15:20:09 +0800 Subject: [PATCH 07/44] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=B7=A5=E7=A8=8B?= =?UTF-8?q?=E7=BC=96=E8=AF=91=E9=85=8D=E7=BD=AEbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Toolbox/SimulationSARTool/SimulationSARTool.vcxproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj b/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj index 2cf6ee0..1562e03 100644 --- a/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj +++ b/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj @@ -244,7 +244,7 @@ - + From da92aff9dc7c8355dd2465b2def80b3f5af28fa9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=A2=9E=E8=BE=89?= <3045316072@qq.com> Date: Sun, 6 Apr 2025 16:36:33 +0800 Subject: [PATCH 08/44] =?UTF-8?q?=E8=B0=83=E6=95=B4DEM=E6=8F=92=E5=80=BC?= =?UTF-8?q?=E7=BB=93=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Toolbox/SimulationSARTool/SARImage/ImageNetOperator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.cpp b/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.cpp index 065151d..805d0a0 100644 --- a/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.cpp +++ b/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.cpp @@ -222,7 +222,7 @@ void InterploateAtiByRefDEM(QString& ImageLLPath, QString& ImageDEMPath, QString { gdalImage demimg(ImageDEMPath); gdalImage imgll(ImageLLPath); - gdalImage outimgll = CreategdalImageDouble(outImageLLAPath, imgll.height, imgll.width, 3, true, true); + gdalImage outimgll = CreategdalImageDouble(outImageLLAPath, imgll.height, imgll.width, 4, true, true); // 经度、纬度、高程、斜距 long imgheight = imgll.height; long imgwidth = imgll.width; From a4f195c88315179bceedbd2fe67164e7c49440a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=A2=9E=E8=BE=89?= <3045316072@qq.com> Date: Sun, 6 Apr 2025 16:48:37 +0800 Subject: [PATCH 09/44] =?UTF-8?q?=E5=9C=A8=E9=AB=98=E7=A8=8B=E6=8F=92?= =?UTF-8?q?=E5=80=BC=E4=B9=8B=E5=90=8E=EF=BC=8C=E5=A2=9E=E5=8A=A0=E4=BA=86?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=E6=96=9C=E8=B7=9D=E8=AE=A1=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SARImage/ImageNetOperator.cpp | 84 +++++- .../SARImage/ImageNetOperator.h | 5 +- .../SARImage/ImagePlaneAtiInterpDialog.cpp | 32 ++- .../SARImage/ImagePlaneAtiInterpDialog.h | 3 +- .../SARImage/ImagePlaneAtiInterpDialog.ui | 248 ++++++++++-------- 5 files changed, 259 insertions(+), 113 deletions(-) diff --git a/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.cpp b/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.cpp index 805d0a0..9f264cc 100644 --- a/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.cpp +++ b/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.cpp @@ -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 Pxs((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); + std::shared_ptr Pys((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); + std::shared_ptr Pzs((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); + std::shared_ptr AntDirectX((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); + std::shared_ptr AntDirectY((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); + std::shared_ptr AntDirectZ((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); + + { + long colnum = 19; + std::shared_ptr antpos = readDataArr(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"插值完成"; } diff --git a/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.h b/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.h index bef2c34..89b49e3 100644 --- a/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.h +++ b/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.h @@ -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); diff --git a/Toolbox/SimulationSARTool/SARImage/ImagePlaneAtiInterpDialog.cpp b/Toolbox/SimulationSARTool/SARImage/ImagePlaneAtiInterpDialog.cpp index 775312e..ead5077 100644 --- a/Toolbox/SimulationSARTool/SARImage/ImagePlaneAtiInterpDialog.cpp +++ b/Toolbox/SimulationSARTool/SARImage/ImagePlaneAtiInterpDialog.cpp @@ -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; diff --git a/Toolbox/SimulationSARTool/SARImage/ImagePlaneAtiInterpDialog.h b/Toolbox/SimulationSARTool/SARImage/ImagePlaneAtiInterpDialog.h index 1c59bd0..5b37329 100644 --- a/Toolbox/SimulationSARTool/SARImage/ImagePlaneAtiInterpDialog.h +++ b/Toolbox/SimulationSARTool/SARImage/ImagePlaneAtiInterpDialog.h @@ -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(); diff --git a/Toolbox/SimulationSARTool/SARImage/ImagePlaneAtiInterpDialog.ui b/Toolbox/SimulationSARTool/SARImage/ImagePlaneAtiInterpDialog.ui index 00cbfeb..7c6e718 100644 --- a/Toolbox/SimulationSARTool/SARImage/ImagePlaneAtiInterpDialog.ui +++ b/Toolbox/SimulationSARTool/SARImage/ImagePlaneAtiInterpDialog.ui @@ -14,111 +14,7 @@ 鏍规嵁缁忕含搴︽彃鍊奸珮绋嬫暟鎹 - - - - - 0 - 30 - - - - 鎴愬儚缃戞牸锛堢粡绾害锛夛細 - - - - - - - - 0 - 30 - - - - - - - - - - - - 0 - 30 - - - - 閫夋嫨 - - - - - - - - 0 - 30 - - - - 鍙傝僁EM锛 - - - - - - - - 0 - 30 - - - - - - - - - - - - 0 - 30 - - - - 閫夋嫨 - - - - - - - - 0 - 30 - - - - 鎴愬儚绮楃綉鏍硷紙楂樼▼锛夛細 - - - - - - - - 0 - 30 - - - - - - - - + @@ -131,7 +27,46 @@ - + + + + + 0 + 30 + + + + 鍙傝僁EM锛 + + + + + + + + 0 + 30 + + + + + + + + + + + + 0 + 30 + + + + + + + + @@ -144,6 +79,107 @@ + + + + + 0 + 30 + + + + 鎴愬儚缃戞牸锛堢粡绾害锛夛細 + + + + + + + + 0 + 30 + + + + 閫夋嫨 + + + + + + + + 0 + 30 + + + + 閫夋嫨 + + + + + + + + 0 + 30 + + + + 鎴愬儚绮楃綉鏍硷紙楂樼▼锛夛細 + + + + + + + + 0 + 30 + + + + + + + + + + + + 0 + 30 + + + + 鍥炴尝GPS鐐 + + + + + + + + 0 + 30 + + + + + + + + + 0 + 30 + + + + 閫夋嫨 + + + From a8c39794ce52f945538c6e941d186cd1855e40a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=A2=9E=E8=BE=89?= <3045316072@qq.com> Date: Sun, 6 Apr 2025 16:52:33 +0800 Subject: [PATCH 10/44] =?UTF-8?q?=E8=A1=A5=E5=85=85=E4=BA=86=E5=9B=9E?= =?UTF-8?q?=E6=B3=A2=E6=96=87=E4=BB=B6=E9=80=89=E6=8B=A9=E6=93=8D=E5=87=BD?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SimulationSARTool/SARImage/ImagePlaneAtiInterpDialog.cpp | 1 + Toolbox/SimulationSARTool/SARImage/ImagePlaneAtiInterpDialog.ui | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Toolbox/SimulationSARTool/SARImage/ImagePlaneAtiInterpDialog.cpp b/Toolbox/SimulationSARTool/SARImage/ImagePlaneAtiInterpDialog.cpp index ead5077..6c241fa 100644 --- a/Toolbox/SimulationSARTool/SARImage/ImagePlaneAtiInterpDialog.cpp +++ b/Toolbox/SimulationSARTool/SARImage/ImagePlaneAtiInterpDialog.cpp @@ -14,6 +14,7 @@ ImagePlaneAtiInterpDialog::ImagePlaneAtiInterpDialog(QWidget *parent) connect(ui->pushButtonImageLLASelect, SIGNAL(clicked()), this, SLOT(onpushButtonImageLLASelect_clicked())); connect(ui->pushButtonImageNet0Select, SIGNAL(clicked()), this, SLOT(onpushButtonImageNet0Select_clicked())); connect(ui->pushButtonRefRangeDEMSelect, SIGNAL(clicked()), this, SLOT(onpushButtonRefRangeDEMSelect_clicked())); + connect(ui->pushButtonEchoGPSPointDataSelect, SIGNAL(clicked()), this, SLOT(onpushButtonEchoGPSPointSelect_clicked())); connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(onbuttonBoxAccepted())); connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(onbuttonBoxRejected())); diff --git a/Toolbox/SimulationSARTool/SARImage/ImagePlaneAtiInterpDialog.ui b/Toolbox/SimulationSARTool/SARImage/ImagePlaneAtiInterpDialog.ui index 7c6e718..fa3a5f2 100644 --- a/Toolbox/SimulationSARTool/SARImage/ImagePlaneAtiInterpDialog.ui +++ b/Toolbox/SimulationSARTool/SARImage/ImagePlaneAtiInterpDialog.ui @@ -168,7 +168,7 @@ - + 0 From eca5bc45757fdc20b36f0dbc12526599191257c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=A2=9E=E8=BE=89?= <3045316072@qq.com> Date: Mon, 7 Apr 2025 01:27:57 +0800 Subject: [PATCH 11/44] =?UTF-8?q?=E6=8F=92=E5=80=BC=E7=BB=93=E6=9E=9C?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B0=83=E8=8A=82=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SARImage/ImageNetOperator.cpp | 79 +++++++++++++------ .../SARImage/ImagePlaneAtiInterpDialog.cpp | 4 +- 2 files changed, 59 insertions(+), 24 deletions(-) diff --git a/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.cpp b/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.cpp index 9f264cc..8aa33c1 100644 --- a/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.cpp +++ b/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.cpp @@ -176,11 +176,11 @@ void InitCreateImageXYZProcess(QString& outImageLLPath, QString& outImageXYZPath bool OverlapCheck(QString& ImageLLPath, QString& ImageDEMPath) { // 检查DEM是否是WGS84坐标系 - long demEPSG = GetEPSGFromRasterFile(ImageDEMPath); - if (demEPSG != 4326) { - qDebug() << u8"DEM坐标系不是WGS84坐标系"; - return false; - } + //long demEPSG = GetEPSGFromRasterFile(ImageDEMPath); + //if (demEPSG != 4326) { + // qDebug() << u8"DEM坐标系不是WGS84坐标系,ESPG:"<< demEPSG; + // return false; + //} gdalImage demimg(ImageDEMPath); 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 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 j = 0; j < imgwidth; j++) { double lon = imglonArr(i, j); // X 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; imglatArr(i, j) = point.lat; } @@ -207,6 +223,14 @@ bool OverlapCheck(QString& ImageLLPath, QString& ImageDEMPath) double minY = imglatArr.minCoeff(); double maxY = imglatArr.maxCoeff(); + //打印范围 + qDebug() << u8"dem 的范围:"; + qDebug() << u8"minX:"<demimg.width - 1 || minY<1 || maxY>demimg.height - 1) { 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 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 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 - double lat = imglatArr(i, j); // Y - Landpoint point = imgll.getRow_Col(lon, lat); - imglonArr(i, j) = point.lon; - imglatArr(i, j) = point.lat; - } - } + + + double minX = imglonArr.minCoeff(); + double maxX = imglonArr.maxCoeff(); + double minY = imglatArr.minCoeff(); + 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; + + 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++) { - double imX = imglonArr(i, j); - double imY = imglatArr(i, j); - + double lon = imglonArr(i, j); + double lat = imglatArr(i, j); + Landpoint point = demimg.getRow_Col(lon, lat); Landpoint p0, p11, p21, p12, p22; - p0.lon = imX; - p0.lat = imY; + p0.lon = point.lon; + p0.lat = point.lat; p11.lon = floor(p0.lon); p11.lat = floor(p0.lat); + p11.ati = demArr(long(p11.lat), long(p11.lon)); p12.lon = ceil(p0.lon); p12.lat = floor(p0.lat); + p12.ati = demArr(long(p12.lat), long(p12.lon)); p21.lon = floor(p0.lon); p21.lat = ceil(p0.lat); + p21.ati = demArr(long(p21.lat), long(p21.lon)); p22.lon = ceil(p0.lon); p22.lat = ceil(p0.lat); + p22.ati = demArr(long(p22.lat), long(p22.lon)); p0.lon = p0.lon - p11.lon; p0.lat = p0.lat - p11.lat; @@ -290,7 +325,7 @@ void InterploateAtiByRefDEM(QString& ImageLLPath, QString& ImageDEMPath, QString p11.lon = p11.lon - p11.lon; 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; } diff --git a/Toolbox/SimulationSARTool/SARImage/ImagePlaneAtiInterpDialog.cpp b/Toolbox/SimulationSARTool/SARImage/ImagePlaneAtiInterpDialog.cpp index 6c241fa..54c7de1 100644 --- a/Toolbox/SimulationSARTool/SARImage/ImagePlaneAtiInterpDialog.cpp +++ b/Toolbox/SimulationSARTool/SARImage/ImagePlaneAtiInterpDialog.cpp @@ -80,7 +80,7 @@ void ImagePlaneAtiInterpDialog::onpushButtonRefRangeDEMSelect_clicked() void ImagePlaneAtiInterpDialog::onpushButtonImageLLASelect_clicked() { - QString fileNames = QFileDialog::getOpenFileName( + QString fileNames = QFileDialog::getSaveFileName( this, // ?????? tr(u8"提示"), // ???? QString(), // ???·?? @@ -88,7 +88,7 @@ void ImagePlaneAtiInterpDialog::onpushButtonImageLLASelect_clicked() ); // ?????????????? if (!fileNames.isEmpty()) { - QString message = "????????У?\n"; + QString message = "选中文件\n"; this->ui->lineEditImageLLAPath->setText(fileNames); } else { From 5bc08bb24258d6e855a17f844fe07c5d80be2e2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=A2=9E=E8=BE=89?= <3045316072@qq.com> Date: Mon, 7 Apr 2025 10:33:12 +0800 Subject: [PATCH 12/44] =?UTF-8?q?=E8=A1=A5=E5=85=85InSAR=E7=9A=84=E6=88=90?= =?UTF-8?q?=E5=83=8F=E7=9A=84=E7=9B=B8=E5=85=B3=E5=B7=A5=E5=85=B7=E7=AE=B1?= =?UTF-8?q?=201.=20=E5=A2=9E=E5=8A=A0=E4=BA=86InSAR=E6=88=90=E5=83=8F?= =?UTF-8?q?=E5=B9=B3=E9=9D=A2=E6=96=87=E4=BB=B6=E7=94=9F=E6=88=90=202.=20B?= =?UTF-8?q?P=E6=88=90=E5=83=8F=E4=B8=AD=EF=BC=8C=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E4=BA=86=E5=8F=82=E8=80=83=E8=B7=9D=E7=A6=BB=E7=9A=84=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../LookTableSimulationComputer.cu | 126 ++++++ .../LookTableSimulationComputer.cuh | 18 + .../QCreateInSARImagePlaneXYZRDialog.cpp | 385 ++++++++++++++++++ .../QCreateInSARImagePlaneXYZRDialog.h | 70 ++++ .../QCreateInSARImagePlaneXYZRDialog.ui | 293 +++++++++++++ .../SimulationSAR/BPBasic0_CUDA.cu | 18 +- .../SimulationSAR/BPBasic0_CUDA.cuh | 2 +- .../SimulationSAR/TBPImageAlgCls.cpp | 12 + .../SimulationSARTool/SimulationSARTool.cpp | 19 + Toolbox/SimulationSARTool/SimulationSARTool.h | 11 + .../SimulationSARTool.vcxproj | 3 + .../SimulationSARTool.vcxproj.filters | 11 +- 12 files changed, 961 insertions(+), 7 deletions(-) create mode 100644 Toolbox/SimulationSARTool/SARImage/QCreateInSARImagePlaneXYZRDialog.cpp create mode 100644 Toolbox/SimulationSARTool/SARImage/QCreateInSARImagePlaneXYZRDialog.h create mode 100644 Toolbox/SimulationSARTool/SARImage/QCreateInSARImagePlaneXYZRDialog.ui diff --git a/Toolbox/SimulationSARTool/PowerSimulationIncoherent/LookTableSimulationComputer.cu b/Toolbox/SimulationSARTool/PowerSimulationIncoherent/LookTableSimulationComputer.cu index 6d6e7ef..2252520 100644 --- a/Toolbox/SimulationSARTool/PowerSimulationIncoherent/LookTableSimulationComputer.cu +++ b/Toolbox/SimulationSARTool/PowerSimulationIncoherent/LookTableSimulationComputer.cu @@ -145,6 +145,87 @@ __global__ void Kernel_RDProcess_doppler( +__global__ void Kernel_RDProcess_doppler_calRangeDistance( + double* demX, double* demY, double* demZ, + double* outR, + long pixelcount, + double Xp0, double Yp0, double Zp0, double Xv0, double Yv0, double Zv0, + double Xp1, double Yp1, double Zp1, double Xv1, double Yv1, double Zv1, + double Xp2, double Yp2, double Zp2, double Xv2, double Yv2, double Zv2, + double Xp3, double Yp3, double Zp3, double Xv3, double Yv3, double Zv3, + double Xp4, double Yp4, double Zp4, double Xv4, double Yv4, double Zv4, + double Xp5, double Yp5, double Zp5, double Xv5, double Yv5, double Zv5, + double reftime, double r0, double r1, double r2, double r3, double r4, + double starttime, double nearRange, double farRange, + double PRF, double Fs, + double fact_lamda +) { + long idx = blockIdx.x * blockDim.x + threadIdx.x; + if (idx < pixelcount) { + double demx = demX[idx]; + double demy = demY[idx]; + double demz = demZ[idx]; + double dt = 1.0 / PRF / 3; + double Spx = 0, Spy = 0, Spz = 0, Svx = 0, Svy = 0, Svz = 0; + double Rx = 0, Ry = 0, Rz = 0, R = 0; + + double dp1 = 0, dpn1 = 0, dp2 = 0, dpn2 = 0; + + double ti = 0; + double inct = 0; + for (long i = 0; i < 10000; i++) { // 最大迭代范围 + Spx = getPolyfitNumber(ti + dt, Xp0, Xp1, Xp2, Xp3, Xp4, Xp5); + Spy = getPolyfitNumber(ti + dt, Yp0, Yp1, Yp2, Yp3, Yp4, Yp5); + Spz = getPolyfitNumber(ti + dt, Zp0, Zp1, Zp2, Zp3, Zp4, Zp5); + Svx = getPolyfitNumber(ti + dt, Xv0, Xv1, Xv2, Xv3, Xv4, Xv5); + Svy = getPolyfitNumber(ti + dt, Yv0, Yv1, Yv2, Yv3, Yv4, Yv5); + Svz = getPolyfitNumber(ti + dt, Zv0, Zv1, Zv2, Zv3, Zv4, Zv5); + + Rx = Spx - demx; + Ry = Spy - demy; + Rz = Spz - demz; + R = sqrt(Rx * Rx + Ry * Ry + Rz * Rz); + Rx = Rx / R; + Ry = Ry / R; + Rz = Rz / R; + + dp2 = getDopplerCenterRate(Rx, Ry, Rz, Svx, Svy, Svz, fact_lamda); + dpn2 = getNumberDopplerCenterRate(R, r0, r1, r2, r3, r4, reftime); + + // ti + Spx = getPolyfitNumber(ti, Xp0, Xp1, Xp2, Xp3, Xp4, Xp5); + Spy = getPolyfitNumber(ti, Yp0, Yp1, Yp2, Yp3, Yp4, Yp5); + Spz = getPolyfitNumber(ti, Zp0, Zp1, Zp2, Zp3, Zp4, Zp5); + Svx = getPolyfitNumber(ti, Xv0, Xv1, Xv2, Xv3, Xv4, Xv5); + Svy = getPolyfitNumber(ti, Yv0, Yv1, Yv2, Yv3, Yv4, Yv5); + Svz = getPolyfitNumber(ti, Zv0, Zv1, Zv2, Zv3, Zv4, Zv5); + + Rx = Spx - demx; + Ry = Spy - demy; + Rz = Spz - demz; + R = sqrt(Rx * Rx + Ry * Ry + Rz * Rz); + Rx = Rx / R; + Ry = Ry / R; + Rz = Rz / R; + + dp1 = getDopplerCenterRate(Rx, Ry, Rz, Svx, Svy, Svz, fact_lamda); + dpn1 = getNumberDopplerCenterRate(R, r0, r1, r2, r3, r4, reftime); + + // iter + inct = dt * (dp2 - dpn1) / (dp1 - dp2); + + if (abs(inct) <= dt || isnan(inct)) { + outR[idx] = R;//Rd_c; + return; + } + ti = ti + inct; + } + outR[idx] = 0; + } +} + + + void RDProcess_dopplerGPU( @@ -185,6 +266,51 @@ void RDProcess_dopplerGPU( cudaDeviceSynchronize(); } + + +void RDProcess_dopplerGPU_InSARImagePlaneXYZR( + double* demX, double* demY, double* demZ, + double* outR, + long rowcount, long colcount, + double starttime, double nearRange, double farRange, + double PRF, double Fs, + double fact_lamda, + double Xp0, double Yp0, double Zp0, double Xv0, double Yv0, double Zv0, + double Xp1, double Yp1, double Zp1, double Xv1, double Yv1, double Zv1, + double Xp2, double Yp2, double Zp2, double Xv2, double Yv2, double Zv2, + double Xp3, double Yp3, double Zp3, double Xv3, double Yv3, double Zv3, + double Xp4, double Yp4, double Zp4, double Xv4, double Yv4, double Zv4, + double Xp5, double Yp5, double Zp5, double Xv5, double Yv5, double Zv5, + double reftime, double r0, double r1, double r2, double r3, double r4 + +) +{ + long pixelcount = rowcount * colcount; + int numBlocks = (pixelcount + BLOCK_SIZE - 1) / BLOCK_SIZE; + Kernel_RDProcess_doppler_calRangeDistance << > > ( + demX, demY, demZ, + outR, + pixelcount, + Xp0, Yp0, Zp0, Xv0, Yv0, Zv0, + Xp1, Yp1, Zp1, Xv1, Yv1, Zv1, + Xp2, Yp2, Zp2, Xv2, Yv2, Zv2, + Xp3, Yp3, Zp3, Xv3, Yv3, Zv3, + Xp4, Yp4, Zp4, Xv4, Yv4, Zv4, + Xp5, Yp5, Zp5, Xv5, Yv5, Zv5, + reftime, r0, r1, r2, r3, r4, + starttime, nearRange, farRange, + PRF, Fs, + fact_lamda + ); + PrintLasterError("RD with doppler function"); + cudaDeviceSynchronize(); +} + + + + + + __device__ double calculateIncidenceAngle(double Rx, double Ry, double Rz, double Sx, double Sy, double Sz) { double dotProduct = Rx * Sx + Ry * Sy + Rz * Sz; double magnitudeR = sqrt(Rx * Rx + Ry * Ry + Rz * Rz); diff --git a/Toolbox/SimulationSARTool/PowerSimulationIncoherent/LookTableSimulationComputer.cuh b/Toolbox/SimulationSARTool/PowerSimulationIncoherent/LookTableSimulationComputer.cuh index 1ce140e..a697719 100644 --- a/Toolbox/SimulationSARTool/PowerSimulationIncoherent/LookTableSimulationComputer.cuh +++ b/Toolbox/SimulationSARTool/PowerSimulationIncoherent/LookTableSimulationComputer.cuh @@ -57,3 +57,21 @@ extern "C" void RDProcess_demSloperGPU( ); + + + +extern "C" void RDProcess_dopplerGPU_InSARImagePlaneXYZR( + double* demX, double* demY, double* demZ, + double* outR, + long rowcount, long colcount, + double starttime, double nearRange, double farRange, + double PRF, double Fs, + double fact_lamda, + double Xp0, double Yp0, double Zp0, double Xv0, double Yv0, double Zv0, + double Xp1, double Yp1, double Zp1, double Xv1, double Yv1, double Zv1, + double Xp2, double Yp2, double Zp2, double Xv2, double Yv2, double Zv2, + double Xp3, double Yp3, double Zp3, double Xv3, double Yv3, double Zv3, + double Xp4, double Yp4, double Zp4, double Xv4, double Yv4, double Zv4, + double Xp5, double Yp5, double Zp5, double Xv5, double Yv5, double Zv5, + double reftime, double r0, double r1, double r2, double r3, double r4 +); \ No newline at end of file diff --git a/Toolbox/SimulationSARTool/SARImage/QCreateInSARImagePlaneXYZRDialog.cpp b/Toolbox/SimulationSARTool/SARImage/QCreateInSARImagePlaneXYZRDialog.cpp new file mode 100644 index 0000000..732557c --- /dev/null +++ b/Toolbox/SimulationSARTool/SARImage/QCreateInSARImagePlaneXYZRDialog.cpp @@ -0,0 +1,385 @@ +#include "QCreateInSARImagePlaneXYZRDialog.h" +#include "ui_QCreateInSARImagePlaneXYZRDialog.h" +#include +#include + +#include "SatelliteOribtModel.h" +#include "SARSimulationTaskSetting.h" +#include "ImageOperatorBase.h" +#include "FileOperator.h" +#include "BaseConstVariable.h" +#include "GPUTool.cuh" +#include "LookTableSimulationComputer.cuh" +#include + +#include "ImageShowDialogClass.h" +#include "QToolProcessBarDialog.h" + +QCreateInSARImagePlaneXYZRDialog::QCreateInSARImagePlaneXYZRDialog(QWidget* parent) + : QDialog(parent), ui(new Ui::QCreateInSARImagePlaneXYZRDialogClass) +{ + ui->setupUi(this); + connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(onaccepted())); + connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(onrejected())); + connect(ui->pushButtonDEM, SIGNAL(clicked(bool)), this, SLOT(onpushButtonDEMClicked(bool))); + connect(ui->pushButtonSloper, SIGNAL(clicked(bool)), this, SLOT(onpushButtonSloperClicked(bool))); + connect(ui->pushButtonOrbitModel, SIGNAL(clicked(bool)), this, SLOT(onpushButtonOrbitModelClicked(bool))); + connect(ui->pushButtonOutDir, SIGNAL(clicked(bool)), this, SLOT(onpushButtonOutDirClicked(bool))); + connect(ui->pushButtonSataSetting, SIGNAL(clicked(bool)), this, SLOT(onpushButtonSataSettingClicked(bool))); + + + +} + +QCreateInSARImagePlaneXYZRDialog::~QCreateInSARImagePlaneXYZRDialog() +{ + +} + +void QCreateInSARImagePlaneXYZRDialog::onrejected() +{ + this->close(); +} + +void QCreateInSARImagePlaneXYZRDialog::onpushButtonOrbitModelClicked(bool) +{ + // 调用文件选择对话框并选择一个 .tif 文件 + QString fileName = QFileDialog::getOpenFileName(this, + u8"GPS Orbit Model xml", // 对话框标题 + "", // 初始目录,可以设置为路径 + u8"xml Files (*.xml)"); // 文件类型过滤器 + + if (!fileName.isEmpty()) { + this->ui->OrbitModelPathLineEdit->setText(fileName); + } + else { + QMessageBox::information(this, u8"没有选择文件", u8"没有选择任何文件"); + } +} + +void QCreateInSARImagePlaneXYZRDialog::onpushButtonSataSettingClicked(bool) +{ + // 调用文件选择对话框并选择一个 .tif 文件 + QString fileName = QFileDialog::getOpenFileName(this, + u8"Satellite Params setting xml", // 对话框标题 + "", // 初始目录,可以设置为路径 + u8"xml Files (*.xml)"); // 文件类型过滤器 + + if (!fileName.isEmpty()) { + this->ui->SateSettingLineEdit->setText(fileName); + } + else { + QMessageBox::information(this, u8"没有选择文件", u8"没有选择任何文件"); + } +} + +void QCreateInSARImagePlaneXYZRDialog::onpushButtonDEMClicked(bool) +{ + // 调用文件选择对话框并选择一个 .tif 文件 + QString fileName = QFileDialog::getOpenFileName(this, + u8"DEM XYZ Raster Select", // 对话框标题 + "", // 初始目录,可以设置为路径 + u8"tiff Files (*.tiff);;tif Files (*.tif);;dat Files (*.dat);;All Files (*.*)"); // 文件类型过滤器 + + if (!fileName.isEmpty()) { + this->ui->DEMLineEdit->setText(fileName); + } + else { + QMessageBox::information(this, u8"没有选择文件", u8"没有选择任何文件"); + } +} + +void QCreateInSARImagePlaneXYZRDialog::onpushButtonSloperClicked(bool) +{ + // 调用文件选择对话框并选择一个 .tif 文件 + QString fileName = QFileDialog::getOpenFileName(this, + u8"DEM Sloper Raster Select", // 对话框标题 + "", // 初始目录,可以设置为路径 + u8"tiff Files (*.tiff);;tif Files (*.tif);;dat Files (*.dat);;All Files (*.*)"); // 文件类型过滤器 + + if (!fileName.isEmpty()) { + this->ui->SloperLineEdit->setText(fileName); + } + else { + QMessageBox::information(this, u8"没有选择文件", u8"没有选择任何文件"); + } +} + +void QCreateInSARImagePlaneXYZRDialog::onpushButtonOutDirClicked(bool) +{ + // 调用文件选择对话框并选择一个 .tif 文件 + QString fileName = QFileDialog::getExistingDirectory(this, + u8"DEM Raster Select", // 对话框标题 + "" // 初始目录,可以设置为路径 + ); + if (!fileName.isEmpty()) { + this->ui->outDirLineEdit->setText(fileName); + } + else { + QMessageBox::information(this, u8"没有选择文件", u8"没有选择任何文件"); + } +} + +void QCreateInSARImagePlaneXYZRDialog::LookTableSimualtionMainProcess(QString sateName, QString orbitpath, QString SatePath, QString DEMPath, QString outDirPath) +{ + + if (!isExists(orbitpath)) { + qDebug() << "Orbit model file is not exist !!!"; + return; + } + if (!isExists(SatePath)) { + qDebug() << "Satellite Model file is not exist !!!"; + return; + } + if (!isExists(DEMPath)) { + qDebug() << "DEM file is not exist !!!"; + return; + } + + // 读取轨道模型 + qDebug() << "load orbit model params from xml :" << orbitpath; + PolyfitSatelliteOribtModel orbitmodel; + orbitmodel.loadFromXml(orbitpath); + + // 轨道参数 + long double OribtStartTime = orbitmodel.getOribtStartTime(); + std::vector PolyfitPx = orbitmodel.getPolyfitPx(); + std::vector PolyfitPy = orbitmodel.getPolyfitPy(); + std::vector PolyfitPz = orbitmodel.getPolyfitPz(); + std::vector PolyfitVx = orbitmodel.getPolyfitVx(); + std::vector PolyfitVy = orbitmodel.getPolyfitVy(); + std::vector PolyfitVz = orbitmodel.getPolyfitVz(); + + + // 参数模型 + qDebug() << "load simulation setting params from xml :" << orbitpath; + std::shared_ptr SARSetting = ReadSimulationSettingsXML(SatePath); + + // 多普勒参数 + double dopplerRefrenceTime = SARSetting->getDopplerParametersReferenceTime(); + std::vector DopplerCentroidCoefficients = SARSetting->getDopplerCentroidCoefficients(); + std::vector DopplerRateValuesCoefficient = SARSetting->getDopplerRateValuesCoefficients(); + + // 仿真成像参数计算 + double startTime = SARSetting->getSARImageStartTime(); + double endTime = SARSetting->getSARImageStartTime(); + + double PRF = SARSetting->getPRF(); + double Fs = SARSetting->getFs(); + double nearRange = SARSetting->getNearRange(); + double farRange = SARSetting->getFarRange(); + double lamda = SARSetting->getCenterLamda(); + // 输出结果处理 + QString outLookTablePath = ""; + QString outIncPath = ""; + gdalImage demimg(DEMPath); + + + outLookTablePath = JoinPath(outDirPath, sateName + "_looktable.bin"); + + this->ui->label_tip->setText(u8"look table create..."); + + this->LookTableSimulationDopplerProcess( + DEMPath, + outLookTablePath, + OribtStartTime, + PolyfitPx, PolyfitPy, PolyfitPz, + PolyfitVx, PolyfitVy, PolyfitVz, + dopplerRefrenceTime, + DopplerCentroidCoefficients, + startTime, + endTime, + nearRange, + farRange, + PRF, + Fs, + lamda + ); +} + +void QCreateInSARImagePlaneXYZRDialog::LookTableSimulationDopplerProcess(QString DEMPath, QString outLookTablePath, long double OribtStartTime, std::vector PolyfitPx, std::vector PolyfitPy, std::vector PolyfitPz, std::vector PolyfitVx, std::vector PolyfitVy, std::vector PolyfitVz, double dopplerRefrenceTime, std::vector DopplerCentroidCoefficients, double starttime, double endtime, double nearRange, double farRange, double PRF, double Fs, double lamda) +{ + qDebug() << "generate look table "; + qDebug() << "DEMPath\t" << DEMPath; + qDebug() << "outLookTablePath\t" << outLookTablePath; + + gdalImage demimg(DEMPath); + gdalImage outLookTable = CreategdalImage( // 创建查找表 + outLookTablePath, + demimg.height, demimg.width, 4, + demimg.gt, + demimg.projection, + true, + true, + true + ); + + + starttime = starttime - OribtStartTime; // 处理坐标时间 + endtime = endtime - OribtStartTime; + + // 轨道模型 + double Xp0 = 0, Yp0 = 0, Zp0 = 0, Xv0 = 0, Yv0 = 0, Zv0 = 0; + double Xp1 = 0, Yp1 = 0, Zp1 = 0, Xv1 = 0, Yv1 = 0, Zv1 = 0; + double Xp2 = 0, Yp2 = 0, Zp2 = 0, Xv2 = 0, Yv2 = 0, Zv2 = 0; + double Xp3 = 0, Yp3 = 0, Zp3 = 0, Xv3 = 0, Yv3 = 0, Zv3 = 0; + double Xp4 = 0, Yp4 = 0, Zp4 = 0, Xv4 = 0, Yv4 = 0, Zv4 = 0; + double Xp5 = 0, Yp5 = 0, Zp5 = 0, Xv5 = 0, Yv5 = 0, Zv5 = 0; + int degree = PolyfitPx.size(); + switch (degree) { + case(6): + Xp5 = PolyfitPx[5]; + Yp5 = PolyfitPy[5]; + Zp5 = PolyfitPz[5]; + Xv5 = PolyfitVx[5]; + Yv5 = PolyfitVy[5]; + Zv5 = PolyfitVz[5]; + case(5): + Xp4 = PolyfitPx[4]; + Yp4 = PolyfitPy[4]; + Zp4 = PolyfitPz[4]; + Xv4 = PolyfitVx[4]; + Yv4 = PolyfitVy[4]; + Zv4 = PolyfitVz[4]; + case(4): + Xp3 = PolyfitPx[3]; + Yp3 = PolyfitPy[3]; + Zp3 = PolyfitPz[3]; + Xv3 = PolyfitVx[3]; + Yv3 = PolyfitVy[3]; + Zv3 = PolyfitVz[3]; + case(3): + Xp2 = PolyfitPx[2]; + Yp2 = PolyfitPy[2]; + Zp2 = PolyfitPz[2]; + Xv2 = PolyfitVx[2]; + Yv2 = PolyfitVy[2]; + Zv2 = PolyfitVz[2]; + case(2): + Xp1 = PolyfitPx[1]; + Yp1 = PolyfitPy[1]; + Zp1 = PolyfitPz[1]; + Xv1 = PolyfitVx[1]; + Yv1 = PolyfitVy[1]; + Zv1 = PolyfitVz[1]; + case(1): + Xp0 = PolyfitPx[0]; + Yp0 = PolyfitPy[0]; + Zp0 = PolyfitPz[0]; + Xv0 = PolyfitVx[0]; + Yv0 = PolyfitVy[0]; + Zv0 = PolyfitVz[0]; + default: + break; + } + + // 多普勒参数 + double r0 = 0, r1 = 0, r2 = 0, r3 = 0, r4 = 0; + degree = DopplerCentroidCoefficients.size(); + switch (degree) + { + case(5): + r4 = DopplerCentroidCoefficients[4]; + case(4): + r3 = DopplerCentroidCoefficients[3]; + case(3): + r2 = DopplerCentroidCoefficients[2]; + case(2): + r1 = DopplerCentroidCoefficients[1]; + case(1): + r0 = DopplerCentroidCoefficients[0]; + default: + break; + } + + + + // 处理分块 + long GPUMemoryline = floor((Memory1MB * 2.0 / 8.0 / 3.0 / demimg.width * 2000));//2GB + GPUMemoryline = GPUMemoryline < 1 ? 1 : GPUMemoryline; + + // 内存预分配 + + double fact_lamda = 1 / lamda; + for (long rid = 0; rid < demimg.height; rid = rid + GPUMemoryline) { + long rowcount = GPUMemoryline; + long colcount = demimg.width; + qDebug() << "computer read file : " << rid << "~" << rowcount + rid << "\t:" << demimg.height; + //double* tmep = new double[rowcount * colcount]; + std::shared_ptr demX = readDataArr(demimg, rid, 0, rowcount, colcount, 1, GDALREADARRCOPYMETHOD::VARIABLEMETHOD);// 行列数修改 + std::shared_ptr demY = readDataArr(demimg, rid, 0, rowcount, colcount, 2, GDALREADARRCOPYMETHOD::VARIABLEMETHOD); + std::shared_ptr demZ = readDataArr(demimg, rid, 0, rowcount, colcount, 3, GDALREADARRCOPYMETHOD::VARIABLEMETHOD); + + // + std::shared_ptr host_R((double*)mallocCUDAHost(sizeof(double) * rowcount * demimg.width), FreeCUDAHost); + + std::shared_ptr device_R((double*)mallocCUDADevice(sizeof(double) * rowcount * demimg.width), FreeCUDADevice); + + // + std::shared_ptr host_demX((double*)mallocCUDAHost(sizeof(double) * rowcount * demimg.width), FreeCUDAHost); + std::shared_ptr host_demY((double*)mallocCUDAHost(sizeof(double) * rowcount * demimg.width), FreeCUDAHost); + std::shared_ptr host_demZ((double*)mallocCUDAHost(sizeof(double) * rowcount * demimg.width), FreeCUDAHost); + + std::shared_ptr device_demX((double*)mallocCUDADevice(sizeof(double) * rowcount * demimg.width), FreeCUDADevice); + std::shared_ptr device_demY((double*)mallocCUDADevice(sizeof(double) * rowcount * demimg.width), FreeCUDADevice); + std::shared_ptr device_demZ((double*)mallocCUDADevice(sizeof(double) * rowcount * demimg.width), FreeCUDADevice); + + // 数据复制 + memcpy(host_demX.get(), demX.get(), sizeof(double) * rowcount * colcount); + memcpy(host_demY.get(), demY.get(), sizeof(double) * rowcount * colcount); + memcpy(host_demZ.get(), demZ.get(), sizeof(double) * rowcount * colcount); + + //内存->GPU + HostToDevice(host_demX.get(), device_demX.get(), sizeof(double) * rowcount * demimg.width); + HostToDevice(host_demY.get(), device_demY.get(), sizeof(double) * rowcount * demimg.width); + HostToDevice(host_demZ.get(), device_demZ.get(), sizeof(double) * rowcount * demimg.width); + + qDebug() << "GPU computer start: " << rid << "~" << rowcount + rid << "\t:" << demimg.height; + RDProcess_dopplerGPU_InSARImagePlaneXYZR( + device_demX.get(), device_demY.get(), device_demZ.get(), + device_R.get(), + rowcount, colcount, + starttime, nearRange, farRange, + PRF, Fs, + fact_lamda, + Xp0, Yp0, Zp0, Xv0, Yv0, Zv0, + Xp1, Yp1, Zp1, Xv1, Yv1, Zv1, + Xp2, Yp2, Zp2, Xv2, Yv2, Zv2, + Xp3, Yp3, Zp3, Xv3, Yv3, Zv3, + Xp4, Yp4, Zp4, Xv4, Yv4, Zv4, + Xp5, Yp5, Zp5, Xv5, Yv5, Zv5, + dopplerRefrenceTime, r0, r1, r2, r3, r4); + + + // GPU -> 内存 + DeviceToHost(host_R.get(), device_R.get(), sizeof(double) * rowcount * demimg.width); + qDebug() << "GPU computer finished!!: " << rid << "~" << rowcount + rid << "\t:" << demimg.height; + //exit(-1); + // 数据存储 + outLookTable.saveImage(demX, rid, 0, rowcount, colcount, 1); + outLookTable.saveImage(demY, rid, 0, rowcount, colcount, 2); + outLookTable.saveImage(demZ, rid, 0, rowcount, colcount, 3); + outLookTable.saveImage(host_R, rid, 0, rowcount, colcount, 4); + + qDebug() << "GPU computer result write finished: " << rid << " ~ " << rowcount + rid << "\t:" << demimg.height; + + } + + qDebug() << "look table computed finished!!!"; + } + +void QCreateInSARImagePlaneXYZRDialog::onaccepted() +{ + QString orbitpath = this->ui->OrbitModelPathLineEdit->text(); + QString SatePath = this->ui->SateSettingLineEdit->text(); + QString DEMPath = this->ui->DEMLineEdit->text(); + QString outDirPath = this->ui->outDirLineEdit->text(); + + QString simulationName = this->ui->lineEditLookName->text(); + this->LookTableSimualtionMainProcess( + simulationName, + orbitpath, SatePath, DEMPath, outDirPath + ); + QMessageBox::information(this, u8"info", u8"completed!!!"); + +} diff --git a/Toolbox/SimulationSARTool/SARImage/QCreateInSARImagePlaneXYZRDialog.h b/Toolbox/SimulationSARTool/SARImage/QCreateInSARImagePlaneXYZRDialog.h new file mode 100644 index 0000000..d071ee9 --- /dev/null +++ b/Toolbox/SimulationSARTool/SARImage/QCreateInSARImagePlaneXYZRDialog.h @@ -0,0 +1,70 @@ +#pragma once + +#include + + +namespace Ui { + class QCreateInSARImagePlaneXYZRDialogClass; +} + +class QCreateInSARImagePlaneXYZRDialog : public QDialog +{ + Q_OBJECT + +public: + QCreateInSARImagePlaneXYZRDialog(QWidget *parent = nullptr); + ~QCreateInSARImagePlaneXYZRDialog(); + +private: + Ui::QCreateInSARImagePlaneXYZRDialogClass* ui; + + +public slots: + void onaccepted(); + void onrejected(); + + void onpushButtonOrbitModelClicked(bool); + void onpushButtonSataSettingClicked(bool); + void onpushButtonDEMClicked(bool); + void onpushButtonSloperClicked(bool); + void onpushButtonOutDirClicked(bool); + + + +private: // doppler 处理软件 + void LookTableSimualtionMainProcess( + QString sateName, + QString orbitpath, QString SatePath, QString DEMPath, QString outDirPath + ); + + void LookTableSimulationDopplerProcess( + QString DEMPath, + QString outLookTablePath, + + // 多项式轨道参数 + long double OribtStartTime, // 轨道模型参考时间 + std::vector PolyfitPx, // 5次项,空余填0 + std::vector PolyfitPy, // 5次项,空余填0 + std::vector PolyfitPz, // 5次项,空余填0 + std::vector PolyfitVx, // 5次项,空余填0 + std::vector PolyfitVy, // 5次项,空余填0 + std::vector PolyfitVz, // 5次项,空余填0 + + + // 多普勒参数 + double dopplerRefrenceTime, + std::vector DopplerCentroidCoefficients,// d0 ~ d5, 空余填零 + + // 其他成像参数 + double starttime, // 成像开始时间 + double endtime, // 成像结束时间 + double nearRange, // 近斜距 + double farRange, // 远斜距 + double PRF, // 脉冲重复采样频率 + double Fs, // 距离采样频率 + double lamda + ); + + + +}; diff --git a/Toolbox/SimulationSARTool/SARImage/QCreateInSARImagePlaneXYZRDialog.ui b/Toolbox/SimulationSARTool/SARImage/QCreateInSARImagePlaneXYZRDialog.ui new file mode 100644 index 0000000..c90b83d --- /dev/null +++ b/Toolbox/SimulationSARTool/SARImage/QCreateInSARImagePlaneXYZRDialog.ui @@ -0,0 +1,293 @@ + + + QCreateInSARImagePlaneXYZRDialogClass + + + + 0 + 0 + 763 + 498 + + + + QCreateInSARImagePlaneXYZR + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + 0 + 30 + + + + 閫夋嫨 + + + + + + + + 0 + 30 + + + + 閫夋嫨 + + + + + + + + 0 + 30 + + + + D:\FZSimulation\LT1A\L20250210\LT1A_DEM_20250210_resampleXYZ.dat + + + + + + + 閲囩敤澶氭櫘鍕掑弬鏁 + + + true + + + + + + + + 0 + 30 + + + + 鍗槦浠跨湡鍙傛暟: + + + + + + + + 0 + 30 + + + + 閫夋嫨 + + + + + + + + 0 + 30 + + + + DEM鏂囦欢(XYZ) + + + + + + + + 0 + 30 + + + + 鍧″害娉曞悜鏂囦欢(sloper) + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + 0 + 30 + + + + D:\FZSimulation\LT1A\L20250210\LT1_Simulation_OrbitModel.xml + + + + + + + + 0 + 30 + + + + LT1A_20250210 + + + + + + + + 0 + 30 + + + + D:\FZSimulation\LT1A\L20250210\Looktable + + + + + + + + + + + + + + + 0 + 30 + + + + 閫夋嫨 + + + + + + + + 0 + 30 + + + + 澶氶」寮忚建閬撴ā鍨嬪弬鏁: + + + + + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + 0 + 30 + + + + D:\FZSimulation\LT1A\L20250210\LT1A_DEM_20250210_resampleXYZ.dat + + + + + + + + 0 + 30 + + + + 缁撴灉鏂囦欢淇濆瓨鍦板潃: + + + + + + + + 0 + 30 + + + + 鎴愬儚骞抽潰鏂囦欢鍚 + + + + + + + + 0 + 30 + + + + 閫夋嫨 + + + + + + + + 0 + 30 + + + + D:\FZSimulation\LT1A\L20250210\LT1_Simulation_Setting.xml + + + + + + + + + diff --git a/Toolbox/SimulationSARTool/SimulationSAR/BPBasic0_CUDA.cu b/Toolbox/SimulationSARTool/SimulationSAR/BPBasic0_CUDA.cu index cdf1705..761114b 100644 --- a/Toolbox/SimulationSARTool/SimulationSAR/BPBasic0_CUDA.cu +++ b/Toolbox/SimulationSARTool/SimulationSAR/BPBasic0_CUDA.cu @@ -56,7 +56,7 @@ __global__ void fftshiftKernel(cufftComplex* data, int Nfft, int Np) { __global__ void processPulseKernel( long prfid, int nx, int ny, - const double* x_mat, const double* y_mat, const double* z_mat, + const double* x_mat, const double* y_mat, const double* z_mat,const double* R_mat, double AntX, double AntY, double AntZ, double R0, double minF, const cufftComplex* rc_pulse, @@ -78,6 +78,7 @@ __global__ void processPulseKernel( double dx = AntX - x_mat[idx]; double dy = AntY - y_mat[idx]; double dz = AntZ - z_mat[idx]; + double initR = R_mat[idx]; //printf("processPulseKernel xmat !!\n"); double R = sqrt(dx * dx + dy * dy + dz * dz); @@ -98,7 +99,7 @@ __global__ void processPulseKernel( rc_interp.y = rc_low.y * (1 - weight) + rc_high.y * weight; // Phase correction - double phase = 4 * PI * minF / c * dR; + double phase = 4 * PI * minF / c * (dR- initR); // 补充当前点的参考距离 double cos_phase = cos(phase); double sin_phase = sin(phase); @@ -109,8 +110,12 @@ __global__ void processPulseKernel( // Accumulate im_final[idx].x += phCorr.x; im_final[idx].y += phCorr.y; + + + + //printf("r_start=%e;dr=%e;nR=%d\n", r_start, dr, nR); - if (abs(phCorr.x) > 1e-100 || abs(phCorr.y > 1e-100)) { + //if (abs(phCorr.x) > 1e-100 || abs(phCorr.y > 1e-100)) { //printf( // "[DEBUG] prfid=%-4ld | idx=%-8lld\n" // " Ant: X=%-18.10e Y=%-18.10e Z=%-18.10e\n" @@ -133,7 +138,7 @@ __global__ void processPulseKernel( // phCorr.x, phCorr.y, // im_final[idx].x, im_final[idx].y //); - } + //} } void bpBasic0CUDA(GPUDATA& data, int flag,double* h_R) { @@ -177,7 +182,7 @@ void bpBasic0CUDA(GPUDATA& data, int flag,double* h_R) { processPulseKernel << > > ( ii, data.nx, data.ny, - data.x_mat, data.y_mat, data.z_mat, + data.x_mat, data.y_mat, data.z_mat,data.R_mat, data.AntX[ii], data.AntY[ii], data.AntZ[ii], data.R0, data.minF[ii], data.phdata, @@ -206,6 +211,7 @@ void initGPUData(GPUDATA& h_data, GPUDATA& d_data) { d_data.x_mat = (double*)mallocCUDADevice(sizeof(double) * h_data.nx * h_data.ny); d_data.y_mat = (double*)mallocCUDADevice(sizeof(double) * h_data.nx * h_data.ny); d_data.z_mat = (double*)mallocCUDADevice(sizeof(double) * h_data.nx * h_data.ny); + d_data.R_mat = (double*)mallocCUDADevice(sizeof(double) * h_data.nx * h_data.ny); d_data.r_vec = h_data.r_vec;// (double*)mallocCUDADevice(sizeof(double) * h_data.Nfft); d_data.Freq = (double*)mallocCUDADevice(sizeof(double) * h_data.Nfft); d_data.phdata = (cuComplex*)mallocCUDADevice(sizeof(cuComplex) * h_data.Nfft * h_data.Np); @@ -218,6 +224,7 @@ void initGPUData(GPUDATA& h_data, GPUDATA& d_data) { HostToDevice(h_data.x_mat, d_data.x_mat,sizeof(double) * h_data.nx * h_data.ny); printf("image X Copy finished!!!\n"); HostToDevice(h_data.y_mat, d_data.y_mat,sizeof(double) * h_data.nx * h_data.ny); printf("image Y Copy finished!!!\n"); HostToDevice(h_data.z_mat, d_data.z_mat, sizeof(double) * h_data.nx * h_data.ny); printf("image Z Copy finished!!!\n"); + HostToDevice(h_data.R_mat, d_data.R_mat, sizeof(double) * h_data.nx * h_data.ny); printf("image R Copy finished!!!\n"); HostToDevice(h_data.Freq, d_data.Freq, sizeof(double) * h_data.Nfft); //HostToDevice(h_data.r_vec, d_data.r_vec, sizeof(double) * h_data.Nfft); HostToDevice(h_data.phdata, d_data.phdata, sizeof(cuComplex) * h_data.Nfft * h_data.Np); printf("image echo Copy finished!!!\n"); @@ -242,6 +249,7 @@ void freeGPUData(GPUDATA& d_data) { FreeCUDADevice((d_data.x_mat)); FreeCUDADevice((d_data.y_mat)); FreeCUDADevice((d_data.z_mat)); + FreeCUDADevice((d_data.R_mat)); //FreeCUDADevice((d_data.r_vec)); FreeCUDADevice((d_data.Freq)); FreeCUDADevice((d_data.phdata)); diff --git a/Toolbox/SimulationSARTool/SimulationSAR/BPBasic0_CUDA.cuh b/Toolbox/SimulationSARTool/SimulationSAR/BPBasic0_CUDA.cuh index c971640..8cfd5cd 100644 --- a/Toolbox/SimulationSARTool/SimulationSAR/BPBasic0_CUDA.cuh +++ b/Toolbox/SimulationSARTool/SimulationSAR/BPBasic0_CUDA.cuh @@ -21,7 +21,7 @@ struct GPUDATA { long Nfft, K, Np, nx, ny; // 傅里叶点数、频点数、脉冲数、图像列、图像行 double* AntX, * AntY, * AntZ, * minF; // 天线坐标、起始频率 - double* x_mat, * y_mat, * z_mat;// 地面坐标 + double* x_mat, * y_mat, * z_mat,*R_mat;// 地面坐标 double* r_vec; // 坐标范围 double* Freq;// 频率 cuComplex* phdata;// 回波 diff --git a/Toolbox/SimulationSARTool/SimulationSAR/TBPImageAlgCls.cpp b/Toolbox/SimulationSARTool/SimulationSAR/TBPImageAlgCls.cpp index 9b64590..50b4422 100644 --- a/Toolbox/SimulationSARTool/SimulationSAR/TBPImageAlgCls.cpp +++ b/Toolbox/SimulationSARTool/SimulationSAR/TBPImageAlgCls.cpp @@ -178,6 +178,18 @@ ErrorCode TBPImageAlgCls::ProcessGPU() std::shared_ptr demX = readDataArr(demgridimg, img_start_rid, 0, img_blockRowCount, img_blockColCount, 1, GDALREADARRCOPYMETHOD::VARIABLEMETHOD); std::shared_ptr demY = readDataArr(demgridimg, img_start_rid, 0, img_blockRowCount, img_blockColCount, 2, GDALREADARRCOPYMETHOD::VARIABLEMETHOD); std::shared_ptr demZ = readDataArr(demgridimg, img_start_rid, 0, img_blockRowCount, img_blockColCount, 3, GDALREADARRCOPYMETHOD::VARIABLEMETHOD); + std::shared_ptr demR= demgridimg.band_num==3? + readDataArr(demgridimg, img_start_rid, 0, img_blockRowCount, img_blockColCount, 3, GDALREADARRCOPYMETHOD::VARIABLEMETHOD): + readDataArr(demgridimg, img_start_rid, 0, img_blockRowCount, img_blockColCount, 4, GDALREADARRCOPYMETHOD::VARIABLEMETHOD); + + if (nullptr == demR) { + for (long i = 0; i < img_blockRowCount; i++) { + for (long j = 0; j < img_blockColCount; j++) { + demR.get()[i * img_blockColCount + j] = 0; + } + } + } + h_data.x_mat = (double*)mallocCUDAHost(sizeof(double) * img_blockRowCount * img_blockColCount); // 鎴愬儚缃戞牸 h_data.y_mat = (double*)mallocCUDAHost(sizeof(double) * img_blockRowCount * img_blockColCount); diff --git a/Toolbox/SimulationSARTool/SimulationSARTool.cpp b/Toolbox/SimulationSARTool/SimulationSARTool.cpp index bee3038..d1afb96 100644 --- a/Toolbox/SimulationSARTool/SimulationSARTool.cpp +++ b/Toolbox/SimulationSARTool/SimulationSARTool.cpp @@ -9,6 +9,7 @@ #include "QtLinearToIntenisityDialog.h" #include "InitCreateImageXYZDialog.h" #include "ImagePlaneAtiInterpDialog.h" +#include "QCreateInSARImagePlaneXYZRDialog.h" SARSimlulationRFPCToolButton::SARSimlulationRFPCToolButton(QWidget* parent) @@ -80,6 +81,7 @@ void RegisterPreToolBox(LAMPMainWidget::RasterMainWidget* mainwindows, ToolBoxWi emit toolbox->addBoxToolItemSIGNAL(new QtLinearToIntenisityToolButton(toolbox)); emit toolbox->addBoxToolItemSIGNAL(new InitCreateImageXYZToolButton(toolbox)); emit toolbox->addBoxToolItemSIGNAL(new ImagePlaneAtiInterpToolButton(toolbox)); + emit toolbox->addBoxToolItemSIGNAL(new QCreateInSARImagePlaneXYZRToolButton(toolbox)); } @@ -181,3 +183,20 @@ void ImagePlaneAtiInterpToolButton::run() ImagePlaneAtiInterpDialog* dialog = new ImagePlaneAtiInterpDialog; dialog->show(); } + +QCreateInSARImagePlaneXYZRToolButton::QCreateInSARImagePlaneXYZRToolButton(QWidget* parent) +{ + this->toolPath = QVector(0); + this->toolPath.push_back(u8"成像工具库"); + this->toolname = QString(u8"1.创建InSAR成像平面"); +} + +QCreateInSARImagePlaneXYZRToolButton::~QCreateInSARImagePlaneXYZRToolButton() +{ +} + +void QCreateInSARImagePlaneXYZRToolButton::run() +{ + QCreateInSARImagePlaneXYZRDialog* dialog = new QCreateInSARImagePlaneXYZRDialog; + dialog->show(); +} diff --git a/Toolbox/SimulationSARTool/SimulationSARTool.h b/Toolbox/SimulationSARTool/SimulationSARTool.h index 1d356f2..61d9f4e 100644 --- a/Toolbox/SimulationSARTool/SimulationSARTool.h +++ b/Toolbox/SimulationSARTool/SimulationSARTool.h @@ -119,6 +119,17 @@ public: }; + +class SIMULATIONSARTOOL_EXPORT QCreateInSARImagePlaneXYZRToolButton : public QToolAbstract { + Q_OBJECT +public: + QCreateInSARImagePlaneXYZRToolButton(QWidget* parent = nullptr); + ~QCreateInSARImagePlaneXYZRToolButton(); +public: + virtual void run() override; + +}; + extern "C" SIMULATIONSARTOOL_EXPORT void RegisterPreToolBox(LAMPMainWidget::RasterMainWidget* mainwindows, ToolBoxWidget* toolbox); diff --git a/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj b/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj index 1562e03..105c02d 100644 --- a/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj +++ b/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj @@ -217,6 +217,7 @@ + @@ -245,6 +246,7 @@ + @@ -281,6 +283,7 @@ + diff --git a/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj.filters b/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj.filters index 6c8fd72..82c544b 100644 --- a/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj.filters +++ b/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj.filters @@ -80,7 +80,7 @@ SARImage - + SARImage @@ -145,6 +145,9 @@ SARImage + + SARImage + @@ -180,6 +183,9 @@ SARImage + + SARImage + @@ -215,6 +221,9 @@ SARImage + + Header Files + From 747c6399afb1d1a8ba145605563e3e684140013c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=A2=9E=E8=BE=89?= <3045316072@qq.com> Date: Mon, 7 Apr 2025 10:36:51 +0800 Subject: [PATCH 13/44] =?UTF-8?q?=E8=BE=93=E5=87=BA=E8=BD=A8=E9=81=93?= =?UTF-8?q?=E5=A4=9A=E9=A1=B9=E5=BC=8F=E6=A8=A1=E5=9E=8B=E7=9A=84=E7=B2=BE?= =?UTF-8?q?=E5=BA=A6=E4=B8=BA=2036=20=E4=B8=AA=E6=9C=89=E6=95=88=E6=95=B0?= =?UTF-8?q?=E5=AD=97=EF=BC=88=E5=B9=B6=E4=B8=8D=E6=84=8F=E5=91=B3=E5=AE=9E?= =?UTF-8?q?=E9=99=85=E7=B2=BE=E5=BA=A6=E8=83=BD=E5=88=B036=E4=B8=AA?= =?UTF-8?q?=E6=9C=89=E6=95=88=E6=95=B0=E5=AD=97=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SimulationSAR/SatelliteOribtModel.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Toolbox/SimulationSARTool/SimulationSAR/SatelliteOribtModel.cpp b/Toolbox/SimulationSARTool/SimulationSAR/SatelliteOribtModel.cpp index fb99f27..6ad68c4 100644 --- a/Toolbox/SimulationSARTool/SimulationSAR/SatelliteOribtModel.cpp +++ b/Toolbox/SimulationSARTool/SimulationSAR/SatelliteOribtModel.cpp @@ -467,12 +467,12 @@ void PolyfitSatelliteOribtModel::saveToXml(const QString& filePath) { // Write polyfit parameters xmlWriter.writeStartElement("PolyfitParameters"); - xmlWriter.writeAttribute("Pxchisq", QString::number(Pxchisq)); - xmlWriter.writeAttribute("Pychisq", QString::number(Pychisq)); - xmlWriter.writeAttribute("Pzchisq", QString::number(Pzchisq)); - xmlWriter.writeAttribute("Vxchisq", QString::number(Vxchisq)); - xmlWriter.writeAttribute("Vychisq", QString::number(Vychisq)); - xmlWriter.writeAttribute("Vzchisq", QString::number(Vzchisq)); + xmlWriter.writeAttribute("Pxchisq", QString::number(Pxchisq,'e',35)); + xmlWriter.writeAttribute("Pychisq", QString::number(Pychisq,'e',35)); + xmlWriter.writeAttribute("Pzchisq", QString::number(Pzchisq,'e',35)); + xmlWriter.writeAttribute("Vxchisq", QString::number(Vxchisq,'e',35)); + xmlWriter.writeAttribute("Vychisq", QString::number(Vychisq,'e',35)); + xmlWriter.writeAttribute("Vzchisq", QString::number(Vzchisq,'e',35)); writeVector(xmlWriter, "polyfitPx", polyfitPx); writeVector(xmlWriter, "polyfitPy", polyfitPy); @@ -491,7 +491,7 @@ void PolyfitSatelliteOribtModel::saveToXml(const QString& filePath) { void PolyfitSatelliteOribtModel::writeVector(QXmlStreamWriter& xmlWriter, const QString& name, const std::vector& vec) { xmlWriter.writeStartElement(name); for (double val : vec) { - xmlWriter.writeTextElement("Value", QString::number(val)); + xmlWriter.writeTextElement("Value", QString::number(val,'e',35)); } xmlWriter.writeEndElement(); } From 6e956d69723f43e8d1c1fb11efe04b2c8f4df69e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=A2=9E=E8=BE=89?= <3045316072@qq.com> Date: Mon, 7 Apr 2025 10:44:35 +0800 Subject: [PATCH 14/44] =?UTF-8?q?=E6=8B=86=E5=88=86=E8=BD=AF=E4=BB=B6?= =?UTF-8?q?=E5=B7=A5=E5=85=B7=E7=AE=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SimulationSARTool/SimulationSARTool.cpp | 23 ++++++++++++++++--- Toolbox/SimulationSARTool/SimulationSARTool.h | 12 ++++++++++ 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/Toolbox/SimulationSARTool/SimulationSARTool.cpp b/Toolbox/SimulationSARTool/SimulationSARTool.cpp index d1afb96..0ab1eca 100644 --- a/Toolbox/SimulationSARTool/SimulationSARTool.cpp +++ b/Toolbox/SimulationSARTool/SimulationSARTool.cpp @@ -82,7 +82,7 @@ void RegisterPreToolBox(LAMPMainWidget::RasterMainWidget* mainwindows, ToolBoxWi emit toolbox->addBoxToolItemSIGNAL(new InitCreateImageXYZToolButton(toolbox)); emit toolbox->addBoxToolItemSIGNAL(new ImagePlaneAtiInterpToolButton(toolbox)); emit toolbox->addBoxToolItemSIGNAL(new QCreateInSARImagePlaneXYZRToolButton(toolbox)); - + emit toolbox->addBoxToolItemSIGNAL(new QInSARBPImageToolButton(toolbox)); } LookTableComputerClassToolButton::LookTableComputerClassToolButton(QWidget* parent) @@ -187,8 +187,8 @@ void ImagePlaneAtiInterpToolButton::run() QCreateInSARImagePlaneXYZRToolButton::QCreateInSARImagePlaneXYZRToolButton(QWidget* parent) { this->toolPath = QVector(0); - this->toolPath.push_back(u8"成像工具库"); - this->toolname = QString(u8"1.创建InSAR成像平面"); + this->toolPath.push_back(u8"InSAR仿真工具库"); + this->toolname = QString(u8"1.创建InSAR地距成像平面"); } QCreateInSARImagePlaneXYZRToolButton::~QCreateInSARImagePlaneXYZRToolButton() @@ -200,3 +200,20 @@ void QCreateInSARImagePlaneXYZRToolButton::run() QCreateInSARImagePlaneXYZRDialog* dialog = new QCreateInSARImagePlaneXYZRDialog; dialog->show(); } + +QInSARBPImageToolButton::QInSARBPImageToolButton(QWidget* parent) +{ + this->toolPath = QVector(0); + this->toolPath.push_back(u8"InSAR仿真工具库"); + this->toolname = QString(u8"2.InSAR地距BP成像"); +} + +QInSARBPImageToolButton::~QInSARBPImageToolButton() +{ +} + +void QInSARBPImageToolButton::run() +{ + QSimulationBPImage* dialog = new QSimulationBPImage; + dialog->show(); +} diff --git a/Toolbox/SimulationSARTool/SimulationSARTool.h b/Toolbox/SimulationSARTool/SimulationSARTool.h index 61d9f4e..89c51dc 100644 --- a/Toolbox/SimulationSARTool/SimulationSARTool.h +++ b/Toolbox/SimulationSARTool/SimulationSARTool.h @@ -130,6 +130,18 @@ public: }; +class SIMULATIONSARTOOL_EXPORT QInSARBPImageToolButton : public QToolAbstract { + Q_OBJECT +public: + QInSARBPImageToolButton(QWidget* parent = nullptr); + ~QInSARBPImageToolButton(); +public: + virtual void run() override; + +}; + + + extern "C" SIMULATIONSARTOOL_EXPORT void RegisterPreToolBox(LAMPMainWidget::RasterMainWidget* mainwindows, ToolBoxWidget* toolbox); From 1d2c6dbd7257cc31a179cebe8e0fbc0637ee4eee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=A2=9E=E8=BE=89?= <3045316072@qq.com> Date: Mon, 7 Apr 2025 11:01:25 +0800 Subject: [PATCH 15/44] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=88=90=E5=83=8Fbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Toolbox/SimulationSARTool/SimulationSAR/TBPImageAlgCls.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Toolbox/SimulationSARTool/SimulationSAR/TBPImageAlgCls.cpp b/Toolbox/SimulationSARTool/SimulationSAR/TBPImageAlgCls.cpp index 50b4422..4766922 100644 --- a/Toolbox/SimulationSARTool/SimulationSAR/TBPImageAlgCls.cpp +++ b/Toolbox/SimulationSARTool/SimulationSAR/TBPImageAlgCls.cpp @@ -194,6 +194,8 @@ ErrorCode TBPImageAlgCls::ProcessGPU() h_data.x_mat = (double*)mallocCUDAHost(sizeof(double) * img_blockRowCount * img_blockColCount); // 鎴愬儚缃戞牸 h_data.y_mat = (double*)mallocCUDAHost(sizeof(double) * img_blockRowCount * img_blockColCount); h_data.z_mat = (double*)mallocCUDAHost(sizeof(double) * img_blockRowCount * img_blockColCount); + h_data.R_mat = (double*)mallocCUDAHost(sizeof(double) * img_blockRowCount * img_blockColCount); + h_data.nx = img_blockColCount; h_data.ny = img_blockRowCount; @@ -202,6 +204,7 @@ ErrorCode TBPImageAlgCls::ProcessGPU() h_data.x_mat[i * h_data.nx + j] = demX.get()[i * h_data.nx + j]; h_data.y_mat[i * h_data.nx + j] = demY.get()[i * h_data.nx + j]; h_data.z_mat[i * h_data.nx + j] = demZ.get()[i * h_data.nx + j]; + h_data.R_mat[i * h_data.nx + j] = demR.get()[i * h_data.nx + j]; } } From d125abf0d4c53a1614bd49b5937a6046dceda362 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=A2=9E=E8=BE=89?= <3045316072@qq.com> Date: Mon, 7 Apr 2025 11:51:47 +0800 Subject: [PATCH 16/44] =?UTF-8?q?=E4=BF=AE=E5=A4=8DInSARBPImage=E7=9A=84bu?= =?UTF-8?q?g?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SARImage/QCreateInSARImagePlaneXYZRDialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Toolbox/SimulationSARTool/SARImage/QCreateInSARImagePlaneXYZRDialog.cpp b/Toolbox/SimulationSARTool/SARImage/QCreateInSARImagePlaneXYZRDialog.cpp index 732557c..52338a7 100644 --- a/Toolbox/SimulationSARTool/SARImage/QCreateInSARImagePlaneXYZRDialog.cpp +++ b/Toolbox/SimulationSARTool/SARImage/QCreateInSARImagePlaneXYZRDialog.cpp @@ -204,7 +204,7 @@ void QCreateInSARImagePlaneXYZRDialog::LookTableSimulationDopplerProcess(QString qDebug() << "outLookTablePath\t" << outLookTablePath; gdalImage demimg(DEMPath); - gdalImage outLookTable = CreategdalImage( // 创建查找表 + gdalImage outLookTable = CreategdalImageDouble( // 创建查找表 outLookTablePath, demimg.height, demimg.width, 4, demimg.gt, From 99a2d7af0f118a36eafbe3335ce370a3cb034abc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=A2=9E=E8=BE=89?= <3045316072@qq.com> Date: Mon, 7 Apr 2025 15:22:53 +0800 Subject: [PATCH 17/44] =?UTF-8?q?=E6=88=90=E5=83=8F=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E6=A0=A1=E6=AD=A3=E5=9B=9E=E6=B3=A2=E9=9A=8F=E8=B7=9D=E7=A6=BB?= =?UTF-8?q?=E8=A1=B0=E5=87=8F=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Toolbox/SimulationSARTool/SARImage/ImageNetOperator.h | 2 -- .../SARImage/QCreateInSARImagePlaneXYZRDialog.cpp | 5 +++-- Toolbox/SimulationSARTool/SimulationSAR/BPBasic0_CUDA.cu | 5 +++++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.h b/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.h index 89b49e3..cafdfc8 100644 --- a/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.h +++ b/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.h @@ -14,6 +14,4 @@ bool GPSPointsNumberEqualCheck(QString& ImageLLPath, QString& InEchoGPSDataPath) void InterploateAtiByRefDEM(QString& ImageLLPath, QString& ImageDEMPath, QString& outImageLLAPath, QString& InEchoGPSDataPath); - - #endif diff --git a/Toolbox/SimulationSARTool/SARImage/QCreateInSARImagePlaneXYZRDialog.cpp b/Toolbox/SimulationSARTool/SARImage/QCreateInSARImagePlaneXYZRDialog.cpp index 52338a7..44f0859 100644 --- a/Toolbox/SimulationSARTool/SARImage/QCreateInSARImagePlaneXYZRDialog.cpp +++ b/Toolbox/SimulationSARTool/SARImage/QCreateInSARImagePlaneXYZRDialog.cpp @@ -349,8 +349,6 @@ void QCreateInSARImagePlaneXYZRDialog::LookTableSimulationDopplerProcess(QString Xp4, Yp4, Zp4, Xv4, Yv4, Zv4, Xp5, Yp5, Zp5, Xv5, Yv5, Zv5, dopplerRefrenceTime, r0, r1, r2, r3, r4); - - // GPU -> 内存 DeviceToHost(host_R.get(), device_R.get(), sizeof(double) * rowcount * demimg.width); qDebug() << "GPU computer finished!!: " << rid << "~" << rowcount + rid << "\t:" << demimg.height; @@ -383,3 +381,6 @@ void QCreateInSARImagePlaneXYZRDialog::onaccepted() QMessageBox::information(this, u8"info", u8"completed!!!"); } + + + diff --git a/Toolbox/SimulationSARTool/SimulationSAR/BPBasic0_CUDA.cu b/Toolbox/SimulationSARTool/SimulationSAR/BPBasic0_CUDA.cu index 761114b..4a83f7a 100644 --- a/Toolbox/SimulationSARTool/SimulationSAR/BPBasic0_CUDA.cu +++ b/Toolbox/SimulationSARTool/SimulationSAR/BPBasic0_CUDA.cu @@ -82,6 +82,7 @@ __global__ void processPulseKernel( //printf("processPulseKernel xmat !!\n"); double R = sqrt(dx * dx + dy * dy + dz * dz); + double ampcorrect = (powf(4 * LAMP_CUDA_PI, 2) * powf(R, 4)); double dR = R - R0; if (dR < r_start || dR >= (r_start + dr * (nR - 1))) return; @@ -107,6 +108,10 @@ __global__ void processPulseKernel( phCorr.x = rc_interp.x * cos_phase - rc_interp.y * sin_phase; phCorr.y = rc_interp.x * sin_phase + rc_interp.y * cos_phase; + // amp correction + phCorr.x = ampcorrect * phCorr.x; + phCorr.y = ampcorrect * phCorr.y; + // Accumulate im_final[idx].x += phCorr.x; im_final[idx].y += phCorr.y; From 6d31efe86813228d8a6b5d27c16809c7b5a754fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=A2=9E=E8=BE=89?= <3045316072@qq.com> Date: Mon, 7 Apr 2025 17:19:55 +0800 Subject: [PATCH 18/44] =?UTF-8?q?=E5=A2=9E=E5=8A=A0112=20~120=20=E4=BD=9C?= =?UTF-8?q?=E4=B8=BA2~=2010=20=20=E7=B1=B3=E8=BE=B9=E9=95=BF=E5=AE=9A?= =?UTF-8?q?=E6=A0=87=E5=99=A8=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SimulationSARTool/SimulationSAR/BPBasic0_CUDA.cu | 4 +--- .../SimulationSAR/RFPCProcessCls.cpp | 8 ++++++++ .../SimulationSARTool/SimulationSAR/SigmaDatabase.cpp | 11 +++++++++++ 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/Toolbox/SimulationSARTool/SimulationSAR/BPBasic0_CUDA.cu b/Toolbox/SimulationSARTool/SimulationSAR/BPBasic0_CUDA.cu index 4a83f7a..f88f3f7 100644 --- a/Toolbox/SimulationSARTool/SimulationSAR/BPBasic0_CUDA.cu +++ b/Toolbox/SimulationSARTool/SimulationSAR/BPBasic0_CUDA.cu @@ -116,9 +116,7 @@ __global__ void processPulseKernel( im_final[idx].x += phCorr.x; im_final[idx].y += phCorr.y; - - - + //printf("r_start=%e;dr=%e;nR=%d\n", r_start, dr, nR); //if (abs(phCorr.x) > 1e-100 || abs(phCorr.y > 1e-100)) { //printf( diff --git a/Toolbox/SimulationSARTool/SimulationSAR/RFPCProcessCls.cpp b/Toolbox/SimulationSARTool/SimulationSAR/RFPCProcessCls.cpp index 7001179..160d4b1 100644 --- a/Toolbox/SimulationSARTool/SimulationSAR/RFPCProcessCls.cpp +++ b/Toolbox/SimulationSARTool/SimulationSAR/RFPCProcessCls.cpp @@ -1133,6 +1133,14 @@ ErrorCode RFPCProcessCls::RFPCMainProcess_GPU_NoAntPattern(size_t startprfid, si size_t clscount = clsCountDict[clsid]; PRINT("Process Class ID : %d , Count: %d Device: %d , sigma Prams :[%f,%f,%f,%f,%f,%F]\n", clsid, clscount,devId, task.sigma0_cls.p1, task.sigma0_cls.p2, task.sigma0_cls.p3, task.sigma0_cls.p4, task.sigma0_cls.p5, task.sigma0_cls.p6); + if (abs(task.sigma0_cls.p1) < 1e-6 && + abs(task.sigma0_cls.p2) < 1e-6 && + abs(task.sigma0_cls.p3) < 1e-6 && + abs(task.sigma0_cls.p4) < 1e-6 && + abs(task.sigma0_cls.p5) < 1e-6 && + abs(task.sigma0_cls.p6) < 1e-6) { + continue; + } task.targetnum = clscount; task.goallist = (GoalState*)mallocCUDADevice(clscount * sizeof(GoalState), devId); HostToDevice(clsGoalStateDict[clsid].get(), task.goallist, sizeof(GoalState) * clscount); diff --git a/Toolbox/SimulationSARTool/SimulationSAR/SigmaDatabase.cpp b/Toolbox/SimulationSARTool/SimulationSAR/SigmaDatabase.cpp index 1ac11b5..366f977 100644 --- a/Toolbox/SimulationSARTool/SimulationSAR/SigmaDatabase.cpp +++ b/Toolbox/SimulationSARTool/SimulationSAR/SigmaDatabase.cpp @@ -30,6 +30,17 @@ SigmaDatabase::SigmaDatabase() this->VH_sigmaParam.insert(std::pair(0, SigmaParam{ 0,0,0, 0, 0,0 })); this->VV_sigmaParam.insert(std::pair(0, SigmaParam{ 0,0,0, 0, 0,0 })); + this->HH_sigmaParam.insert(std::pair(112, SigmaParam{ 30.5876,0,0, 0, 0,0 })); // L波段定标器 + this->HH_sigmaParam.insert(std::pair(113, SigmaParam{ 37.6313,0,0, 0, 0,0 })); // L波段定标器 + this->HH_sigmaParam.insert(std::pair(114, SigmaParam{ 42.6288,0,0, 0, 0,0 })); // L波段定标器 + this->HH_sigmaParam.insert(std::pair(115, SigmaParam{ 46.5052,0,0, 0, 0,0 })); // L波段定标器 + this->HH_sigmaParam.insert(std::pair(116, SigmaParam{ 49.6725,0,0, 0, 0,0 })); // L波段定标器 + this->HH_sigmaParam.insert(std::pair(117, SigmaParam{ 52.3504,0,0, 0, 0,0 })); // L波段定标器 + this->HH_sigmaParam.insert(std::pair(118, SigmaParam{ 54.67,0,0, 0, 0,0 })); // L波段定标器 + this->HH_sigmaParam.insert(std::pair(119, SigmaParam{ 56.7161,0,0, 0, 0,0 })); // L波段定标器 + this->HH_sigmaParam.insert(std::pair(120, SigmaParam{ 58.5464,0,0, 0, 0,0 })); // L波段定标器 + + this->HH_sigmaParam.insert(std::pair(10, SigmaParam{ -21.1019701821713, 9.00621457243906, 6.52932182540331, -1.11157376729893, -15.8022895411007, 11.4690828129602 })); this->HH_sigmaParam.insert(std::pair(20, SigmaParam{ -43.6677042155964, 32.0245140457417, 0.511060658303930, -2.68482232690106, 6.29783274559538, 1.96648609622833 })); this->HH_sigmaParam.insert(std::pair(40, SigmaParam{ 50.97, -62.9, -0.0968, 1.604, -4.637, 6.108 })); From e19d0390141e6e50dd512fb4cbe29b4fd67cb32a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=A2=9E=E8=BE=89?= <3045316072@qq.com> Date: Mon, 7 Apr 2025 21:46:53 +0800 Subject: [PATCH 19/44] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=86=20WGS84=20?= =?UTF-8?q?=E5=88=B0=E6=96=9C=E8=B7=9D=E5=B9=B3=E9=9D=A2=E6=9F=A5=E6=89=BE?= =?UTF-8?q?=E8=A1=A8=E7=BB=93=E6=9E=9C=E5=8F=8D=E5=90=91=E6=98=A0=E5=B0=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BaseTool/BaseConstVariable.h | 8 + .../QLookTableResampleFromWGS84ToRange.cpp | 97 +++++++++ .../QLookTableResampleFromWGS84ToRange.h | 30 +++ .../QLookTableResampleFromWGS84ToRange.ui | 201 ++++++++++++++++++ .../SARImage/ImageNetOperator.cpp | 172 +++++++++++++++ .../SARImage/ImageNetOperator.h | 2 +- .../SimulationSAR/QEcoherentAndAdditive.cpp | 74 +++++++ .../SimulationSAR/QEcoherentAndAdditive.h | 29 +++ .../SimulationSAR/QEcoherentAndAdditive.ui | 126 +++++++++++ .../SimulationSARTool.vcxproj | 6 + .../SimulationSARTool.vcxproj.filters | 30 ++- 11 files changed, 768 insertions(+), 7 deletions(-) create mode 100644 Toolbox/SimulationSARTool/PowerSimulationIncoherent/QLookTableResampleFromWGS84ToRange.cpp create mode 100644 Toolbox/SimulationSARTool/PowerSimulationIncoherent/QLookTableResampleFromWGS84ToRange.h create mode 100644 Toolbox/SimulationSARTool/PowerSimulationIncoherent/QLookTableResampleFromWGS84ToRange.ui create mode 100644 Toolbox/SimulationSARTool/SimulationSAR/QEcoherentAndAdditive.cpp create mode 100644 Toolbox/SimulationSARTool/SimulationSAR/QEcoherentAndAdditive.h create mode 100644 Toolbox/SimulationSARTool/SimulationSAR/QEcoherentAndAdditive.ui diff --git a/BaseCommonLibrary/BaseTool/BaseConstVariable.h b/BaseCommonLibrary/BaseTool/BaseConstVariable.h index 9c16a9d..67114db 100644 --- a/BaseCommonLibrary/BaseTool/BaseConstVariable.h +++ b/BaseCommonLibrary/BaseTool/BaseConstVariable.h @@ -139,6 +139,14 @@ struct Point3 { void setZ(double iz) { z = iz; } }; +struct Point_3d { + double x; + double y; + double z; +}; + + + struct DemBox { double min_lon; double max_lon; diff --git a/Toolbox/SimulationSARTool/PowerSimulationIncoherent/QLookTableResampleFromWGS84ToRange.cpp b/Toolbox/SimulationSARTool/PowerSimulationIncoherent/QLookTableResampleFromWGS84ToRange.cpp new file mode 100644 index 0000000..ce63880 --- /dev/null +++ b/Toolbox/SimulationSARTool/PowerSimulationIncoherent/QLookTableResampleFromWGS84ToRange.cpp @@ -0,0 +1,97 @@ +#include "QLookTableResampleFromWGS84ToRange.h" +#include "BaseConstVariable.h" +#include "BaseTool.h" +#include +#include +#include "ui_QLookTableResampleFromWGS84ToRange.h" +#include "ImageNetOperator.h" + +QLookTableResampleFromWGS84ToRange::QLookTableResampleFromWGS84ToRange(QWidget *parent) + : QDialog(parent) + ,ui(new Ui::QLookTableResampleFromWGS84ToRangeClass) +{ + ui->setupUi(this); + + connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(onaccepted())); + connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(onrejected())); + connect(ui->pushButtonLookTableWGS84Select, SIGNAL(clicked(bool)), this, SLOT(onpushButtonLookTableWGS84SelectClicked(bool))); + connect(ui->pushButtonLookTableRangeSelect, SIGNAL(clicked(bool)), this, SLOT(onpushButtonLookTableRangeSelectClicked(bool))); + connect(ui->pushButtonLookTableCountSelect, SIGNAL(clicked(bool)), this, SLOT(onpushButtonLookTableCountSelectClicked(bool))); + + +} + +QLookTableResampleFromWGS84ToRange::~QLookTableResampleFromWGS84ToRange() +{} + +void QLookTableResampleFromWGS84ToRange::onaccepted() +{ + QString looktableWGS84Ptah = ui->lineEditLookTableWGS84Path->text(); + QString looktableRangePtah = ui->lineEditLookTableRangePath->text(); + QString looktableCountPtah = ui->lineEditLookTableCountPath->text(); + + long Oriheight = ui->spinBoxRowCount->value(); + long OriWidth = ui->spinBoxColCount->value(); + + ReflectTable_WGS2Range(looktableWGS84Ptah, looktableRangePtah, looktableCountPtah, Oriheight, OriWidth); + QMessageBox::information(nullptr, u8"提示", u8"完成"); +} + +void QLookTableResampleFromWGS84ToRange::onrejected() +{ + this->close(); +} + +void QLookTableResampleFromWGS84ToRange::onpushButtonLookTableWGS84SelectClicked(bool) +{ + QString fileNames = QFileDialog::getOpenFileName( + this, + tr(u8"选择成像粗平面文件"), + QString(), + tr(ENVI_FILE_FORMAT_FILTER) + ); + + if (!fileNames.isEmpty()) { + QString message = "选中文件\n"; + this->ui->lineEditLookTableWGS84Path->setText(fileNames); + } + else { + QMessageBox::information(this, tr(u8"提示"), tr(u8"没有选中文件")); + } +} + +void QLookTableResampleFromWGS84ToRange::onpushButtonLookTableRangeSelectClicked(bool) +{ + QString fileNames = QFileDialog::getOpenFileName( + this, + tr(u8"选择成像粗平面文件"), + QString(), + tr(ENVI_FILE_FORMAT_FILTER) + ); + + if (!fileNames.isEmpty()) { + QString message = "选中文件\n"; + this->ui->lineEditLookTableRangePath->setText(fileNames); + } + else { + QMessageBox::information(this, tr(u8"提示"), tr(u8"没有选中文件")); + } +} + +void QLookTableResampleFromWGS84ToRange::onpushButtonLookTableCountSelectClicked(bool) +{ + QString fileNames = QFileDialog::getOpenFileName( + this, + tr(u8"选择成像粗平面文件"), + QString(), + tr(ENVI_FILE_FORMAT_FILTER) + ); + + if (!fileNames.isEmpty()) { + QString message = "选中文件\n"; + this->ui->lineEditLookTableCountPath->setText(fileNames); + } + else { + QMessageBox::information(this, tr(u8"提示"), tr(u8"没有选中文件")); + } +} diff --git a/Toolbox/SimulationSARTool/PowerSimulationIncoherent/QLookTableResampleFromWGS84ToRange.h b/Toolbox/SimulationSARTool/PowerSimulationIncoherent/QLookTableResampleFromWGS84ToRange.h new file mode 100644 index 0000000..6f90bf2 --- /dev/null +++ b/Toolbox/SimulationSARTool/PowerSimulationIncoherent/QLookTableResampleFromWGS84ToRange.h @@ -0,0 +1,30 @@ +#pragma once + +#include + + +namespace Ui { + class QLookTableResampleFromWGS84ToRangeClass; +} + +class QLookTableResampleFromWGS84ToRange : public QDialog +{ + Q_OBJECT + +public: + QLookTableResampleFromWGS84ToRange(QWidget *parent = nullptr); + ~QLookTableResampleFromWGS84ToRange(); + + +public slots: + + void onaccepted(); + void onrejected(); + void onpushButtonLookTableWGS84SelectClicked(bool); + void onpushButtonLookTableRangeSelectClicked(bool); + void onpushButtonLookTableCountSelectClicked(bool); + + +private: + Ui::QLookTableResampleFromWGS84ToRangeClass* ui; +}; diff --git a/Toolbox/SimulationSARTool/PowerSimulationIncoherent/QLookTableResampleFromWGS84ToRange.ui b/Toolbox/SimulationSARTool/PowerSimulationIncoherent/QLookTableResampleFromWGS84ToRange.ui new file mode 100644 index 0000000..42e6ae2 --- /dev/null +++ b/Toolbox/SimulationSARTool/PowerSimulationIncoherent/QLookTableResampleFromWGS84ToRange.ui @@ -0,0 +1,201 @@ + + + QLookTableResampleFromWGS84ToRangeClass + + + + 0 + 0 + 747 + 293 + + + + QLookTableResampleFromWGS84ToRange + + + + + + + 0 + 30 + + + + + + + + + 0 + 30 + + + + + + + + + + + + 0 + 30 + + + + 閫夋嫨 + + + + + + + + 0 + 30 + + + + 琛屾暟 + + + + + + + + 0 + 30 + + + + 鏌ユ壘琛紙鏂滆窛锛 + + + + + + + + 0 + 30 + + + + 閫夋嫨 + + + + + + + + 0 + 30 + + + + 鏌ユ壘琛紙WGS84) + + + + + + + + 0 + 30 + + + + 鏌ユ壘琛ㄩ噰鏍风偣鏁 + + + + + + + + 0 + 30 + + + + 閫夋嫨 + + + + + + + + 0 + 30 + + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + 0 + 30 + + + + + + + + + + + + 0 + 30 + + + + 鍒楁暟 + + + + + + + + 0 + 30 + + + + 999999999 + + + + + + + + 0 + 30 + + + + 999999999 + + + + + + + + + diff --git a/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.cpp b/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.cpp index 8aa33c1..2529380 100644 --- a/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.cpp +++ b/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.cpp @@ -6,6 +6,7 @@ #include "GPUBaseTool.h" #include "GPUBPImageNet.cuh" #include "BaseTool.h" +#include "BaseConstVariable.h" void InitCreateImageXYZProcess(QString& outImageLLPath, QString& outImageXYZPath, QString& InEchoGPSDataPath, @@ -251,6 +252,8 @@ bool GPSPointsNumberEqualCheck(QString& ImageLLPath, QString& InEchoGPSDataPath) } + + void InterploateAtiByRefDEM(QString& ImageLLPath, QString& ImageDEMPath, QString& outImageLLAPath, QString& InEchoGPSDataPath) { gdalImage demimg(ImageDEMPath); @@ -404,3 +407,172 @@ void InterploateAtiByRefDEM(QString& ImageLLPath, QString& ImageDEMPath, QString qDebug() << u8"插值完成"; } + + + +int ReflectTable_WGS2Range(QString dem_rc_path,QString outOriSimTiffPath,QString ori_sim_count_tiffPath,long OriHeight,long OriWidth) +{ + gdalImage sim_rc(dem_rc_path); + gdalImage sim_sar_img = CreategdalImage(outOriSimTiffPath, OriHeight, OriWidth, 2, sim_rc.gt, sim_rc.projection, false);// 注意这里保留仿真结果 + gdalImage sim_sar_count_img = CreategdalImage(ori_sim_count_tiffPath, OriHeight, OriWidth, 1, sim_rc.gt, sim_rc.projection, false);// 注意这里保留仿真结果 + for (int max_rows_ids = 0; max_rows_ids < OriHeight; max_rows_ids = max_rows_ids + 1000) { + Eigen::MatrixXd sim_sar = sim_sar_img.getData(max_rows_ids, 0, 1000, OriWidth, 1); + Eigen::MatrixXd sim_sarc = sim_sar_img.getData(max_rows_ids, 0, 1000, OriWidth, 2); + Eigen::MatrixXd sim_sar_count = sim_sar_count_img.getData(max_rows_ids, 0, 1000, OriWidth, 1); + sim_sar = sim_sar.array() * 0 - 9999; + sim_sarc = sim_sar.array() * 0 - 9999; + sim_sar_count = sim_sar_count.array() * 0; + sim_sar_img.saveImage(sim_sar, max_rows_ids, 0, 1); + sim_sar_img.saveImage(sim_sarc, max_rows_ids, 0, 2); + sim_sar_count_img.saveImage(sim_sar_count, max_rows_ids, 0, 1); + } + sim_sar_img.setNoDataValue(-9999, 1); + sim_sar_img.setNoDataValue(-9999, 2); + int conver_lines = 5000; + int line_invert = 4000;// 计算重叠率 + int line_offset = 60; + // 逐区域迭代计算 + omp_lock_t lock; + omp_init_lock(&lock); // 初始化互斥锁 + int allCount = 0; + + for (int max_rows_ids = 0; max_rows_ids < sim_rc.height; max_rows_ids = max_rows_ids + line_invert) { + Eigen::MatrixXd dem_r = sim_rc.getData(max_rows_ids, 0, conver_lines, sim_rc.width, 1); + Eigen::MatrixXd dem_c = sim_rc.getData(max_rows_ids, 0, conver_lines, sim_rc.width, 2); + int dem_rows_num = dem_r.rows(); + int dem_cols_num = dem_r.cols(); + // 更新插值经纬度 + //Eigen::MatrixXd dem_lon = dem_r; + //Eigen::MatrixXd dem_lat = dem_c; + // 构建索引 更新经纬度并更新链 + + int temp_r, temp_c; + + int min_row = dem_r.minCoeff() + 1; + int max_row = dem_r.maxCoeff() + 1; + + if (max_row < 0) { + continue; + } + + int len_rows = max_row - min_row; + min_row = min_row < 0 ? 0 : min_row; + Eigen::MatrixXd sar_r = sim_sar_img.getData(min_row, 0, len_rows, OriWidth, 1); + Eigen::MatrixXd sar_c = sim_sar_img.getData(min_row, 0, len_rows, OriWidth, 2); + len_rows = sar_r.rows(); + + +#pragma omp parallel for num_threads(8) // NEW ADD + for (int i = 0; i < dem_rows_num - 1; i++) { + for (int j = 0; j < dem_cols_num - 1; j++) { + Point3 p, p1, p2, p3, p4; + Landpoint lp1, lp2, lp3, lp4; + lp1 = sim_rc.getLandPoint(i + max_rows_ids, j, 0); + lp2 = sim_rc.getLandPoint(i + max_rows_ids, j + 1, 0); + lp3 = sim_rc.getLandPoint(i + 1 + max_rows_ids, j + 1, 0); + lp4 = sim_rc.getLandPoint(i + 1 + max_rows_ids, j, 0); + + p1 = { dem_r(i,j),dem_c(i,j) }; + p2 = { dem_r(i,j + 1),dem_c(i,j + 1) }; + p3 = { dem_r(i + 1,j + 1),dem_c(i + 1,j + 1) }; + p4 = { dem_r(i + 1,j),dem_c(i + 1,j) }; + + //if (angle(i, j) >= 90 && angle(i, j + 1) >= 90 && angle(i + 1, j) >= 90 && angle(i + 1, j + 1) >= 90) { + // continue; + //} + + double temp_min_r = dem_r.block(i, j, 2, 2).minCoeff(); + double temp_max_r = dem_r.block(i, j, 2, 2).maxCoeff(); + double temp_min_c = dem_c.block(i, j, 2, 2).minCoeff(); + double temp_max_c = dem_c.block(i, j, 2, 2).maxCoeff(); + if ((int(temp_min_r) != int(temp_max_r)) && (int(temp_min_c) != int(temp_max_c))) { + for (int ii = int(temp_min_r); ii <= temp_max_r + 1; ii++) { + for (int jj = int(temp_min_c); jj < temp_max_c + 1; jj++) { + if (ii < min_row || ii - min_row >= len_rows || jj < 0 || jj >= OriWidth) { + continue; + } + p = { double(ii),double(jj),0 }; + //if (PtInRect(p, p1, p2, p3, p4)) { + p1.z = lp1.lon; + p2.z = lp2.lon; + p3.z = lp3.lon; + p4.z = lp4.lon; + + p = invBilinear(p, p1, p2, p3, p4); + if (isnan(p.z)) { + continue; + } + + if (p.x < 0) { + continue; + } + double mean = (p1.z + p2.z + p3.z + p4.z) / 4; + if (p.z > p1.z && p.z > p2.z && p.z > p3.z && p.z > p4.z) { + p.z = mean; + } + if (p.z < p1.z && p.z < p2.z && p.z < p3.z && p.z < p4.z) { + p.z = mean; + } + sar_r(ii - min_row, jj) = p.z; + p1.z = lp1.lat; + p2.z = lp2.lat; + p3.z = lp3.lat; + p4.z = lp4.lat; + p = invBilinear(p, p1, p2, p3, p4); + if (isnan(p.z)) { + continue; + } + + if (p.x < 0) { + continue; + } + mean = (p1.z + p2.z + p3.z + p4.z) / 4; + if (p.z > p1.z && p.z > p2.z && p.z > p3.z && p.z > p4.z) { + p.z = mean; + } + if (p.z < p1.z && p.z < p2.z && p.z < p3.z && p.z < p4.z) { + p.z = mean; + } + sar_c(ii - min_row, jj) = p.z; + //} + } + } + + } + } + } + + omp_set_lock(&lock); //获得互斥器 + sim_sar_img.saveImage(sar_r, min_row, 0, 1); + sim_sar_img.saveImage(sar_c, min_row, 0, 2); + allCount = allCount + conver_lines; + qDebug() << "rows:\t" << allCount << "/" << sim_rc.height << "\t computing.....\t" ; + omp_unset_lock(&lock); //释放互斥器 + + + } + + qDebug() << "\t resample computing.....\t"; + { + int conver = 5000; + int line_invert = 4000;// 计算重叠率 + + ResampleGDALs(ori_sim_count_tiffPath.toUtf8().constData(), 1, GRIORA_Bilinear); + ResampleGDALs(ori_sim_count_tiffPath.toUtf8().constData(), 2, GRIORA_Bilinear); + } + + return 0; +} + + + + + + + + + + + + + diff --git a/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.h b/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.h index cafdfc8..a18718a 100644 --- a/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.h +++ b/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.h @@ -13,5 +13,5 @@ bool GPSPointsNumberEqualCheck(QString& ImageLLPath, QString& InEchoGPSDataPath) void InterploateAtiByRefDEM(QString& ImageLLPath, QString& ImageDEMPath, QString& outImageLLAPath, QString& InEchoGPSDataPath); - +int ReflectTable_WGS2Range(QString dem_rc_path, QString outOriSimTiffPath, QString ori_sim_count_tiffPath, long OriHeight, long OriWidth); #endif diff --git a/Toolbox/SimulationSARTool/SimulationSAR/QEcoherentAndAdditive.cpp b/Toolbox/SimulationSARTool/SimulationSAR/QEcoherentAndAdditive.cpp new file mode 100644 index 0000000..a0a1d66 --- /dev/null +++ b/Toolbox/SimulationSARTool/SimulationSAR/QEcoherentAndAdditive.cpp @@ -0,0 +1,74 @@ +#include "QEcoherentAndAdditive.h" +#include "ui_QEcoherentAndAdditive.h" +#include +#include + + +QEcoherentAndAdditiveDialog::QEcoherentAndAdditiveDialog(QWidget *parent) + : QDialog(parent) + ,ui(new Ui::QEcoherentAndAdditiveClass) +{ + ui->setupUi(this); + + QObject::connect(ui->pushButtonEchoDataAddSelect, SIGNAL(clicked()), this, SLOT(onpushButtonEchoDataAddSelectClicked())); + QObject::connect(ui->pushButtonEchoDataSelect, SIGNAL(clicked()), this, SLOT(onpushButtonEchoDataSelectClicked())); + QObject::connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(onaccepted())); + QObject::connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(onrejected())); + } + +QEcoherentAndAdditiveDialog::~QEcoherentAndAdditiveDialog() +{} + +void QEcoherentAndAdditiveDialog::onpushButtonEchoDataAddSelectClicked() +{ + QString fileNames = QFileDialog::getOpenFileName( + this, // 父窗口 + tr(u8"选择影像文件"), // 标题 + QString(), // 默认路径 + tr(u8"xml Files (*.xml);;All Files (*)") // 文件过滤器 + ); + + // 如果用户选择了文件 + if (!fileNames.isEmpty()) { + QString message = "选择的文件有:\n"; + this->ui->lineEditEchoDataAddPath->setText(fileNames); + } + else { + QMessageBox::information(this, tr(u8"没有选择文件"), tr(u8"没有选择任何文件。")); + } +} + +void QEcoherentAndAdditiveDialog::onpushButtonEchoDataSelectClicked() +{ + QString fileNames = QFileDialog::getOpenFileName( + this, // 父窗口 + tr(u8"选择影像文件"), // 标题 + QString(), // 默认路径 + tr(u8"xml Files (*.xml);;All Files (*)") // 文件过滤器 + ); + + // 如果用户选择了文件 + if (!fileNames.isEmpty()) { + QString message = "选择的文件有:\n"; + this->ui->lineEditEchoDataAdd2Path->setText(fileNames); + } + else { + QMessageBox::information(this, tr(u8"没有选择文件"), tr(u8"没有选择任何文件。")); + } +} + +void QEcoherentAndAdditiveDialog::onaccepted() +{ + QString echo1Path = this->ui->lineEditEchoDataAddPath->text(); + QString echo2Path = this->ui->lineEditEchoDataAdd2Path->text(); + + + + + + QMessageBox::information(this, tr(u8"提示"), tr(u8"完成")); +} + +void QEcoherentAndAdditiveDialog::onrejected() +{ +} diff --git a/Toolbox/SimulationSARTool/SimulationSAR/QEcoherentAndAdditive.h b/Toolbox/SimulationSARTool/SimulationSAR/QEcoherentAndAdditive.h new file mode 100644 index 0000000..4b53e85 --- /dev/null +++ b/Toolbox/SimulationSARTool/SimulationSAR/QEcoherentAndAdditive.h @@ -0,0 +1,29 @@ +#pragma once + +#include +#include + + +namespace Ui { + class QEcoherentAndAdditiveClass; +} + +class QEcoherentAndAdditiveDialog : public QDialog +{ + Q_OBJECT + +public: + QEcoherentAndAdditiveDialog(QWidget *parent = nullptr); + ~QEcoherentAndAdditiveDialog(); + + +public slots: + + void onpushButtonEchoDataAddSelectClicked(); + void onpushButtonEchoDataSelectClicked(); + void onaccepted(); + void onrejected(); + +private: + Ui::QEcoherentAndAdditiveClass* ui; +}; diff --git a/Toolbox/SimulationSARTool/SimulationSAR/QEcoherentAndAdditive.ui b/Toolbox/SimulationSARTool/SimulationSAR/QEcoherentAndAdditive.ui new file mode 100644 index 0000000..bf67d40 --- /dev/null +++ b/Toolbox/SimulationSARTool/SimulationSAR/QEcoherentAndAdditive.ui @@ -0,0 +1,126 @@ + + + QEcoherentAndAdditiveClass + + + + 0 + 0 + 747 + 239 + + + + 浠跨湡鍥炴尝鍙犲姞 + + + + + + + + + + 0 + 30 + + + + + + + + + 0 + 30 + + + + 甯﹀彔鍔犲洖娉細 + + + + + + + + 0 + 30 + + + + 閫夋嫨 + + + + + + + + 0 + 30 + + + + 閫夋嫨 + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + 0 + 30 + + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + 0 + 30 + + + + 琚彔鍔犲洖娉 + + + + + + + + 0 + 30 + + + + + + + + + + + + + diff --git a/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj b/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj index 105c02d..0e39cf3 100644 --- a/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj +++ b/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj @@ -210,6 +210,7 @@ + @@ -218,6 +219,7 @@ + @@ -243,6 +245,7 @@ + @@ -258,6 +261,7 @@ + @@ -277,6 +281,7 @@ + @@ -284,6 +289,7 @@ + diff --git a/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj.filters b/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj.filters index 82c544b..88f0bab 100644 --- a/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj.filters +++ b/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj.filters @@ -13,10 +13,6 @@ {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} qrc;rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - {99349809-55BA-4b9d-BF79-8FDBB0286EB3} - ui - {639EADAA-A684-42e4-A9AD-28FC9BCB8F7C} ts @@ -30,6 +26,10 @@ {3380934c-6b95-45eb-8d70-d8b58e0e9de3} + + {99349809-55BA-4b9d-BF79-8FDBB0286EB3} + ui + @@ -80,8 +80,8 @@ SARImage - - SARImage + + PowerSimulationIncoherent @@ -148,6 +148,12 @@ SARImage + + SimulationSAR + + + PowerSimulationIncoherent + @@ -186,6 +192,12 @@ SARImage + + SimulationSAR + + + PowerSimulationIncoherent + @@ -224,6 +236,12 @@ Header Files + + Header Files + + + Header Files + From 357cf2ec6670b2a9a361ed9674c773fcb915c5de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=A2=9E=E8=BE=89?= <3045316072@qq.com> Date: Mon, 7 Apr 2025 23:15:18 +0800 Subject: [PATCH 20/44] =?UTF-8?q?=E4=BB=BF=E7=9C=9F=E5=9B=BE=E5=83=8F?= =?UTF-8?q?=E9=87=87=E6=A0=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../QLookTableResampleFromWGS84ToRange.cpp | 10 +-- .../SARImage/ImageNetOperator.cpp | 20 ++--- .../SARImage/ImagePlaneAtiInterpDialog.cpp | 6 +- .../SARImage/ImagePlaneAtiInterpDialog.ui | 89 +++++++++++-------- .../SimulationSARTool/SimulationSARTool.cpp | 19 ++++ Toolbox/SimulationSARTool/SimulationSARTool.h | 8 ++ 6 files changed, 94 insertions(+), 58 deletions(-) diff --git a/Toolbox/SimulationSARTool/PowerSimulationIncoherent/QLookTableResampleFromWGS84ToRange.cpp b/Toolbox/SimulationSARTool/PowerSimulationIncoherent/QLookTableResampleFromWGS84ToRange.cpp index ce63880..981ee1f 100644 --- a/Toolbox/SimulationSARTool/PowerSimulationIncoherent/QLookTableResampleFromWGS84ToRange.cpp +++ b/Toolbox/SimulationSARTool/PowerSimulationIncoherent/QLookTableResampleFromWGS84ToRange.cpp @@ -46,7 +46,7 @@ void QLookTableResampleFromWGS84ToRange::onpushButtonLookTableWGS84SelectClicked { QString fileNames = QFileDialog::getOpenFileName( this, - tr(u8"选择成像粗平面文件"), + tr(u8"选择WGS84文件"), QString(), tr(ENVI_FILE_FORMAT_FILTER) ); @@ -62,9 +62,9 @@ void QLookTableResampleFromWGS84ToRange::onpushButtonLookTableWGS84SelectClicked void QLookTableResampleFromWGS84ToRange::onpushButtonLookTableRangeSelectClicked(bool) { - QString fileNames = QFileDialog::getOpenFileName( + QString fileNames = QFileDialog::getSaveFileName( this, - tr(u8"选择成像粗平面文件"), + tr(u8"保存斜距平面文件"), QString(), tr(ENVI_FILE_FORMAT_FILTER) ); @@ -80,9 +80,9 @@ void QLookTableResampleFromWGS84ToRange::onpushButtonLookTableRangeSelectClicked void QLookTableResampleFromWGS84ToRange::onpushButtonLookTableCountSelectClicked(bool) { - QString fileNames = QFileDialog::getOpenFileName( + QString fileNames = QFileDialog::getSaveFileName( this, - tr(u8"选择成像粗平面文件"), + tr(u8"保存统计采样平面文件"), QString(), tr(ENVI_FILE_FORMAT_FILTER) ); diff --git a/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.cpp b/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.cpp index 2529380..698a017 100644 --- a/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.cpp +++ b/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.cpp @@ -293,7 +293,14 @@ void InterploateAtiByRefDEM(QString& ImageLLPath, QString& ImageDEMPath, QString double lon = imglonArr(i, j); double lat = imglatArr(i, j); Landpoint point = demimg.getRow_Col(lon, lat); + + if (point.lon<1 || point.lon>demimg.width - 2 || point.lat < 1 || point.lat - 2) { + continue; + } + else {} + Landpoint p0, p11, p21, p12, p22; + p0.lon = point.lon; p0.lat = point.lat; @@ -414,17 +421,13 @@ int ReflectTable_WGS2Range(QString dem_rc_path,QString outOriSimTiffPath,QStrin { gdalImage sim_rc(dem_rc_path); gdalImage sim_sar_img = CreategdalImage(outOriSimTiffPath, OriHeight, OriWidth, 2, sim_rc.gt, sim_rc.projection, false);// 注意这里保留仿真结果 - gdalImage sim_sar_count_img = CreategdalImage(ori_sim_count_tiffPath, OriHeight, OriWidth, 1, sim_rc.gt, sim_rc.projection, false);// 注意这里保留仿真结果 for (int max_rows_ids = 0; max_rows_ids < OriHeight; max_rows_ids = max_rows_ids + 1000) { Eigen::MatrixXd sim_sar = sim_sar_img.getData(max_rows_ids, 0, 1000, OriWidth, 1); Eigen::MatrixXd sim_sarc = sim_sar_img.getData(max_rows_ids, 0, 1000, OriWidth, 2); - Eigen::MatrixXd sim_sar_count = sim_sar_count_img.getData(max_rows_ids, 0, 1000, OriWidth, 1); sim_sar = sim_sar.array() * 0 - 9999; sim_sarc = sim_sar.array() * 0 - 9999; - sim_sar_count = sim_sar_count.array() * 0; sim_sar_img.saveImage(sim_sar, max_rows_ids, 0, 1); sim_sar_img.saveImage(sim_sarc, max_rows_ids, 0, 2); - sim_sar_count_img.saveImage(sim_sar_count, max_rows_ids, 0, 1); } sim_sar_img.setNoDataValue(-9999, 1); sim_sar_img.setNoDataValue(-9999, 2); @@ -552,15 +555,6 @@ int ReflectTable_WGS2Range(QString dem_rc_path,QString outOriSimTiffPath,QStrin } - qDebug() << "\t resample computing.....\t"; - { - int conver = 5000; - int line_invert = 4000;// 计算重叠率 - - ResampleGDALs(ori_sim_count_tiffPath.toUtf8().constData(), 1, GRIORA_Bilinear); - ResampleGDALs(ori_sim_count_tiffPath.toUtf8().constData(), 2, GRIORA_Bilinear); - } - return 0; } diff --git a/Toolbox/SimulationSARTool/SARImage/ImagePlaneAtiInterpDialog.cpp b/Toolbox/SimulationSARTool/SARImage/ImagePlaneAtiInterpDialog.cpp index 54c7de1..e4ec753 100644 --- a/Toolbox/SimulationSARTool/SARImage/ImagePlaneAtiInterpDialog.cpp +++ b/Toolbox/SimulationSARTool/SARImage/ImagePlaneAtiInterpDialog.cpp @@ -2,6 +2,7 @@ #include "ui_ImagePlaneAtiInterpDialog.h" #include #include +#include #include "BaseConstVariable.h" #include "ImageNetOperator.h" @@ -116,9 +117,10 @@ void ImagePlaneAtiInterpDialog::onbuttonBoxAccepted() QMessageBox::warning(nullptr, u8"警告", u8"回波GPS坐标点数目不一致"); return; } + + bool checkflag= this->ui->checkBoxOverLap->isChecked(); - - if (OverlapCheck(imageNet0Path, refRangeDEMPath)) { // ????DEM??? + if (checkflag || OverlapCheck(imageNet0Path, refRangeDEMPath)) { // ????DEM??? InterploateAtiByRefDEM(imageNet0Path, refRangeDEMPath, imageLLAPath,echoGPSDataPath); QMessageBox::information(nullptr, u8"提示", u8"completed!!"); diff --git a/Toolbox/SimulationSARTool/SARImage/ImagePlaneAtiInterpDialog.ui b/Toolbox/SimulationSARTool/SARImage/ImagePlaneAtiInterpDialog.ui index fa3a5f2..db72143 100644 --- a/Toolbox/SimulationSARTool/SARImage/ImagePlaneAtiInterpDialog.ui +++ b/Toolbox/SimulationSARTool/SARImage/ImagePlaneAtiInterpDialog.ui @@ -7,15 +7,28 @@ 0 0 661 - 266 + 305 鏍规嵁缁忕含搴︽彃鍊奸珮绋嬫暟鎹 - - + + + + + 0 + 30 + + + + 鎴愬儚缃戞牸锛堢粡绾害锛夛細 + + + + + 0 @@ -27,6 +40,19 @@ + + + + + 0 + 30 + + + + 鍥炴尝GPS鐐 + + + @@ -40,8 +66,8 @@ - - + + 0 @@ -49,7 +75,7 @@ - + 閫夋嫨 @@ -66,7 +92,7 @@ - + @@ -79,8 +105,8 @@ - - + + 0 @@ -88,12 +114,22 @@ - 鎴愬儚缃戞牸锛堢粡绾害锛夛細 + - - + + + + + 0 + 30 + + + + + + 0 @@ -144,8 +180,8 @@ - - + + 0 @@ -153,30 +189,7 @@ - 鍥炴尝GPS鐐 - - - - - - - - 0 - 30 - - - - - - - - - 0 - 30 - - - - 閫夋嫨 + 寮哄埗閲囨牱 diff --git a/Toolbox/SimulationSARTool/SimulationSARTool.cpp b/Toolbox/SimulationSARTool/SimulationSARTool.cpp index 0ab1eca..bf4d73d 100644 --- a/Toolbox/SimulationSARTool/SimulationSARTool.cpp +++ b/Toolbox/SimulationSARTool/SimulationSARTool.cpp @@ -10,6 +10,7 @@ #include "InitCreateImageXYZDialog.h" #include "ImagePlaneAtiInterpDialog.h" #include "QCreateInSARImagePlaneXYZRDialog.h" +#include "QLookTableResampleFromWGS84ToRange.h" SARSimlulationRFPCToolButton::SARSimlulationRFPCToolButton(QWidget* parent) @@ -83,6 +84,7 @@ void RegisterPreToolBox(LAMPMainWidget::RasterMainWidget* mainwindows, ToolBoxWi emit toolbox->addBoxToolItemSIGNAL(new ImagePlaneAtiInterpToolButton(toolbox)); emit toolbox->addBoxToolItemSIGNAL(new QCreateInSARImagePlaneXYZRToolButton(toolbox)); emit toolbox->addBoxToolItemSIGNAL(new QInSARBPImageToolButton(toolbox)); + emit toolbox->addBoxToolItemSIGNAL(new QLookTableResampleFromWGS84ToRangeToolButton(toolbox)); } LookTableComputerClassToolButton::LookTableComputerClassToolButton(QWidget* parent) @@ -217,3 +219,20 @@ void QInSARBPImageToolButton::run() QSimulationBPImage* dialog = new QSimulationBPImage; dialog->show(); } + +QLookTableResampleFromWGS84ToRangeToolButton::QLookTableResampleFromWGS84ToRangeToolButton(QWidget* parent) +{ + this->toolPath = QVector(0); + this->toolPath.push_back(u8"仿真工具库"); + this->toolname = QString(u8"查找表的反向插值"); +} + +QLookTableResampleFromWGS84ToRangeToolButton::~QLookTableResampleFromWGS84ToRangeToolButton() +{ +} + +void QLookTableResampleFromWGS84ToRangeToolButton::run() +{ + QLookTableResampleFromWGS84ToRange* dialog = new QLookTableResampleFromWGS84ToRange; + dialog->show(); +} diff --git a/Toolbox/SimulationSARTool/SimulationSARTool.h b/Toolbox/SimulationSARTool/SimulationSARTool.h index 89c51dc..93725cc 100644 --- a/Toolbox/SimulationSARTool/SimulationSARTool.h +++ b/Toolbox/SimulationSARTool/SimulationSARTool.h @@ -140,7 +140,15 @@ public: }; +class SIMULATIONSARTOOL_EXPORT QLookTableResampleFromWGS84ToRangeToolButton : public QToolAbstract { + Q_OBJECT +public: + QLookTableResampleFromWGS84ToRangeToolButton(QWidget* parent = nullptr); + ~QLookTableResampleFromWGS84ToRangeToolButton(); +public: + virtual void run() override; +}; extern "C" SIMULATIONSARTOOL_EXPORT void RegisterPreToolBox(LAMPMainWidget::RasterMainWidget* mainwindows, ToolBoxWidget* toolbox); From 9df7c8b1a0df57a84b124476e5a4859a4ba892b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=A2=9E=E8=BE=89?= <3045316072@qq.com> Date: Tue, 8 Apr 2025 00:13:36 +0800 Subject: [PATCH 21/44] =?UTF-8?q?=E5=90=8C=E6=AD=A5=E4=BF=AE=E6=94=B9---?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=88=90=E5=83=8F=E8=8C=83=E5=9B=B4=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E8=A3=81=E5=89=AA=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../QLookTableResampleFromWGS84ToRange.cpp | 1 - .../SARImage/ImageNetOperator.cpp | 226 +++++++++++++++++- .../SARImage/ImageNetOperator.h | 2 +- .../SARImage/ImagePlaneAtiInterpDialog.cpp | 41 ++-- 4 files changed, 249 insertions(+), 21 deletions(-) diff --git a/Toolbox/SimulationSARTool/PowerSimulationIncoherent/QLookTableResampleFromWGS84ToRange.cpp b/Toolbox/SimulationSARTool/PowerSimulationIncoherent/QLookTableResampleFromWGS84ToRange.cpp index 981ee1f..b94c71c 100644 --- a/Toolbox/SimulationSARTool/PowerSimulationIncoherent/QLookTableResampleFromWGS84ToRange.cpp +++ b/Toolbox/SimulationSARTool/PowerSimulationIncoherent/QLookTableResampleFromWGS84ToRange.cpp @@ -17,7 +17,6 @@ QLookTableResampleFromWGS84ToRange::QLookTableResampleFromWGS84ToRange(QWidget * connect(ui->pushButtonLookTableWGS84Select, SIGNAL(clicked(bool)), this, SLOT(onpushButtonLookTableWGS84SelectClicked(bool))); connect(ui->pushButtonLookTableRangeSelect, SIGNAL(clicked(bool)), this, SLOT(onpushButtonLookTableRangeSelectClicked(bool))); connect(ui->pushButtonLookTableCountSelect, SIGNAL(clicked(bool)), this, SLOT(onpushButtonLookTableCountSelectClicked(bool))); - } diff --git a/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.cpp b/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.cpp index 698a017..a88bf24 100644 --- a/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.cpp +++ b/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.cpp @@ -286,7 +286,6 @@ void InterploateAtiByRefDEM(QString& ImageLLPath, QString& ImageDEMPath, QString qDebug() << u8"图像行列:\t" << demimg.height << " , " << demimg.width; - 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++) { @@ -416,6 +415,231 @@ void InterploateAtiByRefDEM(QString& ImageLLPath, QString& ImageDEMPath, QString } +void InterploateClipAtiByRefDEM(QString ImageLLPath, QString& ImageDEMPath, QString& outImageLLAPath, QString& InEchoGPSDataPath) { + + gdalImage demimg(ImageDEMPath); + gdalImage imgll(ImageLLPath); + + // 裁剪 + long imgheight = imgll.height; + long imgwidth = imgll.width; + + long minRow = -1; + long maxRow = imgheight; + long minCol = -1; + long maxCol = imgwidth; + + + Eigen::MatrixXd imglonArr = imgll.getData(0, 0, imgheight, imgwidth, 1); + Eigen::MatrixXd imglatArr = imgll.getData(0, 0, imgheight, imgwidth, 2); + +#pragma omp parallel for + for (long i = 0; i < imgheight; i++) { + for (long j = 0; j < imgwidth; j++) { + double lon = imglonArr(i, j); + double lat = imglatArr(i, j); + Landpoint point = demimg.getRow_Col(lon, lat); + imglonArr(i, j) = point.lon; + imglatArr(i, j) = point.lat; + } + } + + // 开始逐行扫描 + + bool minRowFlag=true, maxRowFlag= true, minColFlag = true, maxColFlag = true; + + for (long i = 0; i < imgheight; i++) { + for (long j = 0; j < imgwidth; j++) { + if (imglonArr(i, j) > 0 && minRowFlag) { + minRowFlag = false; + minRow = i; + break; + } + if (imglonArr(i, j) < imgheight) { + maxRow = i; + } + } + } + + for (long j = 0; j < imgwidth; j++) { + for (long i = 0; i < imgheight; i++) { + if (imglatArr(i, j) > 0 && minColFlag) { + minColFlag = false; + minCol = j; + break; + } + if (imglatArr(i, j) < imgheight) { + maxCol = j; + } + } + } + + + long RowCount = maxRow - minRow; + long ColCount = maxCol - minCol; + + gdalImage outimgll = CreategdalImageDouble(outImageLLAPath, RowCount, ColCount, 4, true, true); // 经度、纬度、高程、斜距 + + long imgheight = outimgll.height; + long imgwidth = outimgll.width; + + Eigen::MatrixXd imglonArr = imgll.getData(minRow, minCol, RowCount, ColCount, 1); + Eigen::MatrixXd imglatArr = imgll.getData(minRow, minCol, RowCount, ColCount, 2); + + Eigen::MatrixXd demArr = demimg.getData(0, 0, demimg.height, demimg.width, 1); + + 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); + + + double minX = imglonArr.minCoeff(); + double maxX = imglonArr.maxCoeff(); + double minY = imglatArr.minCoeff(); + 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; + + + 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++) { + double lon = imglonArr(i, j); + double lat = imglatArr(i, j); + Landpoint point = demimg.getRow_Col(lon, lat); + + if (point.lon<1 || point.lon>demimg.width - 2 || point.lat < 1 || point.lat - 2) { + continue; + } + else {} + + Landpoint p0, p11, p21, p12, p22; + + p0.lon = point.lon; + p0.lat = point.lat; + + p11.lon = floor(p0.lon); + p11.lat = floor(p0.lat); + p11.ati = demArr(long(p11.lat), long(p11.lon)); + + p12.lon = ceil(p0.lon); + p12.lat = floor(p0.lat); + p12.ati = demArr(long(p12.lat), long(p12.lon)); + + p21.lon = floor(p0.lon); + p21.lat = ceil(p0.lat); + p21.ati = demArr(long(p21.lat), long(p21.lon)); + + p22.lon = ceil(p0.lon); + p22.lat = ceil(p0.lat); + p22.ati = demArr(long(p22.lat), long(p22.lon)); + + p0.lon = p0.lon - p11.lon; + p0.lat = p0.lat - p11.lat; + + p12.lon = p12.lon - p11.lon; + p12.lat = p12.lat - p11.lat; + + p21.lon = p21.lon - p11.lon; + p21.lat = p21.lat - p11.lat; + + p22.lon = p22.lon - p11.lon; + p22.lat = p22.lat - p11.lat; + + p11.lon = p11.lon - p11.lon; + p11.lat = p11.lat - p11.lat; + + p0.ati = Bilinear_interpolation(p0, p11, p21, p12, p22); + imgatiArr(i, j) = p0.ati; + } + } + + 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 Pxs((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); + std::shared_ptr Pys((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); + std::shared_ptr Pzs((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); + std::shared_ptr AntDirectX((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); + std::shared_ptr AntDirectY((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); + std::shared_ptr AntDirectZ((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); + + { + long colnum = 19; + std::shared_ptr antpos = readDataArr(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 = minRow; prfid < maxRow; 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-minRow, j); + LLA.lat = imglatArr(prfid - minRow, j); + LLA.ati = imgatiArr(prfid - minRow, j); + + LLA2XYZ(LLA, XYZ); + + R = sqrt(pow(Px - XYZ.x, 2) + + pow(Py - XYZ.y, 2) + + pow(Pz - XYZ.z, 2)); + imgRArr(prfid - minRow, j) = R; + } + } + + outimgll.saveImage(imgRArr, 0, 0, 4); + + qDebug() << u8"插值完成"; + +} + + + int ReflectTable_WGS2Range(QString dem_rc_path,QString outOriSimTiffPath,QString ori_sim_count_tiffPath,long OriHeight,long OriWidth) { diff --git a/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.h b/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.h index a18718a..88ae6a1 100644 --- a/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.h +++ b/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.h @@ -11,7 +11,7 @@ bool OverlapCheck(QString& ImageLLPath, QString& ImageDEMPath); bool GPSPointsNumberEqualCheck(QString& ImageLLPath, QString& InEchoGPSDataPath); - +void InterploateClipAtiByRefDEM(QString ImageLLPath, QString& ImageDEMPath, QString& outImageLLAPath, QString& InEchoGPSDataPath); void InterploateAtiByRefDEM(QString& ImageLLPath, QString& ImageDEMPath, QString& outImageLLAPath, QString& InEchoGPSDataPath); int ReflectTable_WGS2Range(QString dem_rc_path, QString outOriSimTiffPath, QString ori_sim_count_tiffPath, long OriHeight, long OriWidth); #endif diff --git a/Toolbox/SimulationSARTool/SARImage/ImagePlaneAtiInterpDialog.cpp b/Toolbox/SimulationSARTool/SARImage/ImagePlaneAtiInterpDialog.cpp index e4ec753..4c78e3b 100644 --- a/Toolbox/SimulationSARTool/SARImage/ImagePlaneAtiInterpDialog.cpp +++ b/Toolbox/SimulationSARTool/SARImage/ImagePlaneAtiInterpDialog.cpp @@ -64,12 +64,11 @@ void ImagePlaneAtiInterpDialog::onpushButtonEchoGPSPointSelect_clicked() void ImagePlaneAtiInterpDialog::onpushButtonRefRangeDEMSelect_clicked() { QString fileNames = QFileDialog::getOpenFileName( - this, // ?????? - tr(u8"选择参考DEM"), // ???? - QString(), // ???·?? - tr(ENVI_FILE_FORMAT_FILTER) // ????????? + this, + tr(u8"选择参考DEM"), + QString(), + tr(ENVI_FILE_FORMAT_FILTER) ); - // ?????????????? if (!fileNames.isEmpty()) { QString message = "选中文件\n"; this->ui->lineEditRefRangeDEMPath->setText(fileNames); @@ -82,12 +81,12 @@ void ImagePlaneAtiInterpDialog::onpushButtonRefRangeDEMSelect_clicked() void ImagePlaneAtiInterpDialog::onpushButtonImageLLASelect_clicked() { QString fileNames = QFileDialog::getSaveFileName( - this, // ?????? - tr(u8"提示"), // ???? - QString(), // ???·?? - tr(ENVI_FILE_FORMAT_FILTER) // ????????? + this, + tr(u8"提示"), + QString(), + tr(ENVI_FILE_FORMAT_FILTER) ); - // ?????????????? + if (!fileNames.isEmpty()) { QString message = "选中文件\n"; this->ui->lineEditImageLLAPath->setText(fileNames); @@ -119,17 +118,23 @@ void ImagePlaneAtiInterpDialog::onbuttonBoxAccepted() } bool checkflag= this->ui->checkBoxOverLap->isChecked(); - - if (checkflag || OverlapCheck(imageNet0Path, refRangeDEMPath)) { // ????DEM??? - InterploateAtiByRefDEM(imageNet0Path, refRangeDEMPath, imageLLAPath,echoGPSDataPath); - - QMessageBox::information(nullptr, u8"提示", u8"completed!!"); + if (checkflag) { + InterploateClipAtiByRefDEM(imageNet0Path, refRangeDEMPath, imageLLAPath, echoGPSDataPath); + QMessageBox::information(this, tr(u8"提示"), tr(u8"完成")); return; - } else { - QMessageBox::warning(nullptr,u8"警告",u8"DEM影像小于成像粗平面采样要求"); - return; + if (OverlapCheck(imageNet0Path, refRangeDEMPath)) { // ????DEM??? + InterploateAtiByRefDEM(imageNet0Path, refRangeDEMPath, imageLLAPath, echoGPSDataPath); + + QMessageBox::information(nullptr, u8"提示", u8"completed!!"); + return; + + } + else { + QMessageBox::warning(nullptr, u8"警告", u8"DEM影像小于成像粗平面采样要求"); + return; + } } } From 97608b5626de64b98648877b886ad943080ba4d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=A2=9E=E8=BE=89?= <3045316072@qq.com> Date: Tue, 8 Apr 2025 10:08:19 +0800 Subject: [PATCH 22/44] =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=BA=86=E6=88=90?= =?UTF-8?q?=E5=83=8F=E7=BD=91=E6=A0=BC=E7=9A=84=E5=9D=90=E6=A0=87=E7=B3=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BaseTool/ImageOperatorBase.h | 10 ++++- .../BaseTool/gdalImageOperator.cpp | 45 +++++++++++++++++++ .../QLookTableResampleFromWGS84ToRange.cpp | 1 - .../SimulationSAR/TBPImageAlgCls.cpp | 5 +++ 4 files changed, 58 insertions(+), 3 deletions(-) diff --git a/BaseCommonLibrary/BaseTool/ImageOperatorBase.h b/BaseCommonLibrary/BaseTool/ImageOperatorBase.h index 8b0b7ba..d47ad7c 100644 --- a/BaseCommonLibrary/BaseTool/ImageOperatorBase.h +++ b/BaseCommonLibrary/BaseTool/ImageOperatorBase.h @@ -174,8 +174,6 @@ public: // 鏂规硶 virtual void saveImage(std::shared_ptr, int start_row, int start_col, int rowcount, int colcount, int band_ids); virtual void saveImage(std::shared_ptr, int start_row, int start_col, int rowcount, int colcount, int band_ids); - - virtual void saveImage(); virtual void setNoDataValue(double nodatavalue, int band_ids); virtual void setNoDataValuei(int nodatavalue, int band_ids); @@ -197,6 +195,10 @@ public: // 鏂规硶 virtual RasterExtend getExtend(); + + + + public: QString img_path; // 鍥惧儚鏂囦欢 int height; // 楂 @@ -236,6 +238,10 @@ public: Eigen::MatrixXcd data; }; + +bool BASECONSTVARIABLEAPI CopyProjectTransformMatrixFromRasterAToRasterB(QString RasterAPath, QString RasterBPath); + + // 鍒涘缓褰卞儚 gdalImage BASECONSTVARIABLEAPI CreategdalImageDouble(QString& img_path, int height, int width, int band_num, bool overwrite = false, bool isEnvi = false); gdalImage BASECONSTVARIABLEAPI CreategdalImageFloat(QString& img_path, int height, int width, int band_num, bool overwrite = false, bool isEnvi = false); diff --git a/BaseCommonLibrary/BaseTool/gdalImageOperator.cpp b/BaseCommonLibrary/BaseTool/gdalImageOperator.cpp index d0c8c77..c695822 100644 --- a/BaseCommonLibrary/BaseTool/gdalImageOperator.cpp +++ b/BaseCommonLibrary/BaseTool/gdalImageOperator.cpp @@ -1470,6 +1470,51 @@ gdalImage CreategdalImage(const QString& img_path, int height, int width, int ba } +bool CopyProjectTransformMatrixFromRasterAToRasterB(QString RasterAPath, QString RasterBPath) { + // 注册所有GDAL驱动 + GDALAllRegister(); + + // 打开影像A(只读模式) + GDALDataset* ds_a = (GDALDataset*)GDALOpen(RasterAPath.toUtf8().constData(), GA_ReadOnly); + if (ds_a == nullptr) { + std::cerr << "无法打开影像A" << std::endl; + return false; + } + + // 获取A的仿射矩阵和投影信息 + double geotransform[6]; + ds_a->GetGeoTransform(geotransform); // 包含六参数仿射变换 + const char* projection = ds_a->GetProjectionRef(); // WKT格式投影 + + // 打开影像B(更新模式) + GDALDataset* ds_b = (GDALDataset*)GDALOpen(RasterBPath.toUtf8().constData(), GA_Update); + if (ds_b == nullptr) { + std::cerr << "无法打开影像B" << std::endl; + GDALClose(ds_a); + return false; + } + + // 设置仿射矩阵 + if (ds_b->SetGeoTransform(geotransform) != CE_None) { + std::cerr << "设置仿射矩阵失败" << std::endl; + } + + // 设置投影坐标系 + if (ds_b->SetProjection(projection) != CE_None) { + std::cerr << "设置投影失败" << std::endl; + } + + // 释放资源 + GDALClose(ds_a); + GDALClose(ds_b); + + return true; + + + + + +} diff --git a/Toolbox/SimulationSARTool/PowerSimulationIncoherent/QLookTableResampleFromWGS84ToRange.cpp b/Toolbox/SimulationSARTool/PowerSimulationIncoherent/QLookTableResampleFromWGS84ToRange.cpp index b94c71c..38004a5 100644 --- a/Toolbox/SimulationSARTool/PowerSimulationIncoherent/QLookTableResampleFromWGS84ToRange.cpp +++ b/Toolbox/SimulationSARTool/PowerSimulationIncoherent/QLookTableResampleFromWGS84ToRange.cpp @@ -17,7 +17,6 @@ QLookTableResampleFromWGS84ToRange::QLookTableResampleFromWGS84ToRange(QWidget * connect(ui->pushButtonLookTableWGS84Select, SIGNAL(clicked(bool)), this, SLOT(onpushButtonLookTableWGS84SelectClicked(bool))); connect(ui->pushButtonLookTableRangeSelect, SIGNAL(clicked(bool)), this, SLOT(onpushButtonLookTableRangeSelectClicked(bool))); connect(ui->pushButtonLookTableCountSelect, SIGNAL(clicked(bool)), this, SLOT(onpushButtonLookTableCountSelectClicked(bool))); - } QLookTableResampleFromWGS84ToRange::~QLookTableResampleFromWGS84ToRange() diff --git a/Toolbox/SimulationSARTool/SimulationSAR/TBPImageAlgCls.cpp b/Toolbox/SimulationSARTool/SimulationSAR/TBPImageAlgCls.cpp index 4766922..dc32916 100644 --- a/Toolbox/SimulationSARTool/SimulationSAR/TBPImageAlgCls.cpp +++ b/Toolbox/SimulationSARTool/SimulationSAR/TBPImageAlgCls.cpp @@ -90,6 +90,11 @@ ErrorCode TBPImageAlgCls::ProcessWithGridNet(long num_thread,QString xyzRasterPa QMessageBox::information(nullptr, u8"鎻愮ず", u8"鐩墠鍙敮鎸佹樉鍗"); return ErrorCode::FAIL; } + + // 澶勭悊鎴愬儚鏄犲皠 + CopyProjectTransformMatrixFromRasterAToRasterB(this->outRasterXYZPath, this->L1ds->getImageRasterPath()); + + return ErrorCode::SUCCESS; } From 6d642675ee0bac951582ab6c77017aa46176fcbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=A2=9E=E8=BE=89?= <3045316072@qq.com> Date: Tue, 8 Apr 2025 10:18:00 +0800 Subject: [PATCH 23/44] =?UTF-8?q?=E5=90=8C=E6=AD=A5=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SARImage/ImageNetOperator.cpp | 19 ++- .../SARImage/ImageNetOperator.h | 3 + .../QSARSimulationComplexEchoDataDialog.cpp | 100 ++++++++++++ .../QSARSimulationComplexEchoDataDialog.h | 27 ++++ .../QSARSimulationComplexEchoDataDialog.ui | 149 ++++++++++++++++++ .../SimulationSARTool.vcxproj | 3 + .../SimulationSARTool.vcxproj.filters | 15 +- 7 files changed, 308 insertions(+), 8 deletions(-) create mode 100644 Toolbox/SimulationSARTool/SARImage/QSARSimulationComplexEchoDataDialog.cpp create mode 100644 Toolbox/SimulationSARTool/SARImage/QSARSimulationComplexEchoDataDialog.h create mode 100644 Toolbox/SimulationSARTool/SARImage/QSARSimulationComplexEchoDataDialog.ui diff --git a/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.cpp b/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.cpp index a88bf24..44f98c9 100644 --- a/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.cpp +++ b/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.cpp @@ -480,11 +480,11 @@ void InterploateClipAtiByRefDEM(QString ImageLLPath, QString& ImageDEMPath, QStr gdalImage outimgll = CreategdalImageDouble(outImageLLAPath, RowCount, ColCount, 4, true, true); // 经度、纬度、高程、斜距 - long imgheight = outimgll.height; - long imgwidth = outimgll.width; + imgheight = outimgll.height; + imgwidth = outimgll.width; - Eigen::MatrixXd imglonArr = imgll.getData(minRow, minCol, RowCount, ColCount, 1); - Eigen::MatrixXd imglatArr = imgll.getData(minRow, minCol, RowCount, ColCount, 2); + imglonArr = imgll.getData(minRow, minCol, RowCount, ColCount, 1); + imglatArr = imgll.getData(minRow, minCol, RowCount, ColCount, 2); Eigen::MatrixXd demArr = demimg.getData(0, 0, demimg.height, demimg.width, 1); @@ -784,7 +784,16 @@ int ReflectTable_WGS2Range(QString dem_rc_path,QString outOriSimTiffPath,QStrin - +int ResampleEChoDataFromGeoEcho(QString L2echodataPath, QString RangeLooktablePath, QString L1AEchoDataPath) { + gdalImageComplex echodata(L2echodataPath); + gdalImage looktable(RangeLooktablePath); + + + + + + +} diff --git a/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.h b/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.h index 88ae6a1..b3a0be9 100644 --- a/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.h +++ b/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.h @@ -14,4 +14,7 @@ bool GPSPointsNumberEqualCheck(QString& ImageLLPath, QString& InEchoGPSDataPath) void InterploateClipAtiByRefDEM(QString ImageLLPath, QString& ImageDEMPath, QString& outImageLLAPath, QString& InEchoGPSDataPath); void InterploateAtiByRefDEM(QString& ImageLLPath, QString& ImageDEMPath, QString& outImageLLAPath, QString& InEchoGPSDataPath); int ReflectTable_WGS2Range(QString dem_rc_path, QString outOriSimTiffPath, QString ori_sim_count_tiffPath, long OriHeight, long OriWidth); + +int ResampleEChoDataFromGeoEcho(QString L2echodataPath, QString RangeLooktablePath, QString L1AEchoDataPath); + #endif diff --git a/Toolbox/SimulationSARTool/SARImage/QSARSimulationComplexEchoDataDialog.cpp b/Toolbox/SimulationSARTool/SARImage/QSARSimulationComplexEchoDataDialog.cpp new file mode 100644 index 0000000..b1057d2 --- /dev/null +++ b/Toolbox/SimulationSARTool/SARImage/QSARSimulationComplexEchoDataDialog.cpp @@ -0,0 +1,100 @@ +#include "QSARSimulationComplexEchoDataDialog.h" +#include "ui_QSARSimulationComplexEchoDataDialog.h" +#include +#include +#include "BaseConstVariable.h" +#include "BaseTool.h" +#include "ImageNetOperator.h" +#include + + +QSARSimulationComplexEchoDataDialog::QSARSimulationComplexEchoDataDialog(QWidget *parent) + : QDialog(parent) + , ui(new Ui::QSARSimulationComplexEchoDataDialogClass) +{ + ui->setupUi(this); + + + connect(ui->pushButtonEchoDataSelect, SIGNAL(clicked()), this, SLOT(onpushButtonEchoDataSelect_clicked())); + connect(ui->pushButtonLookTableSelect, SIGNAL(clicked()), this, SLOT(onpushButtonLookTableSelect_clicked())); + connect(ui->pushButtonL1AEchoDataSelect, SIGNAL(clicked()), this, SLOT(onpushButtonL1AEchoDataSelect_clicked())); + connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(onbuttonBox_accepted())); + connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(onbuttonBox_rejected())); + +} + +QSARSimulationComplexEchoDataDialog::~QSARSimulationComplexEchoDataDialog() +{ + + +} + +void QSARSimulationComplexEchoDataDialog::onpushButtonEchoDataSelect_clicked() +{ + QString fileNames = QFileDialog::getOpenFileName( + this, // 父窗口 + tr(u8"选择L1A回波数据文件"), // 标题 + QString(), // 默认路径 + tr(ENVI_FILE_FORMAT_FILTER) // 文件过滤器 + ); + // 如果用户选择了文件 + if (!fileNames.isEmpty()) { + QString message = "选择的文件有:\n"; + this->ui->lineEditL1AEchoDataPath->setText(fileNames); + } + else { + QMessageBox::information(this, tr(u8"没有选择文件"), tr(u8"没有选择任何文件。")); + } +} + +void QSARSimulationComplexEchoDataDialog::onpushButtonLookTableSelect_clicked() +{ + QString fileNames = QFileDialog::getOpenFileName( + this, // 父窗口 + tr(u8"选择L1A回波数据文件"), // 标题 + QString(), // 默认路径 + tr(ENVI_FILE_FORMAT_FILTER) // 文件过滤器 + ); + // 如果用户选择了文件 + if (!fileNames.isEmpty()) { + QString message = "选择的文件有:\n"; + this->ui->lineEditL1AEchoDataPath->setText(fileNames); + } + else { + QMessageBox::information(this, tr(u8"没有选择文件"), tr(u8"没有选择任何文件。")); + } +} + +void QSARSimulationComplexEchoDataDialog::onpushButtonL1AEchoDataSelect_clicked() +{ + QString fileNames = QFileDialog::getSaveFileName( + this, // 父窗口 + tr(u8"选择L1A回波数据文件"), // 标题 + QString(), // 默认路径 + tr(ENVI_FILE_FORMAT_FILTER) // 文件过滤器 + ); + // 如果用户选择了文件 + if (!fileNames.isEmpty()) { + QString message = "选择的文件有:\n"; + this->ui->lineEditL1AEchoDataPath->setText(fileNames); + } + else { + QMessageBox::information(this, tr(u8"没有选择文件"), tr(u8"没有选择任何文件。")); + } +} + +void QSARSimulationComplexEchoDataDialog::onbuttonBox_accepted() +{ + QString echoDataPath = this->ui->lineEditEchoDataPath->text().trimmed(); + QString RangelookTablePath = this->ui->lineEditLookTablePath->text().trimmed(); + QString l1AEchoDataPath = this->ui->lineEditL1AEchoDataPath->text().trimmed(); + + + + +} + +void QSARSimulationComplexEchoDataDialog::onbuttonBox_rejected() +{ + this->close(); +} diff --git a/Toolbox/SimulationSARTool/SARImage/QSARSimulationComplexEchoDataDialog.h b/Toolbox/SimulationSARTool/SARImage/QSARSimulationComplexEchoDataDialog.h new file mode 100644 index 0000000..b586769 --- /dev/null +++ b/Toolbox/SimulationSARTool/SARImage/QSARSimulationComplexEchoDataDialog.h @@ -0,0 +1,27 @@ +#pragma once + +#include + +namespace Ui +{ + class QSARSimulationComplexEchoDataDialogClass; +} + +class QSARSimulationComplexEchoDataDialog : public QDialog +{ + Q_OBJECT + +public: + QSARSimulationComplexEchoDataDialog(QWidget *parent = nullptr); + ~QSARSimulationComplexEchoDataDialog(); + + +public slots: + void onpushButtonEchoDataSelect_clicked(); + void onpushButtonLookTableSelect_clicked(); + void onpushButtonL1AEchoDataSelect_clicked(); + void onbuttonBox_accepted(); + void onbuttonBox_rejected(); +private: + Ui::QSARSimulationComplexEchoDataDialogClass* ui; +}; diff --git a/Toolbox/SimulationSARTool/SARImage/QSARSimulationComplexEchoDataDialog.ui b/Toolbox/SimulationSARTool/SARImage/QSARSimulationComplexEchoDataDialog.ui new file mode 100644 index 0000000..ceed9c6 --- /dev/null +++ b/Toolbox/SimulationSARTool/SARImage/QSARSimulationComplexEchoDataDialog.ui @@ -0,0 +1,149 @@ + + + QSARSimulationComplexEchoDataDialogClass + + + + 0 + 0 + 916 + 400 + + + + QSARSimulationComplexEchoDataDialog + + + + + + + 0 + 30 + + + + 鎴愬儚鏂囦欢锛 + + + + + + + + 0 + 30 + + + + + + + + + 0 + 30 + + + + 閫夋嫨 + + + + + + + + 0 + 30 + + + + 鏌ユ壘琛細 + + + + + + + + 0 + 30 + + + + + + + + + + + + 0 + 30 + + + + 閫夋嫨 + + + + + + + + 0 + 30 + + + + L1A鍥炴尝锛 + + + + + + + + 0 + 30 + + + + + + + + + + + + 0 + 30 + + + + 閫夋嫨 + + + + + + + + 0 + 30 + + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + diff --git a/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj b/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj index 0e39cf3..34f3688 100644 --- a/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj +++ b/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj @@ -219,6 +219,7 @@ + @@ -250,6 +251,7 @@ + @@ -289,6 +291,7 @@ + diff --git a/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj.filters b/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj.filters index 88f0bab..1516d1b 100644 --- a/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj.filters +++ b/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj.filters @@ -80,9 +80,6 @@ SARImage - - PowerSimulationIncoherent - @@ -154,6 +151,9 @@ PowerSimulationIncoherent + + SARImage + @@ -198,6 +198,9 @@ PowerSimulationIncoherent + + SARImage + @@ -242,6 +245,12 @@ Header Files + + Header Files + + + SARImage + From d12a2b7d89ae1569fabffdf2bf9d4c98970598a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=A2=9E=E8=BE=89?= <3045316072@qq.com> Date: Tue, 8 Apr 2025 10:43:31 +0800 Subject: [PATCH 24/44] =?UTF-8?q?=E5=90=8C=E6=AD=A5=E5=B7=A5=E5=85=B7?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SARImage/ImageNetOperator.cpp | 107 +++++++++ .../QSARSimulationComplexEchoDataDialog.cpp | 4 +- .../QSimulationBPImageMultiProduction.cpp | 138 ++++++++++++ .../QSimulationBPImageMultiProduction.h | 31 +++ .../QSimulationBPImageMultiProduction.ui | 210 ++++++++++++++++++ .../SimulationSAR/QSimulationBPImage.ui | 2 +- .../SimulationSARTool/SimulationSARTool.cpp | 27 ++- Toolbox/SimulationSARTool/SimulationSARTool.h | 15 +- .../SimulationSARTool.vcxproj | 3 + .../SimulationSARTool.vcxproj.filters | 9 + 10 files changed, 541 insertions(+), 5 deletions(-) create mode 100644 Toolbox/SimulationSARTool/SARImage/QSimulationBPImageMultiProduction.cpp create mode 100644 Toolbox/SimulationSARTool/SARImage/QSimulationBPImageMultiProduction.h create mode 100644 Toolbox/SimulationSARTool/SARImage/QSimulationBPImageMultiProduction.ui diff --git a/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.cpp b/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.cpp index 44f98c9..4f013c4 100644 --- a/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.cpp +++ b/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.cpp @@ -787,11 +787,118 @@ int ReflectTable_WGS2Range(QString dem_rc_path,QString outOriSimTiffPath,QStrin int ResampleEChoDataFromGeoEcho(QString L2echodataPath, QString RangeLooktablePath, QString L1AEchoDataPath) { gdalImageComplex echodata(L2echodataPath); gdalImage looktable(RangeLooktablePath); + gdalImageComplex l1adata = CreategdalImageComplexNoProj(L1AEchoDataPath, looktable.height, looktable.width, 1, true); + + Eigen::MatrixXd imglonArr = looktable.getData(0, 0, looktable.height, looktable.width, 1); + Eigen::MatrixXd imglatArr = looktable.getData(0, 0, looktable.height, looktable.width, 2); + + Eigen::MatrixXcd echoArr = echodata.getDataComplex(0, 0, echodata.height, echodata.width, 1); + Eigen::MatrixXcd l1aArr= l1adata.getDataComplex(0, 0, l1adata.height, l1adata.width, 1); + l1aArr = l1aArr.array() * 0; + long imgheight = looktable.height; + long imgwidth = looktable.width; + 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++) { + double lon = imglonArr(i, j); + double lat = imglatArr(i, j); + Landpoint point = echodata.getRow_Col(lon, lat); + if (point.lon<1 || point.lon>echodata.width - 2 || point.lat < 1 || point.lat >echodata.height - 2) { + continue; + } + else {} + // 实部插值 + { + Landpoint p0, p11, p21, p12, p22; + p0.lon = point.lon; + p0.lat = point.lat; + + p11.lon = floor(p0.lon); + p11.lat = floor(p0.lat); + p11.ati = echoArr(long(p11.lat), long(p11.lon)).real(); + + p12.lon = ceil(p0.lon); + p12.lat = floor(p0.lat); + p12.ati = echoArr(long(p12.lat), long(p12.lon)).real(); + + p21.lon = floor(p0.lon); + p21.lat = ceil(p0.lat); + p21.ati = echoArr(long(p21.lat), long(p21.lon)).real(); + + p22.lon = ceil(p0.lon); + p22.lat = ceil(p0.lat); + p22.ati = echoArr(long(p22.lat), long(p22.lon)).real(); + + p0.lon = p0.lon - p11.lon; + p0.lat = p0.lat - p11.lat; + + p12.lon = p12.lon - p11.lon; + p12.lat = p12.lat - p11.lat; + + p21.lon = p21.lon - p11.lon; + p21.lat = p21.lat - p11.lat; + + p22.lon = p22.lon - p11.lon; + p22.lat = p22.lat - p11.lat; + + p11.lon = p11.lon - p11.lon; + p11.lat = p11.lat - p11.lat; + + p0.ati = Bilinear_interpolation(p0, p11, p21, p12, p22); + l1aArr(i, j).real(p0.ati); + } + //虚部插值 + { + Landpoint p0, p11, p21, p12, p22; + + p0.lon = point.lon; + p0.lat = point.lat; + + p11.lon = floor(p0.lon); + p11.lat = floor(p0.lat); + p11.ati = echoArr(long(p11.lat), long(p11.lon)).imag(); + + p12.lon = ceil(p0.lon); + p12.lat = floor(p0.lat); + p12.ati = echoArr(long(p12.lat), long(p12.lon)).imag(); + + p21.lon = floor(p0.lon); + p21.lat = ceil(p0.lat); + p21.ati = echoArr(long(p21.lat), long(p21.lon)).imag(); + + p22.lon = ceil(p0.lon); + p22.lat = ceil(p0.lat); + p22.ati = echoArr(long(p22.lat), long(p22.lon)).imag(); + + p0.lon = p0.lon - p11.lon; + p0.lat = p0.lat - p11.lat; + + p12.lon = p12.lon - p11.lon; + p12.lat = p12.lat - p11.lat; + + p21.lon = p21.lon - p11.lon; + p21.lat = p21.lat - p11.lat; + + p22.lon = p22.lon - p11.lon; + p22.lat = p22.lat - p11.lat; + + p11.lon = p11.lon - p11.lon; + p11.lat = p11.lat - p11.lat; + + p0.ati = Bilinear_interpolation(p0, p11, p21, p12, p22); + l1aArr(i, j).imag(p0.ati); + } + + } + } + + l1adata.saveImage(l1aArr, 0, 0, 1); + return 0; } diff --git a/Toolbox/SimulationSARTool/SARImage/QSARSimulationComplexEchoDataDialog.cpp b/Toolbox/SimulationSARTool/SARImage/QSARSimulationComplexEchoDataDialog.cpp index b1057d2..48a8d51 100644 --- a/Toolbox/SimulationSARTool/SARImage/QSARSimulationComplexEchoDataDialog.cpp +++ b/Toolbox/SimulationSARTool/SARImage/QSARSimulationComplexEchoDataDialog.cpp @@ -90,8 +90,8 @@ void QSARSimulationComplexEchoDataDialog::onbuttonBox_accepted() QString l1AEchoDataPath = this->ui->lineEditL1AEchoDataPath->text().trimmed(); - - + ResampleEChoDataFromGeoEcho(echoDataPath, RangelookTablePath, l1AEchoDataPath); + QMessageBox::information(this, tr(u8"提示"), tr(u8"没有选择任何文件。")); } void QSARSimulationComplexEchoDataDialog::onbuttonBox_rejected() diff --git a/Toolbox/SimulationSARTool/SARImage/QSimulationBPImageMultiProduction.cpp b/Toolbox/SimulationSARTool/SARImage/QSimulationBPImageMultiProduction.cpp new file mode 100644 index 0000000..aade224 --- /dev/null +++ b/Toolbox/SimulationSARTool/SARImage/QSimulationBPImageMultiProduction.cpp @@ -0,0 +1,138 @@ +#include "QSimulationBPImageMultiProduction.h" +#include +#include +#include "TBPImageAlgCls.h" +#include "EchoDataFormat.h" +#include +#include +#include "ui_QSimulationBPImageMultiProduction.h" + + +QSimulationBPImageMultiProduction::QSimulationBPImageMultiProduction(QWidget *parent) + : QDialog(parent),ui(new Ui::QSimulationBPImageMultiProductionClass) +{ + 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())); + QObject::connect(ui->GridNetBtn, SIGNAL(clicked()), this, SLOT(onpushButtonGridNetSelectClicked())); + QObject::connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(onbtnaccepted())); + QObject::connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(onbtnrejected())); + QObject::connect(ui->checkBox, SIGNAL(stateChanged(int)), this, SLOT(oncheckboxTrigged(int))); + + + + +} + +QSimulationBPImageMultiProduction::~QSimulationBPImageMultiProduction() +{} + +void QSimulationBPImageMultiProduction::onpushButtonEchoSelectClicked() +{ + QString fileNames = QFileDialog::getOpenFileName( + this, // 父窗口 + tr(u8"选择影像文件"), // 标题 + QString(), // 默认路径 + tr(u8"xml Files (*.xml);;All Files (*)") // 文件过滤器 + ); + + // 如果用户选择了文件 + if (!fileNames.isEmpty()) { + QString message = "选择的文件有:\n"; + this->ui->lineEditEchoPath->setText(fileNames); + } + else { + QMessageBox::information(this, tr(u8"没有选择文件"), tr(u8"没有选择任何文件。")); + } +} + +void QSimulationBPImageMultiProduction::onpushButtonImageSelectClicked() +{ + QString fileNames = QFileDialog::getSaveFileName( + this, // 父窗口 + tr(u8"选择影像文件"), // 标题 + QString(), // 默认路径 + tr(u8"All Files(*)") // 文件过滤器 + ); + + // 如果用户选择了文件 + if (!fileNames.isEmpty()) { + this->ui->lineEditImagePath->setText(fileNames); + } + else { + QMessageBox::information(this, tr(u8"没有选择文件"), tr(u8"没有选择任何文件。")); + } +} + +void QSimulationBPImageMultiProduction::onbtnaccepted() +{ + this->hide(); + QString echofile = this->ui->lineEditEchoPath->text().trimmed(); + QString outImageFolder = getParantFromPath(this->ui->lineEditImagePath->text().trimmed()); + QString imagename = getFileNameFromPath(this->ui->lineEditImagePath->text().trimmed()); + std::shared_ptr 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()); + + if (ui->checkBox->isChecked()) { + gdalImage imgxyzimg(ui->lineEdit->text().trimmed()); + imagL1->OpenOrNew(outImageFolder, imagename, imgxyzimg.height, imgxyzimg.width); + } + else { + imagL1->OpenOrNew(outImageFolder, imagename, echoL0ds->getPluseCount(), echoL0ds->getPlusePoints()); + } + + + TBPImageAlgCls TBPimag; + TBPimag.setEchoL0(echoL0ds); + TBPimag.setImageL1(imagL1); + long cpucore_num = std::thread::hardware_concurrency(); + TBPimag.setGPU(true); + TBPimag.ProcessWithGridNet(cpucore_num,ui->lineEdit->text().trimmed()); + + this->show(); + QMessageBox::information(this,u8"成像",u8"成像结束"); + +} + +void QSimulationBPImageMultiProduction::onbtnrejected() +{ + this->close(); +} + +void QSimulationBPImageMultiProduction::oncheckboxTrigged(int) +{ + this->ui->lineEdit->setEnabled(this->ui->checkBox->isChecked()); + this->ui->GridNetBtn->setEnabled(this->ui->checkBox->isChecked()); + +} + +void QSimulationBPImageMultiProduction::onpushButtonGridNetSelectClicked( ) +{ + QString fileNames = QFileDialog::getOpenFileName( + this, // 父窗口 + tr(u8"选择影像文件"), // 标题 + QString(), // 默认路径 + tr(u8"All Files(*);;dat(*.dat);;tif(*.tif);;tiff(*.tiff)") // 文件过滤器 + ); + + // 如果用户选择了文件 + if (!fileNames.isEmpty()) { + this->ui->lineEdit->setText(fileNames); + } + else { + QMessageBox::information(this, tr(u8"没有选择文件"), tr(u8"没有选择任何文件。")); + } +} diff --git a/Toolbox/SimulationSARTool/SARImage/QSimulationBPImageMultiProduction.h b/Toolbox/SimulationSARTool/SARImage/QSimulationBPImageMultiProduction.h new file mode 100644 index 0000000..dc84ee7 --- /dev/null +++ b/Toolbox/SimulationSARTool/SARImage/QSimulationBPImageMultiProduction.h @@ -0,0 +1,31 @@ +#pragma once +#include "simulationsartool_global.h" +#include + +namespace Ui { + class QSimulationBPImageMultiProductionClass; +} + + + +class SIMULATIONSARTOOL_EXPORT QSimulationBPImageMultiProduction : public QDialog +{ + Q_OBJECT + +public: + QSimulationBPImageMultiProduction(QWidget *parent = nullptr); + ~QSimulationBPImageMultiProduction(); + + +public slots: + void onpushButtonEchoSelectClicked(); + void onpushButtonImageSelectClicked(); + void onbtnaccepted(); + void onbtnrejected(); + + void oncheckboxTrigged(int); + void onpushButtonGridNetSelectClicked( ); + +private: + Ui::QSimulationBPImageMultiProductionClass* ui; +}; diff --git a/Toolbox/SimulationSARTool/SARImage/QSimulationBPImageMultiProduction.ui b/Toolbox/SimulationSARTool/SARImage/QSimulationBPImageMultiProduction.ui new file mode 100644 index 0000000..a3e110a --- /dev/null +++ b/Toolbox/SimulationSARTool/SARImage/QSimulationBPImageMultiProduction.ui @@ -0,0 +1,210 @@ + + + QSimulationBPImageMultiProductionClass + + + + 0 + 0 + 813 + 400 + + + + 浠跨湡鍥惧儚TimeBP鏂规硶 + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + + 0 + 30 + + + + 鍥炴尝鍦板潃锛 + + + + + + + + 0 + 30 + + + + D:\Programme\vs2022\RasterMergeTest\LAMPCAE_SCANE-all-scane\GF3_Simulation.xml + + + + + + + + 0 + 30 + + + + 閫夋嫨 + + + + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + + 0 + 30 + + + + 鍥惧儚缃戞牸 + + + true + + + + + + + true + + + + 0 + 30 + + + + D:\Programme\vs2022\RasterMergeTest\simulationData\demdataset\demxyz.bin + + + + + + + true + + + + 0 + 30 + + + + 閫夋嫨 + + + + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + + 0 + 30 + + + + 浠跨湡鍥惧儚锛 + + + + + + + + 0 + 30 + + + + D:\Programme\vs2022\RasterMergeTest\LAMPCAE_SCANE-all-scane\BPImage\GF3BPImage + + + + + + + + 0 + 30 + + + + 閫夋嫨 + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + 0 + 30 + + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + diff --git a/Toolbox/SimulationSARTool/SimulationSAR/QSimulationBPImage.ui b/Toolbox/SimulationSARTool/SimulationSAR/QSimulationBPImage.ui index 39d7fa4..79f3686 100644 --- a/Toolbox/SimulationSARTool/SimulationSAR/QSimulationBPImage.ui +++ b/Toolbox/SimulationSARTool/SimulationSAR/QSimulationBPImage.ui @@ -6,7 +6,7 @@ 0 0 - 995 + 813 400 diff --git a/Toolbox/SimulationSARTool/SimulationSARTool.cpp b/Toolbox/SimulationSARTool/SimulationSARTool.cpp index bf4d73d..a9b9d11 100644 --- a/Toolbox/SimulationSARTool/SimulationSARTool.cpp +++ b/Toolbox/SimulationSARTool/SimulationSARTool.cpp @@ -11,6 +11,7 @@ #include "ImagePlaneAtiInterpDialog.h" #include "QCreateInSARImagePlaneXYZRDialog.h" #include "QLookTableResampleFromWGS84ToRange.h" +#include "QSARSimulationComplexEchoDataDialog.h" SARSimlulationRFPCToolButton::SARSimlulationRFPCToolButton(QWidget* parent) @@ -73,7 +74,7 @@ void QSimulationSAROrbitModelToolButton::excute() void RegisterPreToolBox(LAMPMainWidget::RasterMainWidget* mainwindows, ToolBoxWidget* toolbox) { - emit toolbox->addBoxToolItemSIGNAL(new SARSimlulationRFPCToolButton(toolbox)); + emit toolbox->addBoxToolItemSIGNAL(new SARSimlulationRFPCToolButton(toolbox)); // 300 emit toolbox->addBoxToolItemSIGNAL(new SARSimulationTBPImageToolButton(toolbox)); emit toolbox->addBoxToolItemSIGNAL(new QSimulationSAROrbitModelToolButton(toolbox)); emit toolbox->addBoxToolItemSIGNAL(new LookTableComputerClassToolButton(toolbox)); @@ -85,6 +86,8 @@ void RegisterPreToolBox(LAMPMainWidget::RasterMainWidget* mainwindows, ToolBoxWi emit toolbox->addBoxToolItemSIGNAL(new QCreateInSARImagePlaneXYZRToolButton(toolbox)); emit toolbox->addBoxToolItemSIGNAL(new QInSARBPImageToolButton(toolbox)); emit toolbox->addBoxToolItemSIGNAL(new QLookTableResampleFromWGS84ToRangeToolButton(toolbox)); + emit toolbox->addBoxToolItemSIGNAL(new QSARSimulationComplexEchoDataDialogToolButton(toolbox)); + } LookTableComputerClassToolButton::LookTableComputerClassToolButton(QWidget* parent) @@ -236,3 +239,25 @@ void QLookTableResampleFromWGS84ToRangeToolButton::run() QLookTableResampleFromWGS84ToRange* dialog = new QLookTableResampleFromWGS84ToRange; dialog->show(); } + + + + +//QSARSimulationComplexEchoDataDialog + +QSARSimulationComplexEchoDataDialogToolButton::QSARSimulationComplexEchoDataDialogToolButton(QWidget* parent) +{ + this->toolPath = QVector(0); + this->toolPath.push_back(u8"成像工具库"); + this->toolname = QString(u8"回波反采样工具(测试)"); +} + +QSARSimulationComplexEchoDataDialogToolButton::~QSARSimulationComplexEchoDataDialogToolButton() +{ +} + +void QSARSimulationComplexEchoDataDialogToolButton::run() +{ + QSARSimulationComplexEchoDataDialog* dialog = new QSARSimulationComplexEchoDataDialog; + dialog->show(); +} diff --git a/Toolbox/SimulationSARTool/SimulationSARTool.h b/Toolbox/SimulationSARTool/SimulationSARTool.h index 93725cc..1a6212c 100644 --- a/Toolbox/SimulationSARTool/SimulationSARTool.h +++ b/Toolbox/SimulationSARTool/SimulationSARTool.h @@ -13,6 +13,10 @@ namespace LAMPMainWidget { class ToolBoxWidget; +extern "C" SIMULATIONSARTOOL_EXPORT void RegisterPreToolBox(LAMPMainWidget::RasterMainWidget* mainwindows, ToolBoxWidget* toolbox); + + + class SIMULATIONSARTOOL_EXPORT SARSimlulationRFPCToolButton : public QToolAbstract { Q_OBJECT @@ -150,6 +154,15 @@ public: }; -extern "C" SIMULATIONSARTOOL_EXPORT void RegisterPreToolBox(LAMPMainWidget::RasterMainWidget* mainwindows, ToolBoxWidget* toolbox); + +class SIMULATIONSARTOOL_EXPORT QSARSimulationComplexEchoDataDialogToolButton : public QToolAbstract { + Q_OBJECT +public: + QSARSimulationComplexEchoDataDialogToolButton(QWidget* parent = nullptr); + ~QSARSimulationComplexEchoDataDialogToolButton(); +public: + virtual void run() override; + +}; diff --git a/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj b/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj index 34f3688..b228c81 100644 --- a/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj +++ b/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj @@ -220,6 +220,7 @@ + @@ -252,6 +253,7 @@ + @@ -292,6 +294,7 @@ + diff --git a/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj.filters b/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj.filters index 1516d1b..e53b120 100644 --- a/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj.filters +++ b/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj.filters @@ -154,6 +154,9 @@ SARImage + + SARImage + @@ -201,6 +204,9 @@ SARImage + + SARImage + @@ -251,6 +257,9 @@ SARImage + + SARImage + From 95f7bef2b52f6d5c9223dc883ba0c59a093919a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=A2=9E=E8=BE=89?= <3045316072@qq.com> Date: Tue, 8 Apr 2025 11:01:52 +0800 Subject: [PATCH 25/44] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=A4=9A=E7=BA=A7?= =?UTF-8?q?=E4=BA=A7=E5=93=81=E7=94=9F=E4=BA=A7=E5=B7=A5=E5=85=B7-?= =?UTF-8?q?=E5=BE=85=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SARImage/ImageNetOperator.cpp | 2 +- .../QSimulationBPImageMultiProduction.cpp | 138 ++++++++++++------ .../QSimulationBPImageMultiProduction.h | 9 +- .../QSimulationBPImageMultiProduction.ui | 125 ++++++++++++++-- .../SimulationSARTool/SimulationSARTool.cpp | 22 ++- Toolbox/SimulationSARTool/SimulationSARTool.h | 9 ++ 6 files changed, 233 insertions(+), 72 deletions(-) diff --git a/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.cpp b/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.cpp index 4f013c4..f75c122 100644 --- a/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.cpp +++ b/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.cpp @@ -801,7 +801,7 @@ int ResampleEChoDataFromGeoEcho(QString L2echodataPath, QString RangeLooktablePa for (long i = 0; i < imgheight; i++) { - //printf("\rprocess:%f precent\t\t\t",i*100.0/imgheight); + printf("\rGEC: process:%f precent\t\t\t",i*100.0/imgheight); for (long j = 0; j < imgwidth; j++) { double lon = imglonArr(i, j); double lat = imglatArr(i, j); diff --git a/Toolbox/SimulationSARTool/SARImage/QSimulationBPImageMultiProduction.cpp b/Toolbox/SimulationSARTool/SARImage/QSimulationBPImageMultiProduction.cpp index aade224..6c7a5ab 100644 --- a/Toolbox/SimulationSARTool/SARImage/QSimulationBPImageMultiProduction.cpp +++ b/Toolbox/SimulationSARTool/SARImage/QSimulationBPImageMultiProduction.cpp @@ -6,22 +6,21 @@ #include #include #include "ui_QSimulationBPImageMultiProduction.h" - +#include "ImageNetOperator.h" QSimulationBPImageMultiProduction::QSimulationBPImageMultiProduction(QWidget *parent) : QDialog(parent),ui(new Ui::QSimulationBPImageMultiProductionClass) { 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())); - QObject::connect(ui->GridNetBtn, SIGNAL(clicked()), this, SLOT(onpushButtonGridNetSelectClicked())); + QObject::connect(ui->LookTableBtn, SIGNAL(clicked()), this, SLOT(onpushButtonLookTableBtnClicked())); + QObject::connect(ui->GridNetBtn, SIGNAL(clicked()), this, SLOT(onpushButtonGridNetBtnSelectClicked())); + QObject::connect(ui->L1ASelectBtn, SIGNAL(clicked()), this, SLOT(onpushButtonL1ASelectBtnClicked())); + QObject::connect(ui->L2SelectSelect, SIGNAL(clicked()), this, SLOT(onpushButtonL2SelectSelectClicked())); QObject::connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(onbtnaccepted())); QObject::connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(onbtnrejected())); - QObject::connect(ui->checkBox, SIGNAL(stateChanged(int)), this, SLOT(oncheckboxTrigged(int))); + @@ -50,7 +49,44 @@ void QSimulationBPImageMultiProduction::onpushButtonEchoSelectClicked() } } -void QSimulationBPImageMultiProduction::onpushButtonImageSelectClicked() + +void QSimulationBPImageMultiProduction::onpushButtonLookTableBtnClicked() +{ + QString fileNames = QFileDialog::getOpenFileName( + this, // 父窗口 + tr(u8"选择查找表文件"), // 标题 + QString(), // 默认路径 + tr(u8"All Files(*)") // 文件过滤器 + ); + + // 如果用户选择了文件 + if (!fileNames.isEmpty()) { + this->ui->lineEditLookTablePath->setText(fileNames); + } + else { + QMessageBox::information(this, tr(u8"没有选择文件"), tr(u8"没有选择任何文件。")); + } +} + +void QSimulationBPImageMultiProduction::onpushButtonGridNetBtnSelectClicked() +{ + QString fileNames = QFileDialog::getOpenFileName( + this, // 父窗口 + tr(u8"选择成像网格文件"), // 标题 + QString(), // 默认路径 + tr(u8"All Files(*)") // 文件过滤器 + ); + + // 如果用户选择了文件 + if (!fileNames.isEmpty()) { + this->ui->lineEditImageNetPath->setText(fileNames); + } + else { + QMessageBox::information(this, tr(u8"没有选择文件"), tr(u8"没有选择任何文件。")); + } +} + +void QSimulationBPImageMultiProduction::onpushButtonL1ASelectBtnClicked() { QString fileNames = QFileDialog::getSaveFileName( this, // 父窗口 @@ -61,7 +97,25 @@ void QSimulationBPImageMultiProduction::onpushButtonImageSelectClicked() // 如果用户选择了文件 if (!fileNames.isEmpty()) { - this->ui->lineEditImagePath->setText(fileNames); + this->ui->lineEditL1AProductionPath->setText(fileNames); + } + else { + QMessageBox::information(this, tr(u8"没有选择文件"), tr(u8"没有选择任何文件。")); + } +} + +void QSimulationBPImageMultiProduction::onpushButtonL2SelectSelectClicked() +{ + QString fileNames = QFileDialog::getSaveFileName( + this, // 父窗口 + tr(u8"选择影像文件"), // 标题 + QString(), // 默认路径 + tr(u8"All Files(*)") // 文件过滤器 + ); + + // 如果用户选择了文件 + if (!fileNames.isEmpty()) { + this->ui->lineEditL2ProductionPath->setText(fileNames); } else { QMessageBox::information(this, tr(u8"没有选择文件"), tr(u8"没有选择任何文件。")); @@ -70,10 +124,22 @@ void QSimulationBPImageMultiProduction::onpushButtonImageSelectClicked() void QSimulationBPImageMultiProduction::onbtnaccepted() { + QString L1ADataPath = this->ui->lineEditL1AProductionPath->text().trimmed(); + QString L2DataPath = this->ui->lineEditL2ProductionPath->text().trimmed(); + QString looktablePath = this->ui->lineEditLookTablePath->text().trimmed(); + QString imgNetPath = this->ui->lineEditImageNetPath->text().trimmed(); + QString echoDataPath = this->ui->lineEditEchoPath->text().trimmed(); + + + + + + + this->hide(); - QString echofile = this->ui->lineEditEchoPath->text().trimmed(); - QString outImageFolder = getParantFromPath(this->ui->lineEditImagePath->text().trimmed()); - QString imagename = getFileNameFromPath(this->ui->lineEditImagePath->text().trimmed()); + QString echofile = echoDataPath; + QString outImageFolder = getParantFromPath(L2DataPath); + QString imagename = getFileNameFromPath(L2DataPath); std::shared_ptr echoL0ds(new EchoL0Dataset); echoL0ds->Open(echofile); @@ -86,53 +152,31 @@ void QSimulationBPImageMultiProduction::onbtnaccepted() imagL1->setFs(echoL0ds->getFs()); imagL1->setLookSide(echoL0ds->getLookSide()); - if (ui->checkBox->isChecked()) { - gdalImage imgxyzimg(ui->lineEdit->text().trimmed()); - imagL1->OpenOrNew(outImageFolder, imagename, imgxyzimg.height, imgxyzimg.width); - } - else { - imagL1->OpenOrNew(outImageFolder, imagename, echoL0ds->getPluseCount(), echoL0ds->getPlusePoints()); - } - + gdalImage imgxyzimg(imgNetPath); + imagL1->OpenOrNew(outImageFolder, imagename, imgxyzimg.height, imgxyzimg.width); + qDebug() << u8"成像中"; TBPImageAlgCls TBPimag; TBPimag.setEchoL0(echoL0ds); TBPimag.setImageL1(imagL1); long cpucore_num = std::thread::hardware_concurrency(); TBPimag.setGPU(true); - TBPimag.ProcessWithGridNet(cpucore_num,ui->lineEdit->text().trimmed()); - + TBPimag.ProcessWithGridNet(cpucore_num, imgNetPath); + qDebug() << u8"系统几何校正中"; + + + ResampleEChoDataFromGeoEcho(imagL1->getImageRasterPath(), looktablePath, L1ADataPath); + this->show(); + QMessageBox::information(this,u8"成像",u8"成像结束"); + + } void QSimulationBPImageMultiProduction::onbtnrejected() { this->close(); } - -void QSimulationBPImageMultiProduction::oncheckboxTrigged(int) -{ - this->ui->lineEdit->setEnabled(this->ui->checkBox->isChecked()); - this->ui->GridNetBtn->setEnabled(this->ui->checkBox->isChecked()); - -} - -void QSimulationBPImageMultiProduction::onpushButtonGridNetSelectClicked( ) -{ - QString fileNames = QFileDialog::getOpenFileName( - this, // 父窗口 - tr(u8"选择影像文件"), // 标题 - QString(), // 默认路径 - tr(u8"All Files(*);;dat(*.dat);;tif(*.tif);;tiff(*.tiff)") // 文件过滤器 - ); - - // 如果用户选择了文件 - if (!fileNames.isEmpty()) { - this->ui->lineEdit->setText(fileNames); - } - else { - QMessageBox::information(this, tr(u8"没有选择文件"), tr(u8"没有选择任何文件。")); - } -} + \ No newline at end of file diff --git a/Toolbox/SimulationSARTool/SARImage/QSimulationBPImageMultiProduction.h b/Toolbox/SimulationSARTool/SARImage/QSimulationBPImageMultiProduction.h index dc84ee7..45222a6 100644 --- a/Toolbox/SimulationSARTool/SARImage/QSimulationBPImageMultiProduction.h +++ b/Toolbox/SimulationSARTool/SARImage/QSimulationBPImageMultiProduction.h @@ -19,12 +19,13 @@ public: public slots: void onpushButtonEchoSelectClicked(); - void onpushButtonImageSelectClicked(); + void onpushButtonLookTableBtnClicked(); + void onpushButtonGridNetBtnSelectClicked(); + void onpushButtonL1ASelectBtnClicked(); + void onpushButtonL2SelectSelectClicked(); void onbtnaccepted(); void onbtnrejected(); - - void oncheckboxTrigged(int); - void onpushButtonGridNetSelectClicked( ); + private: Ui::QSimulationBPImageMultiProductionClass* ui; diff --git a/Toolbox/SimulationSARTool/SARImage/QSimulationBPImageMultiProduction.ui b/Toolbox/SimulationSARTool/SARImage/QSimulationBPImageMultiProduction.ui index a3e110a..fd5d9fd 100644 --- a/Toolbox/SimulationSARTool/SARImage/QSimulationBPImageMultiProduction.ui +++ b/Toolbox/SimulationSARTool/SARImage/QSimulationBPImageMultiProduction.ui @@ -32,7 +32,7 @@ - 鍥炴尝鍦板潃锛 + 鍥炴尝鍦板潃锛 @@ -75,23 +75,14 @@ - - - - 0 - 30 - - + - 鍥惧儚缃戞牸 - - - true + 鎴愬儚鍖哄煙缃戞牸锛 - + true @@ -125,6 +116,108 @@ + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + 鏌ユ壘琛細 + + + + + + + true + + + + 0 + 30 + + + + D:\Programme\vs2022\RasterMergeTest\simulationData\demdataset\demxyz.bin + + + + + + + true + + + + 0 + 30 + + + + 閫夋嫨 + + + + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + 1绾т骇鍝侊細 + + + + + + + true + + + + 0 + 30 + + + + D:\Programme\vs2022\RasterMergeTest\simulationData\demdataset\demxyz.bin + + + + + + + true + + + + 0 + 30 + + + + 閫夋嫨 + + + + + + @@ -143,12 +236,12 @@ - 浠跨湡鍥惧儚锛 + 2绾т骇鍝侊細 - + 0 @@ -161,7 +254,7 @@ - + 0 diff --git a/Toolbox/SimulationSARTool/SimulationSARTool.cpp b/Toolbox/SimulationSARTool/SimulationSARTool.cpp index a9b9d11..8361b9d 100644 --- a/Toolbox/SimulationSARTool/SimulationSARTool.cpp +++ b/Toolbox/SimulationSARTool/SimulationSARTool.cpp @@ -12,7 +12,7 @@ #include "QCreateInSARImagePlaneXYZRDialog.h" #include "QLookTableResampleFromWGS84ToRange.h" #include "QSARSimulationComplexEchoDataDialog.h" - +#include "QSimulationBPImageMultiProduction.h" SARSimlulationRFPCToolButton::SARSimlulationRFPCToolButton(QWidget* parent) { @@ -240,9 +240,6 @@ void QLookTableResampleFromWGS84ToRangeToolButton::run() dialog->show(); } - - - //QSARSimulationComplexEchoDataDialog QSARSimulationComplexEchoDataDialogToolButton::QSARSimulationComplexEchoDataDialogToolButton(QWidget* parent) @@ -261,3 +258,20 @@ void QSARSimulationComplexEchoDataDialogToolButton::run() QSARSimulationComplexEchoDataDialog* dialog = new QSARSimulationComplexEchoDataDialog; dialog->show(); } + +QSimulationBPImageMultiProductionToolButton::QSimulationBPImageMultiProductionToolButton(QWidget* parent) +{ + this->toolPath = QVector(0); + this->toolPath.push_back(u8"成像工具库"); + this->toolname = QString(u8"1-2级产品生产"); +} + +QSimulationBPImageMultiProductionToolButton::~QSimulationBPImageMultiProductionToolButton() +{ +} + +void QSimulationBPImageMultiProductionToolButton::run() +{ + QSimulationBPImageMultiProduction* dialog = new QSimulationBPImageMultiProduction; + dialog->show(); +} diff --git a/Toolbox/SimulationSARTool/SimulationSARTool.h b/Toolbox/SimulationSARTool/SimulationSARTool.h index 1a6212c..011b236 100644 --- a/Toolbox/SimulationSARTool/SimulationSARTool.h +++ b/Toolbox/SimulationSARTool/SimulationSARTool.h @@ -165,4 +165,13 @@ public: }; +class SIMULATIONSARTOOL_EXPORT QSimulationBPImageMultiProductionToolButton : public QToolAbstract { + Q_OBJECT +public: + QSimulationBPImageMultiProductionToolButton(QWidget* parent = nullptr); + ~QSimulationBPImageMultiProductionToolButton(); +public: + virtual void run() override; + +}; From fbb2a3707eacdf6179508e7541995b7425059106 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=A2=9E=E8=BE=89?= <3045316072@qq.com> Date: Tue, 8 Apr 2025 12:06:27 +0800 Subject: [PATCH 26/44] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=8A=A0=E8=BD=BD=E8=BF=87=E5=A4=A7=E6=97=B6=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BaseTool/gdalImageComplexOperator.cpp | 41 +- .../SARImage/ImageNetOperator.cpp | 13 +- .../QSARSimulationComplexEchoDataDialog.cpp | 4 +- .../SimulationSARTool/SimulationSARTool.cpp | 40 +- .../ImageNetOperator.cpp | 912 ++++++++++++++++++ 5 files changed, 976 insertions(+), 34 deletions(-) create mode 100644 enc_temp_folder/3775b1ace76665ec73ebcf8cc5579a/ImageNetOperator.cpp diff --git a/BaseCommonLibrary/BaseTool/gdalImageComplexOperator.cpp b/BaseCommonLibrary/BaseTool/gdalImageComplexOperator.cpp index bc8a0a9..9d746f3 100644 --- a/BaseCommonLibrary/BaseTool/gdalImageComplexOperator.cpp +++ b/BaseCommonLibrary/BaseTool/gdalImageComplexOperator.cpp @@ -269,20 +269,41 @@ Eigen::MatrixXcd gdalImageComplex::getDataComplex(int start_row, int start_col, // 读取波段信息,假设是复数类型 int nXSize = cols_count; poBand->GetXSize(); int nYSize = rows_count; poBand->GetYSize(); - - double* databuffer = new double[nXSize * nYSize * 2]; - poBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, databuffer, cols_count, - rows_count, GDT_CFloat64, 0, 0); - GDALClose((GDALDatasetH)poDataset); Eigen::MatrixXcd rasterData(nYSize, nXSize); // 使用Eigen的MatrixXcd - for (size_t i = 0; i < nYSize; i++) { - for (size_t j = 0; j < nXSize; j++) { - rasterData(i, j) = std::complex(databuffer[i * nXSize * 2 + j * 2], - databuffer[i * nXSize * 2 + j * 2 + 1]); + if (this->getDataType() == GDT_CFloat64) + { + long long pixelCount =long long( nXSize) *long long( nYSize); + double* databuffer = new double[pixelCount * 2]; + poBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, databuffer, cols_count, rows_count, GDT_CFloat64, 0, 0); + GDALClose((GDALDatasetH)poDataset); + + for (long long i = 0; i < nYSize; i++) { + for (long long j = 0; j < nXSize; j++) { + rasterData(i, j) = std::complex(databuffer[i * nXSize * 2 + j * 2], + databuffer[i * nXSize * 2 + j * 2 + 1]); + } } + + delete[] databuffer; + } + else if(this->getDataType()==GDT_CFloat32) + { + long long pixelCount = long long(nXSize) * long long(nYSize); + float* databuffer = new float[pixelCount * 2]; + poBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, databuffer, cols_count, rows_count, GDT_CFloat32, 0, 0); + GDALClose((GDALDatasetH)poDataset); + + for (long long i = 0; i < nYSize; i++) { + for (long long j = 0; j < nXSize; j++) { + rasterData(i, j) = std::complex(databuffer[i * nXSize * 2 + j * 2], + databuffer[i * nXSize * 2 + j * 2 + 1]); + } + } + + delete[] databuffer; } - delete[] databuffer; + return rasterData; } diff --git a/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.cpp b/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.cpp index f75c122..5995b9f 100644 --- a/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.cpp +++ b/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.cpp @@ -789,17 +789,18 @@ int ResampleEChoDataFromGeoEcho(QString L2echodataPath, QString RangeLooktablePa gdalImage looktable(RangeLooktablePath); gdalImageComplex l1adata = CreategdalImageComplexNoProj(L1AEchoDataPath, looktable.height, looktable.width, 1, true); - Eigen::MatrixXd imglonArr = looktable.getData(0, 0, looktable.height, looktable.width, 1); - Eigen::MatrixXd imglatArr = looktable.getData(0, 0, looktable.height, looktable.width, 2); + Eigen::MatrixXcd echoArr = echodata.getDataComplex(0, 0, echodata.height, echodata.width, 1); + + + Eigen::MatrixXd imglonArr = looktable.getData(0, 0, looktable.height, looktable.width, 1); + Eigen::MatrixXd imglatArr = looktable.getData(0, 0, looktable.height, looktable.width, 2); Eigen::MatrixXcd l1aArr= l1adata.getDataComplex(0, 0, l1adata.height, l1adata.width, 1); l1aArr = l1aArr.array() * 0; long imgheight = looktable.height; long imgwidth = looktable.width; - - for (long i = 0; i < imgheight; i++) { printf("\rGEC: process:%f precent\t\t\t",i*100.0/imgheight); for (long j = 0; j < imgwidth; j++) { @@ -898,6 +899,10 @@ int ResampleEChoDataFromGeoEcho(QString L2echodataPath, QString RangeLooktablePa } l1adata.saveImage(l1aArr, 0, 0, 1); + + + + return 0; } diff --git a/Toolbox/SimulationSARTool/SARImage/QSARSimulationComplexEchoDataDialog.cpp b/Toolbox/SimulationSARTool/SARImage/QSARSimulationComplexEchoDataDialog.cpp index 48a8d51..c5b8b7b 100644 --- a/Toolbox/SimulationSARTool/SARImage/QSARSimulationComplexEchoDataDialog.cpp +++ b/Toolbox/SimulationSARTool/SARImage/QSARSimulationComplexEchoDataDialog.cpp @@ -40,7 +40,7 @@ void QSARSimulationComplexEchoDataDialog::onpushButtonEchoDataSelect_clicked() // 如果用户选择了文件 if (!fileNames.isEmpty()) { QString message = "选择的文件有:\n"; - this->ui->lineEditL1AEchoDataPath->setText(fileNames); + this->ui->lineEditEchoDataPath->setText(fileNames); } else { QMessageBox::information(this, tr(u8"没有选择文件"), tr(u8"没有选择任何文件。")); @@ -58,7 +58,7 @@ void QSARSimulationComplexEchoDataDialog::onpushButtonLookTableSelect_clicked() // 如果用户选择了文件 if (!fileNames.isEmpty()) { QString message = "选择的文件有:\n"; - this->ui->lineEditL1AEchoDataPath->setText(fileNames); + this->ui->lineEditLookTablePath->setText(fileNames); } else { QMessageBox::information(this, tr(u8"没有选择文件"), tr(u8"没有选择任何文件。")); diff --git a/Toolbox/SimulationSARTool/SimulationSARTool.cpp b/Toolbox/SimulationSARTool/SimulationSARTool.cpp index 8361b9d..0d16cc6 100644 --- a/Toolbox/SimulationSARTool/SimulationSARTool.cpp +++ b/Toolbox/SimulationSARTool/SimulationSARTool.cpp @@ -14,6 +14,28 @@ #include "QSARSimulationComplexEchoDataDialog.h" #include "QSimulationBPImageMultiProduction.h" + +void RegisterPreToolBox(LAMPMainWidget::RasterMainWidget* mainwindows, ToolBoxWidget* toolbox) +{ + emit toolbox->addBoxToolItemSIGNAL(new SARSimlulationRFPCToolButton(toolbox)); // 300 + emit toolbox->addBoxToolItemSIGNAL(new SARSimulationTBPImageToolButton(toolbox)); + emit toolbox->addBoxToolItemSIGNAL(new QSimulationSAROrbitModelToolButton(toolbox)); + emit toolbox->addBoxToolItemSIGNAL(new LookTableComputerClassToolButton(toolbox)); + emit toolbox->addBoxToolItemSIGNAL(new QCreateSARIntensityByLookTableToolButton(toolbox)); + emit toolbox->addBoxToolItemSIGNAL(new QtSimulationGeoSARSigma0ToolButton(toolbox)); + emit toolbox->addBoxToolItemSIGNAL(new QtLinearToIntenisityToolButton(toolbox)); + emit toolbox->addBoxToolItemSIGNAL(new InitCreateImageXYZToolButton(toolbox)); + emit toolbox->addBoxToolItemSIGNAL(new ImagePlaneAtiInterpToolButton(toolbox)); + emit toolbox->addBoxToolItemSIGNAL(new QCreateInSARImagePlaneXYZRToolButton(toolbox)); + emit toolbox->addBoxToolItemSIGNAL(new QInSARBPImageToolButton(toolbox)); + emit toolbox->addBoxToolItemSIGNAL(new QLookTableResampleFromWGS84ToRangeToolButton(toolbox)); + emit toolbox->addBoxToolItemSIGNAL(new QSARSimulationComplexEchoDataDialogToolButton(toolbox)); + emit toolbox->addBoxToolItemSIGNAL(new QSimulationBPImageMultiProductionToolButton(toolbox)); + +} + + + SARSimlulationRFPCToolButton::SARSimlulationRFPCToolButton(QWidget* parent) { this->toolPath = QVector(0); @@ -72,24 +94,6 @@ void QSimulationSAROrbitModelToolButton::excute() -void RegisterPreToolBox(LAMPMainWidget::RasterMainWidget* mainwindows, ToolBoxWidget* toolbox) -{ - emit toolbox->addBoxToolItemSIGNAL(new SARSimlulationRFPCToolButton(toolbox)); // 300 - emit toolbox->addBoxToolItemSIGNAL(new SARSimulationTBPImageToolButton(toolbox)); - emit toolbox->addBoxToolItemSIGNAL(new QSimulationSAROrbitModelToolButton(toolbox)); - emit toolbox->addBoxToolItemSIGNAL(new LookTableComputerClassToolButton(toolbox)); - emit toolbox->addBoxToolItemSIGNAL(new QCreateSARIntensityByLookTableToolButton(toolbox)); - emit toolbox->addBoxToolItemSIGNAL(new QtSimulationGeoSARSigma0ToolButton(toolbox)); - emit toolbox->addBoxToolItemSIGNAL(new QtLinearToIntenisityToolButton(toolbox)); - emit toolbox->addBoxToolItemSIGNAL(new InitCreateImageXYZToolButton(toolbox)); - emit toolbox->addBoxToolItemSIGNAL(new ImagePlaneAtiInterpToolButton(toolbox)); - emit toolbox->addBoxToolItemSIGNAL(new QCreateInSARImagePlaneXYZRToolButton(toolbox)); - emit toolbox->addBoxToolItemSIGNAL(new QInSARBPImageToolButton(toolbox)); - emit toolbox->addBoxToolItemSIGNAL(new QLookTableResampleFromWGS84ToRangeToolButton(toolbox)); - emit toolbox->addBoxToolItemSIGNAL(new QSARSimulationComplexEchoDataDialogToolButton(toolbox)); - -} - LookTableComputerClassToolButton::LookTableComputerClassToolButton(QWidget* parent) { this->toolPath = QVector(0); diff --git a/enc_temp_folder/3775b1ace76665ec73ebcf8cc5579a/ImageNetOperator.cpp b/enc_temp_folder/3775b1ace76665ec73ebcf8cc5579a/ImageNetOperator.cpp new file mode 100644 index 0000000..f75c122 --- /dev/null +++ b/enc_temp_folder/3775b1ace76665ec73ebcf8cc5579a/ImageNetOperator.cpp @@ -0,0 +1,912 @@ +#include "ImageNetOperator.h" +#include "LogInfoCls.h" +#include "PrintMsgToQDebug.h" +#include +#include "ImageOperatorBase.h" +#include "GPUBaseTool.h" +#include "GPUBPImageNet.cuh" +#include "BaseTool.h" +#include "BaseConstVariable.h" + + +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 Pxs((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); + std::shared_ptr Pys((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); + std::shared_ptr Pzs((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); + std::shared_ptr AntDirectX((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); + std::shared_ptr AntDirectY((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); + std::shared_ptr AntDirectZ((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); + + { + long colnum = 19; + std::shared_ptr antpos =readDataArr(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 d_Pxs((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice); + std::shared_ptr d_Pys((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice); + std::shared_ptr d_Pzs((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice); + std::shared_ptr d_AntDirectX((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice); + std::shared_ptr d_AntDirectY((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice); + std::shared_ptr 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 demx = readDataArr(outimgxyz, 0, startcolidx, prfcount, tempechocol, 1, GDALREADARRCOPYMETHOD::VARIABLEMETHOD); + std::shared_ptr demy = readDataArr(outimgxyz, 0, startcolidx, prfcount, tempechocol, 2, GDALREADARRCOPYMETHOD::VARIABLEMETHOD); + std::shared_ptr demz = readDataArr(outimgxyz, 0, startcolidx, prfcount, tempechocol, 3, GDALREADARRCOPYMETHOD::VARIABLEMETHOD); + + std::shared_ptr h_demx((double*)mallocCUDAHost(sizeof(double) * prfcount * tempechocol), FreeCUDAHost); + std::shared_ptr h_demy((double*)mallocCUDAHost(sizeof(double) * prfcount * tempechocol), FreeCUDAHost); + std::shared_ptr 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 d_demx((double*)mallocCUDADevice(sizeof(double) * prfcount * tempechocol), FreeCUDADevice); + std::shared_ptr d_demy((double*)mallocCUDADevice(sizeof(double) * prfcount * tempechocol), FreeCUDADevice); + std::shared_ptr 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 demllx = readDataArr(outimgll, 0, startcolidx, prfcount, tempechocol, 1, GDALREADARRCOPYMETHOD::VARIABLEMETHOD); + std::shared_ptr demlly = readDataArr(outimgll, 0, startcolidx, prfcount, tempechocol, 2, GDALREADARRCOPYMETHOD::VARIABLEMETHOD); + std::shared_ptr demllz = readDataArr(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() << "---------------------------------------------------------------------------------"; +} + +bool OverlapCheck(QString& ImageLLPath, QString& ImageDEMPath) +{ + // 检查DEM是否是WGS84坐标系 + //long demEPSG = GetEPSGFromRasterFile(ImageDEMPath); + //if (demEPSG != 4326) { + // qDebug() << u8"DEM坐标系不是WGS84坐标系,ESPG:"<< demEPSG; + // return false; + //} + + gdalImage demimg(ImageDEMPath); + gdalImage imgll(ImageLLPath); + + long imgheight = imgll.height; + long imgwidth = imgll.width; + Eigen::MatrixXd imglonArr = imgll.getData(0, 0, imgheight, imgwidth, 1); + 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 j = 0; j < imgwidth; j++) + { + double lon = imglonArr(i, j); // X + double lat = imglatArr(i, j); // Y + Landpoint point = demimg.getRow_Col(lon, lat); + imglonArr(i, j) = point.lon; + imglatArr(i, j) = point.lat; + } + } + + double minX = imglonArr.minCoeff(); + double maxX = imglonArr.maxCoeff(); + double minY = imglatArr.minCoeff(); + double maxY = imglatArr.maxCoeff(); + + //打印范围 + qDebug() << u8"dem 的范围:"; + qDebug() << u8"minX:"<demimg.width - 1 || minY<1 || maxY>demimg.height - 1) { + return false; + } + else { + return true; + } + + + +} + +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); + gdalImage outimgll = CreategdalImageDouble(outImageLLAPath, imgll.height, imgll.width, 4, true, true); // 经度、纬度、高程、斜距 + + long imgheight = imgll.height; + long imgwidth = imgll.width; + + Eigen::MatrixXd imglonArr = imgll.getData(0, 0, imgheight, imgwidth, 1); + 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 imgRArr = Eigen::MatrixXd::Zero(imgheight, imgwidth); + + outimgll.saveImage(imglonArr, 0, 0, 1); + outimgll.saveImage(imglatArr, 0, 0, 2); + + + double minX = imglonArr.minCoeff(); + double maxX = imglonArr.maxCoeff(); + double minY = imglatArr.minCoeff(); + 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; + + + 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++) { + double lon = imglonArr(i, j); + double lat = imglatArr(i, j); + Landpoint point = demimg.getRow_Col(lon, lat); + + if (point.lon<1 || point.lon>demimg.width - 2 || point.lat < 1 || point.lat - 2) { + continue; + } + else {} + + Landpoint p0, p11, p21, p12, p22; + + p0.lon = point.lon; + p0.lat = point.lat; + + p11.lon = floor(p0.lon); + p11.lat = floor(p0.lat); + p11.ati = demArr(long(p11.lat), long(p11.lon)); + + p12.lon = ceil(p0.lon); + p12.lat = floor(p0.lat); + p12.ati = demArr(long(p12.lat), long(p12.lon)); + + p21.lon = floor(p0.lon); + p21.lat = ceil(p0.lat); + p21.ati = demArr(long(p21.lat), long(p21.lon)); + + p22.lon = ceil(p0.lon); + p22.lat = ceil(p0.lat); + p22.ati = demArr(long(p22.lat), long(p22.lon)); + + p0.lon = p0.lon - p11.lon; + p0.lat = p0.lat - p11.lat; + + p12.lon = p12.lon - p11.lon; + p12.lat = p12.lat - p11.lat; + + p21.lon = p21.lon - p11.lon; + p21.lat = p21.lat - p11.lat; + + p22.lon = p22.lon - p11.lon; + p22.lat = p22.lat - p11.lat; + + p11.lon = p11.lon - p11.lon; + p11.lat = p11.lat - p11.lat; + + p0.ati=Bilinear_interpolation(p0, p11, p21, p12, p22); + imgatiArr(i, j) = p0.ati; + + } + } + 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 Pxs((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); + std::shared_ptr Pys((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); + std::shared_ptr Pzs((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); + std::shared_ptr AntDirectX((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); + std::shared_ptr AntDirectY((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); + std::shared_ptr AntDirectZ((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); + + { + long colnum = 19; + std::shared_ptr antpos = readDataArr(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"插值完成"; +} + + +void InterploateClipAtiByRefDEM(QString ImageLLPath, QString& ImageDEMPath, QString& outImageLLAPath, QString& InEchoGPSDataPath) { + + gdalImage demimg(ImageDEMPath); + gdalImage imgll(ImageLLPath); + + // 裁剪 + long imgheight = imgll.height; + long imgwidth = imgll.width; + + long minRow = -1; + long maxRow = imgheight; + long minCol = -1; + long maxCol = imgwidth; + + + Eigen::MatrixXd imglonArr = imgll.getData(0, 0, imgheight, imgwidth, 1); + Eigen::MatrixXd imglatArr = imgll.getData(0, 0, imgheight, imgwidth, 2); + +#pragma omp parallel for + for (long i = 0; i < imgheight; i++) { + for (long j = 0; j < imgwidth; j++) { + double lon = imglonArr(i, j); + double lat = imglatArr(i, j); + Landpoint point = demimg.getRow_Col(lon, lat); + imglonArr(i, j) = point.lon; + imglatArr(i, j) = point.lat; + } + } + + // 开始逐行扫描 + + bool minRowFlag=true, maxRowFlag= true, minColFlag = true, maxColFlag = true; + + for (long i = 0; i < imgheight; i++) { + for (long j = 0; j < imgwidth; j++) { + if (imglonArr(i, j) > 0 && minRowFlag) { + minRowFlag = false; + minRow = i; + break; + } + if (imglonArr(i, j) < imgheight) { + maxRow = i; + } + } + } + + for (long j = 0; j < imgwidth; j++) { + for (long i = 0; i < imgheight; i++) { + if (imglatArr(i, j) > 0 && minColFlag) { + minColFlag = false; + minCol = j; + break; + } + if (imglatArr(i, j) < imgheight) { + maxCol = j; + } + } + } + + + long RowCount = maxRow - minRow; + long ColCount = maxCol - minCol; + + gdalImage outimgll = CreategdalImageDouble(outImageLLAPath, RowCount, ColCount, 4, true, true); // 经度、纬度、高程、斜距 + + imgheight = outimgll.height; + imgwidth = outimgll.width; + + imglonArr = imgll.getData(minRow, minCol, RowCount, ColCount, 1); + imglatArr = imgll.getData(minRow, minCol, RowCount, ColCount, 2); + + Eigen::MatrixXd demArr = demimg.getData(0, 0, demimg.height, demimg.width, 1); + + 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); + + + double minX = imglonArr.minCoeff(); + double maxX = imglonArr.maxCoeff(); + double minY = imglatArr.minCoeff(); + 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; + + + 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++) { + double lon = imglonArr(i, j); + double lat = imglatArr(i, j); + Landpoint point = demimg.getRow_Col(lon, lat); + + if (point.lon<1 || point.lon>demimg.width - 2 || point.lat < 1 || point.lat - 2) { + continue; + } + else {} + + Landpoint p0, p11, p21, p12, p22; + + p0.lon = point.lon; + p0.lat = point.lat; + + p11.lon = floor(p0.lon); + p11.lat = floor(p0.lat); + p11.ati = demArr(long(p11.lat), long(p11.lon)); + + p12.lon = ceil(p0.lon); + p12.lat = floor(p0.lat); + p12.ati = demArr(long(p12.lat), long(p12.lon)); + + p21.lon = floor(p0.lon); + p21.lat = ceil(p0.lat); + p21.ati = demArr(long(p21.lat), long(p21.lon)); + + p22.lon = ceil(p0.lon); + p22.lat = ceil(p0.lat); + p22.ati = demArr(long(p22.lat), long(p22.lon)); + + p0.lon = p0.lon - p11.lon; + p0.lat = p0.lat - p11.lat; + + p12.lon = p12.lon - p11.lon; + p12.lat = p12.lat - p11.lat; + + p21.lon = p21.lon - p11.lon; + p21.lat = p21.lat - p11.lat; + + p22.lon = p22.lon - p11.lon; + p22.lat = p22.lat - p11.lat; + + p11.lon = p11.lon - p11.lon; + p11.lat = p11.lat - p11.lat; + + p0.ati = Bilinear_interpolation(p0, p11, p21, p12, p22); + imgatiArr(i, j) = p0.ati; + } + } + + 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 Pxs((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); + std::shared_ptr Pys((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); + std::shared_ptr Pzs((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); + std::shared_ptr AntDirectX((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); + std::shared_ptr AntDirectY((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); + std::shared_ptr AntDirectZ((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); + + { + long colnum = 19; + std::shared_ptr antpos = readDataArr(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 = minRow; prfid < maxRow; 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-minRow, j); + LLA.lat = imglatArr(prfid - minRow, j); + LLA.ati = imgatiArr(prfid - minRow, j); + + LLA2XYZ(LLA, XYZ); + + R = sqrt(pow(Px - XYZ.x, 2) + + pow(Py - XYZ.y, 2) + + pow(Pz - XYZ.z, 2)); + imgRArr(prfid - minRow, j) = R; + } + } + + outimgll.saveImage(imgRArr, 0, 0, 4); + + qDebug() << u8"插值完成"; + +} + + + + +int ReflectTable_WGS2Range(QString dem_rc_path,QString outOriSimTiffPath,QString ori_sim_count_tiffPath,long OriHeight,long OriWidth) +{ + gdalImage sim_rc(dem_rc_path); + gdalImage sim_sar_img = CreategdalImage(outOriSimTiffPath, OriHeight, OriWidth, 2, sim_rc.gt, sim_rc.projection, false);// 注意这里保留仿真结果 + for (int max_rows_ids = 0; max_rows_ids < OriHeight; max_rows_ids = max_rows_ids + 1000) { + Eigen::MatrixXd sim_sar = sim_sar_img.getData(max_rows_ids, 0, 1000, OriWidth, 1); + Eigen::MatrixXd sim_sarc = sim_sar_img.getData(max_rows_ids, 0, 1000, OriWidth, 2); + sim_sar = sim_sar.array() * 0 - 9999; + sim_sarc = sim_sar.array() * 0 - 9999; + sim_sar_img.saveImage(sim_sar, max_rows_ids, 0, 1); + sim_sar_img.saveImage(sim_sarc, max_rows_ids, 0, 2); + } + sim_sar_img.setNoDataValue(-9999, 1); + sim_sar_img.setNoDataValue(-9999, 2); + int conver_lines = 5000; + int line_invert = 4000;// 计算重叠率 + int line_offset = 60; + // 逐区域迭代计算 + omp_lock_t lock; + omp_init_lock(&lock); // 初始化互斥锁 + int allCount = 0; + + for (int max_rows_ids = 0; max_rows_ids < sim_rc.height; max_rows_ids = max_rows_ids + line_invert) { + Eigen::MatrixXd dem_r = sim_rc.getData(max_rows_ids, 0, conver_lines, sim_rc.width, 1); + Eigen::MatrixXd dem_c = sim_rc.getData(max_rows_ids, 0, conver_lines, sim_rc.width, 2); + int dem_rows_num = dem_r.rows(); + int dem_cols_num = dem_r.cols(); + // 更新插值经纬度 + //Eigen::MatrixXd dem_lon = dem_r; + //Eigen::MatrixXd dem_lat = dem_c; + // 构建索引 更新经纬度并更新链 + + int temp_r, temp_c; + + int min_row = dem_r.minCoeff() + 1; + int max_row = dem_r.maxCoeff() + 1; + + if (max_row < 0) { + continue; + } + + int len_rows = max_row - min_row; + min_row = min_row < 0 ? 0 : min_row; + Eigen::MatrixXd sar_r = sim_sar_img.getData(min_row, 0, len_rows, OriWidth, 1); + Eigen::MatrixXd sar_c = sim_sar_img.getData(min_row, 0, len_rows, OriWidth, 2); + len_rows = sar_r.rows(); + + +#pragma omp parallel for num_threads(8) // NEW ADD + for (int i = 0; i < dem_rows_num - 1; i++) { + for (int j = 0; j < dem_cols_num - 1; j++) { + Point3 p, p1, p2, p3, p4; + Landpoint lp1, lp2, lp3, lp4; + lp1 = sim_rc.getLandPoint(i + max_rows_ids, j, 0); + lp2 = sim_rc.getLandPoint(i + max_rows_ids, j + 1, 0); + lp3 = sim_rc.getLandPoint(i + 1 + max_rows_ids, j + 1, 0); + lp4 = sim_rc.getLandPoint(i + 1 + max_rows_ids, j, 0); + + p1 = { dem_r(i,j),dem_c(i,j) }; + p2 = { dem_r(i,j + 1),dem_c(i,j + 1) }; + p3 = { dem_r(i + 1,j + 1),dem_c(i + 1,j + 1) }; + p4 = { dem_r(i + 1,j),dem_c(i + 1,j) }; + + //if (angle(i, j) >= 90 && angle(i, j + 1) >= 90 && angle(i + 1, j) >= 90 && angle(i + 1, j + 1) >= 90) { + // continue; + //} + + double temp_min_r = dem_r.block(i, j, 2, 2).minCoeff(); + double temp_max_r = dem_r.block(i, j, 2, 2).maxCoeff(); + double temp_min_c = dem_c.block(i, j, 2, 2).minCoeff(); + double temp_max_c = dem_c.block(i, j, 2, 2).maxCoeff(); + if ((int(temp_min_r) != int(temp_max_r)) && (int(temp_min_c) != int(temp_max_c))) { + for (int ii = int(temp_min_r); ii <= temp_max_r + 1; ii++) { + for (int jj = int(temp_min_c); jj < temp_max_c + 1; jj++) { + if (ii < min_row || ii - min_row >= len_rows || jj < 0 || jj >= OriWidth) { + continue; + } + p = { double(ii),double(jj),0 }; + //if (PtInRect(p, p1, p2, p3, p4)) { + p1.z = lp1.lon; + p2.z = lp2.lon; + p3.z = lp3.lon; + p4.z = lp4.lon; + + p = invBilinear(p, p1, p2, p3, p4); + if (isnan(p.z)) { + continue; + } + + if (p.x < 0) { + continue; + } + double mean = (p1.z + p2.z + p3.z + p4.z) / 4; + if (p.z > p1.z && p.z > p2.z && p.z > p3.z && p.z > p4.z) { + p.z = mean; + } + if (p.z < p1.z && p.z < p2.z && p.z < p3.z && p.z < p4.z) { + p.z = mean; + } + sar_r(ii - min_row, jj) = p.z; + p1.z = lp1.lat; + p2.z = lp2.lat; + p3.z = lp3.lat; + p4.z = lp4.lat; + p = invBilinear(p, p1, p2, p3, p4); + if (isnan(p.z)) { + continue; + } + + if (p.x < 0) { + continue; + } + mean = (p1.z + p2.z + p3.z + p4.z) / 4; + if (p.z > p1.z && p.z > p2.z && p.z > p3.z && p.z > p4.z) { + p.z = mean; + } + if (p.z < p1.z && p.z < p2.z && p.z < p3.z && p.z < p4.z) { + p.z = mean; + } + sar_c(ii - min_row, jj) = p.z; + //} + } + } + + } + } + } + + omp_set_lock(&lock); //获得互斥器 + sim_sar_img.saveImage(sar_r, min_row, 0, 1); + sim_sar_img.saveImage(sar_c, min_row, 0, 2); + allCount = allCount + conver_lines; + qDebug() << "rows:\t" << allCount << "/" << sim_rc.height << "\t computing.....\t" ; + omp_unset_lock(&lock); //释放互斥器 + + + } + + return 0; +} + + + +int ResampleEChoDataFromGeoEcho(QString L2echodataPath, QString RangeLooktablePath, QString L1AEchoDataPath) { + gdalImageComplex echodata(L2echodataPath); + gdalImage looktable(RangeLooktablePath); + gdalImageComplex l1adata = CreategdalImageComplexNoProj(L1AEchoDataPath, looktable.height, looktable.width, 1, true); + + Eigen::MatrixXd imglonArr = looktable.getData(0, 0, looktable.height, looktable.width, 1); + Eigen::MatrixXd imglatArr = looktable.getData(0, 0, looktable.height, looktable.width, 2); + + Eigen::MatrixXcd echoArr = echodata.getDataComplex(0, 0, echodata.height, echodata.width, 1); + Eigen::MatrixXcd l1aArr= l1adata.getDataComplex(0, 0, l1adata.height, l1adata.width, 1); + l1aArr = l1aArr.array() * 0; + + long imgheight = looktable.height; + long imgwidth = looktable.width; + + + for (long i = 0; i < imgheight; i++) { + printf("\rGEC: process:%f precent\t\t\t",i*100.0/imgheight); + for (long j = 0; j < imgwidth; j++) { + double lon = imglonArr(i, j); + double lat = imglatArr(i, j); + Landpoint point = echodata.getRow_Col(lon, lat); + + if (point.lon<1 || point.lon>echodata.width - 2 || point.lat < 1 || point.lat >echodata.height - 2) { + continue; + } + else {} + // 实部插值 + { + Landpoint p0, p11, p21, p12, p22; + + p0.lon = point.lon; + p0.lat = point.lat; + + p11.lon = floor(p0.lon); + p11.lat = floor(p0.lat); + p11.ati = echoArr(long(p11.lat), long(p11.lon)).real(); + + p12.lon = ceil(p0.lon); + p12.lat = floor(p0.lat); + p12.ati = echoArr(long(p12.lat), long(p12.lon)).real(); + + p21.lon = floor(p0.lon); + p21.lat = ceil(p0.lat); + p21.ati = echoArr(long(p21.lat), long(p21.lon)).real(); + + p22.lon = ceil(p0.lon); + p22.lat = ceil(p0.lat); + p22.ati = echoArr(long(p22.lat), long(p22.lon)).real(); + + p0.lon = p0.lon - p11.lon; + p0.lat = p0.lat - p11.lat; + + p12.lon = p12.lon - p11.lon; + p12.lat = p12.lat - p11.lat; + + p21.lon = p21.lon - p11.lon; + p21.lat = p21.lat - p11.lat; + + p22.lon = p22.lon - p11.lon; + p22.lat = p22.lat - p11.lat; + + p11.lon = p11.lon - p11.lon; + p11.lat = p11.lat - p11.lat; + + p0.ati = Bilinear_interpolation(p0, p11, p21, p12, p22); + l1aArr(i, j).real(p0.ati); + } + //虚部插值 + { + Landpoint p0, p11, p21, p12, p22; + + p0.lon = point.lon; + p0.lat = point.lat; + + p11.lon = floor(p0.lon); + p11.lat = floor(p0.lat); + p11.ati = echoArr(long(p11.lat), long(p11.lon)).imag(); + + p12.lon = ceil(p0.lon); + p12.lat = floor(p0.lat); + p12.ati = echoArr(long(p12.lat), long(p12.lon)).imag(); + + p21.lon = floor(p0.lon); + p21.lat = ceil(p0.lat); + p21.ati = echoArr(long(p21.lat), long(p21.lon)).imag(); + + p22.lon = ceil(p0.lon); + p22.lat = ceil(p0.lat); + p22.ati = echoArr(long(p22.lat), long(p22.lon)).imag(); + + p0.lon = p0.lon - p11.lon; + p0.lat = p0.lat - p11.lat; + + p12.lon = p12.lon - p11.lon; + p12.lat = p12.lat - p11.lat; + + p21.lon = p21.lon - p11.lon; + p21.lat = p21.lat - p11.lat; + + p22.lon = p22.lon - p11.lon; + p22.lat = p22.lat - p11.lat; + + p11.lon = p11.lon - p11.lon; + p11.lat = p11.lat - p11.lat; + + p0.ati = Bilinear_interpolation(p0, p11, p21, p12, p22); + l1aArr(i, j).imag(p0.ati); + } + + } + } + + l1adata.saveImage(l1aArr, 0, 0, 1); + return 0; + +} + + + + + + + + + From 1e2b811c73acdbf0f9d35c455f36c238259636d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=A2=9E=E8=BE=89?= <3045316072@qq.com> Date: Tue, 8 Apr 2025 12:19:06 +0800 Subject: [PATCH 27/44] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=BA=E5=88=86?= =?UTF-8?q?=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SARImage/ImageNetOperator.cpp | 211 +++++++++--------- 1 file changed, 106 insertions(+), 105 deletions(-) diff --git a/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.cpp b/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.cpp index 5995b9f..0c8095d 100644 --- a/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.cpp +++ b/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.cpp @@ -788,118 +788,119 @@ int ResampleEChoDataFromGeoEcho(QString L2echodataPath, QString RangeLooktablePa gdalImageComplex echodata(L2echodataPath); gdalImage looktable(RangeLooktablePath); gdalImageComplex l1adata = CreategdalImageComplexNoProj(L1AEchoDataPath, looktable.height, looktable.width, 1, true); - - - Eigen::MatrixXcd echoArr = echodata.getDataComplex(0, 0, echodata.height, echodata.width, 1); + long blockHeight = Memory1GB / looktable.width / 8 * 2; - Eigen::MatrixXd imglonArr = looktable.getData(0, 0, looktable.height, looktable.width, 1); - Eigen::MatrixXd imglatArr = looktable.getData(0, 0, looktable.height, looktable.width, 2); - Eigen::MatrixXcd l1aArr= l1adata.getDataComplex(0, 0, l1adata.height, l1adata.width, 1); - l1aArr = l1aArr.array() * 0; - - long imgheight = looktable.height; - long imgwidth = looktable.width; - for (long i = 0; i < imgheight; i++) { - printf("\rGEC: process:%f precent\t\t\t",i*100.0/imgheight); - for (long j = 0; j < imgwidth; j++) { - double lon = imglonArr(i, j); - double lat = imglatArr(i, j); - Landpoint point = echodata.getRow_Col(lon, lat); + for (long startRow = 0; startRow < looktable.height; startRow = startRow + blockHeight) { + printf("\rGEC: process:%f precent\t\t\t", startRow * 100.0 / looktable.height); + blockHeight = blockHeight + startRow < looktable.height ? blockHeight : looktable.height - startRow; + Eigen::MatrixXd imglonArr = looktable.getData(startRow, 0, blockHeight, looktable.width, 1); + Eigen::MatrixXd imglatArr = looktable.getData(startRow, 0, blockHeight, looktable.width, 2); + Eigen::MatrixXcd l1aArr = l1adata.getDataComplex(0, 0, blockHeight, l1adata.width, 1); + l1aArr = l1aArr.array() * 0; + + long imgheight = blockHeight; + long imgwidth = looktable.width; + for (long i = 0; i < imgheight; i++) { + + for (long j = 0; j < imgwidth; j++) { + double lon = imglonArr(i, j); + double lat = imglatArr(i, j); + Landpoint point = echodata.getRow_Col(lon, lat); + + if (point.lon<1 || point.lon>echodata.width - 2 || point.lat < 1 || point.lat >echodata.height - 2) { + continue; + } + else {} + // 实部插值 + { + Landpoint p0, p11, p21, p12, p22; + + p0.lon = point.lon; + p0.lat = point.lat; + + p11.lon = floor(p0.lon); + p11.lat = floor(p0.lat); + p11.ati = echoArr(long(p11.lat), long(p11.lon)).real(); + + p12.lon = ceil(p0.lon); + p12.lat = floor(p0.lat); + p12.ati = echoArr(long(p12.lat), long(p12.lon)).real(); + + p21.lon = floor(p0.lon); + p21.lat = ceil(p0.lat); + p21.ati = echoArr(long(p21.lat), long(p21.lon)).real(); + + p22.lon = ceil(p0.lon); + p22.lat = ceil(p0.lat); + p22.ati = echoArr(long(p22.lat), long(p22.lon)).real(); + + p0.lon = p0.lon - p11.lon; + p0.lat = p0.lat - p11.lat; + + p12.lon = p12.lon - p11.lon; + p12.lat = p12.lat - p11.lat; + + p21.lon = p21.lon - p11.lon; + p21.lat = p21.lat - p11.lat; + + p22.lon = p22.lon - p11.lon; + p22.lat = p22.lat - p11.lat; + + p11.lon = p11.lon - p11.lon; + p11.lat = p11.lat - p11.lat; + + p0.ati = Bilinear_interpolation(p0, p11, p21, p12, p22); + l1aArr(i, j).real(p0.ati); + } + //虚部插值 + { + Landpoint p0, p11, p21, p12, p22; + + p0.lon = point.lon; + p0.lat = point.lat; + + p11.lon = floor(p0.lon); + p11.lat = floor(p0.lat); + p11.ati = echoArr(long(p11.lat), long(p11.lon)).imag(); + + p12.lon = ceil(p0.lon); + p12.lat = floor(p0.lat); + p12.ati = echoArr(long(p12.lat), long(p12.lon)).imag(); + + p21.lon = floor(p0.lon); + p21.lat = ceil(p0.lat); + p21.ati = echoArr(long(p21.lat), long(p21.lon)).imag(); + + p22.lon = ceil(p0.lon); + p22.lat = ceil(p0.lat); + p22.ati = echoArr(long(p22.lat), long(p22.lon)).imag(); + + p0.lon = p0.lon - p11.lon; + p0.lat = p0.lat - p11.lat; + + p12.lon = p12.lon - p11.lon; + p12.lat = p12.lat - p11.lat; + + p21.lon = p21.lon - p11.lon; + p21.lat = p21.lat - p11.lat; + + p22.lon = p22.lon - p11.lon; + p22.lat = p22.lat - p11.lat; + + p11.lon = p11.lon - p11.lon; + p11.lat = p11.lat - p11.lat; + + p0.ati = Bilinear_interpolation(p0, p11, p21, p12, p22); + l1aArr(i, j).imag(p0.ati); + } - if (point.lon<1 || point.lon>echodata.width - 2 || point.lat < 1 || point.lat >echodata.height - 2) { - continue; } - else {} - // 实部插值 - { - Landpoint p0, p11, p21, p12, p22; - - p0.lon = point.lon; - p0.lat = point.lat; - - p11.lon = floor(p0.lon); - p11.lat = floor(p0.lat); - p11.ati = echoArr(long(p11.lat), long(p11.lon)).real(); - - p12.lon = ceil(p0.lon); - p12.lat = floor(p0.lat); - p12.ati = echoArr(long(p12.lat), long(p12.lon)).real(); - - p21.lon = floor(p0.lon); - p21.lat = ceil(p0.lat); - p21.ati = echoArr(long(p21.lat), long(p21.lon)).real(); - - p22.lon = ceil(p0.lon); - p22.lat = ceil(p0.lat); - p22.ati = echoArr(long(p22.lat), long(p22.lon)).real(); - - p0.lon = p0.lon - p11.lon; - p0.lat = p0.lat - p11.lat; - - p12.lon = p12.lon - p11.lon; - p12.lat = p12.lat - p11.lat; - - p21.lon = p21.lon - p11.lon; - p21.lat = p21.lat - p11.lat; - - p22.lon = p22.lon - p11.lon; - p22.lat = p22.lat - p11.lat; - - p11.lon = p11.lon - p11.lon; - p11.lat = p11.lat - p11.lat; - - p0.ati = Bilinear_interpolation(p0, p11, p21, p12, p22); - l1aArr(i, j).real(p0.ati); - } - //虚部插值 - { - Landpoint p0, p11, p21, p12, p22; - - p0.lon = point.lon; - p0.lat = point.lat; - - p11.lon = floor(p0.lon); - p11.lat = floor(p0.lat); - p11.ati = echoArr(long(p11.lat), long(p11.lon)).imag(); - - p12.lon = ceil(p0.lon); - p12.lat = floor(p0.lat); - p12.ati = echoArr(long(p12.lat), long(p12.lon)).imag(); - - p21.lon = floor(p0.lon); - p21.lat = ceil(p0.lat); - p21.ati = echoArr(long(p21.lat), long(p21.lon)).imag(); - - p22.lon = ceil(p0.lon); - p22.lat = ceil(p0.lat); - p22.ati = echoArr(long(p22.lat), long(p22.lon)).imag(); - - p0.lon = p0.lon - p11.lon; - p0.lat = p0.lat - p11.lat; - - p12.lon = p12.lon - p11.lon; - p12.lat = p12.lat - p11.lat; - - p21.lon = p21.lon - p11.lon; - p21.lat = p21.lat - p11.lat; - - p22.lon = p22.lon - p11.lon; - p22.lat = p22.lat - p11.lat; - - p11.lon = p11.lon - p11.lon; - p11.lat = p11.lat - p11.lat; - - p0.ati = Bilinear_interpolation(p0, p11, p21, p12, p22); - l1aArr(i, j).imag(p0.ati); - } - } - } - l1adata.saveImage(l1aArr, 0, 0, 1); - + l1adata.saveImage(l1aArr, startRow, 0, 1); + } From 6b87c8431192714dbdb4b81a577f75a7354041f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=A2=9E=E8=BE=89?= <3045316072@qq.com> Date: Wed, 9 Apr 2025 15:06:06 +0800 Subject: [PATCH 28/44] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=861-3=E7=BA=A7?= =?UTF-8?q?=E5=9B=9E=E6=B3=A2=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BaseCommonLibrary/BaseCommonLibrary.vcxproj | 4 +- .../BaseTool/gdalImageComplexOperator.cpp | 50 +- .../SARImage/ImageNetOperator.cpp | 3 +- .../QSARSimulationComplexEchoDataDialog.cpp | 2 +- .../QSimulationBPImageMultiProduction.cpp | 31 +- .../QSimulationBPImageMultiProduction.ui | 10 +- .../SimulationSAR/GPURFPC.cu | 25 +- .../SimulationSAR/TBPImageAlgCls.cpp | 6 +- .../SimulationSARTool.vcxproj | 6 +- .../SimulationSARTool.vcxproj.filters | 4 +- .../ImageNetOperator.cpp | 912 ------------------ 11 files changed, 93 insertions(+), 960 deletions(-) delete mode 100644 enc_temp_folder/3775b1ace76665ec73ebcf8cc5579a/ImageNetOperator.cpp diff --git a/BaseCommonLibrary/BaseCommonLibrary.vcxproj b/BaseCommonLibrary/BaseCommonLibrary.vcxproj index d7c78f9..002db1e 100644 --- a/BaseCommonLibrary/BaseCommonLibrary.vcxproj +++ b/BaseCommonLibrary/BaseCommonLibrary.vcxproj @@ -220,11 +220,13 @@ pch.h true true - NotSet + NoExtensions true stdcpp14 stdc11 true + false + MaxSpeed Windows diff --git a/BaseCommonLibrary/BaseTool/gdalImageComplexOperator.cpp b/BaseCommonLibrary/BaseTool/gdalImageComplexOperator.cpp index 9d746f3..6676b66 100644 --- a/BaseCommonLibrary/BaseTool/gdalImageComplexOperator.cpp +++ b/BaseCommonLibrary/BaseTool/gdalImageComplexOperator.cpp @@ -121,20 +121,48 @@ void gdalImageComplex::saveImage(Eigen::MatrixXcd data, int start_row, int start int datarows = data.rows(); int datacols = data.cols(); - double* databuffer = new double[data.size() * 2]; - for (int i = 0; i < data.rows(); i++) { - for (int j = 0; j < data.cols(); j++) { - databuffer[i * data.cols() * 2 + j * 2] = data(i, j).real(); - databuffer[i * data.cols() * 2 + j * 2 + 1] = data(i, j).imag(); + if (this->getDataType() == GDT_CFloat64) + { + + double* databuffer = new double[data.size() * 2]; + for (int i = 0; i < data.rows(); i++) { + for (int j = 0; j < data.cols(); j++) { + databuffer[i * data.cols() * 2 + j * 2] = data(i, j).real(); + databuffer[i * data.cols() * 2 + j * 2 + 1] = data(i, j).imag(); + } } + + // poDstDS->RasterIO(GF_Write,start_col, start_row, datacols, datarows, databuffer, datacols, + // datarows, GDT_Float32,band_ids, num,0,0,0); + poDstDS->GetRasterBand(band_ids)->RasterIO(GF_Write, start_col, start_row, datacols, datarows, + databuffer, datacols, datarows, GDT_CFloat64, 0, 0); + GDALFlushCache(poDstDS); + delete databuffer; + + } + else if (this->getDataType() == GDT_CFloat32) { + + float* databuffer = new float[data.size() * 2]; + for (int i = 0; i < data.rows(); i++) { + for (int j = 0; j < data.cols(); j++) { + databuffer[i * data.cols() * 2 + j * 2] = float(data(i, j).real()); + databuffer[i * data.cols() * 2 + j * 2 + 1] =float( data(i, j).imag()); + } + } + + // poDstDS->RasterIO(GF_Write,start_col, start_row, datacols, datarows, databuffer, datacols, + // datarows, GDT_Float32,band_ids, num,0,0,0); + poDstDS->GetRasterBand(band_ids)->RasterIO(GF_Write, start_col, start_row, datacols, datarows, + databuffer, datacols, datarows, GDT_CFloat32, 0, 0); + GDALFlushCache(poDstDS); + delete databuffer; + } + else { + throw std::exception("gdalImageComplex::saveImage: data type error"); } - // poDstDS->RasterIO(GF_Write,start_col, start_row, datacols, datarows, databuffer, datacols, - // datarows, GDT_Float32,band_ids, num,0,0,0); - poDstDS->GetRasterBand(band_ids)->RasterIO(GF_Write, start_col, start_row, datacols, datarows, - databuffer, datacols, datarows, GDT_CFloat64, 0, 0); - GDALFlushCache(poDstDS); - delete databuffer; + + GDALClose((GDALDatasetH)poDstDS); GDALDestroy(); // or, DllMain at DLL_PROCESS_DETACH omp_unset_lock(&lock); // diff --git a/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.cpp b/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.cpp index 0c8095d..36a432d 100644 --- a/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.cpp +++ b/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.cpp @@ -787,7 +787,7 @@ int ReflectTable_WGS2Range(QString dem_rc_path,QString outOriSimTiffPath,QStrin int ResampleEChoDataFromGeoEcho(QString L2echodataPath, QString RangeLooktablePath, QString L1AEchoDataPath) { gdalImageComplex echodata(L2echodataPath); gdalImage looktable(RangeLooktablePath); - gdalImageComplex l1adata = CreategdalImageComplexNoProj(L1AEchoDataPath, looktable.height, looktable.width, 1, true); + gdalImageComplex l1adata(L1AEchoDataPath); Eigen::MatrixXcd echoArr = echodata.getDataComplex(0, 0, echodata.height, echodata.width, 1); long blockHeight = Memory1GB / looktable.width / 8 * 2; @@ -802,6 +802,7 @@ int ResampleEChoDataFromGeoEcho(QString L2echodataPath, QString RangeLooktablePa long imgheight = blockHeight; long imgwidth = looktable.width; +#pragma omp parallel for for (long i = 0; i < imgheight; i++) { for (long j = 0; j < imgwidth; j++) { diff --git a/Toolbox/SimulationSARTool/SARImage/QSARSimulationComplexEchoDataDialog.cpp b/Toolbox/SimulationSARTool/SARImage/QSARSimulationComplexEchoDataDialog.cpp index c5b8b7b..39648cb 100644 --- a/Toolbox/SimulationSARTool/SARImage/QSARSimulationComplexEchoDataDialog.cpp +++ b/Toolbox/SimulationSARTool/SARImage/QSARSimulationComplexEchoDataDialog.cpp @@ -51,7 +51,7 @@ void QSARSimulationComplexEchoDataDialog::onpushButtonLookTableSelect_clicked() { QString fileNames = QFileDialog::getOpenFileName( this, // 父窗口 - tr(u8"选择L1A回波数据文件"), // 标题 + tr(u8"选择查找表回波数据文件"), // 标题 QString(), // 默认路径 tr(ENVI_FILE_FORMAT_FILTER) // 文件过滤器 ); diff --git a/Toolbox/SimulationSARTool/SARImage/QSimulationBPImageMultiProduction.cpp b/Toolbox/SimulationSARTool/SARImage/QSimulationBPImageMultiProduction.cpp index 6c7a5ab..3fe90be 100644 --- a/Toolbox/SimulationSARTool/SARImage/QSimulationBPImageMultiProduction.cpp +++ b/Toolbox/SimulationSARTool/SARImage/QSimulationBPImageMultiProduction.cpp @@ -130,12 +130,6 @@ void QSimulationBPImageMultiProduction::onbtnaccepted() QString imgNetPath = this->ui->lineEditImageNetPath->text().trimmed(); QString echoDataPath = this->ui->lineEditEchoPath->text().trimmed(); - - - - - - this->hide(); QString echofile = echoDataPath; QString outImageFolder = getParantFromPath(L2DataPath); @@ -164,15 +158,32 @@ void QSimulationBPImageMultiProduction::onbtnaccepted() TBPimag.ProcessWithGridNet(cpucore_num, imgNetPath); qDebug() << u8"系统几何校正中"; + // 处理成像映射 + std::shared_ptr< SARSimulationImageL1Dataset> imagL2(new SARSimulationImageL1Dataset); + imagL2->setCenterAngle(echoL0ds->getCenterAngle()); + imagL2->setCenterFreq(echoL0ds->getCenterFreq()); + imagL2->setNearRange(echoL0ds->getNearRange()); + imagL2->setRefRange((echoL0ds->getNearRange() + echoL0ds->getFarRange()) / 2); + imagL2->setFarRange(echoL0ds->getFarRange()); + imagL2->setFs(echoL0ds->getFs()); + imagL2->setLookSide(echoL0ds->getLookSide()); + + + QString outL1AImageFolder = getParantFromPath(L1ADataPath); + QString L1Aimagename = getFileNameFromPath(L1ADataPath); + + gdalImage Looktableimg(looktablePath); + imagL2->OpenOrNew(outL1AImageFolder, L1Aimagename, Looktableimg.height, Looktableimg.width); + + QString L1AEchoDataPath =imagL2->getImageRasterPath(); + + ResampleEChoDataFromGeoEcho(imagL1->getImageRasterPath(), looktablePath, L1AEchoDataPath); - ResampleEChoDataFromGeoEcho(imagL1->getImageRasterPath(), looktablePath, L1ADataPath); this->show(); QMessageBox::information(this,u8"成像",u8"成像结束"); - - - + } void QSimulationBPImageMultiProduction::onbtnrejected() diff --git a/Toolbox/SimulationSARTool/SARImage/QSimulationBPImageMultiProduction.ui b/Toolbox/SimulationSARTool/SARImage/QSimulationBPImageMultiProduction.ui index fd5d9fd..4712523 100644 --- a/Toolbox/SimulationSARTool/SARImage/QSimulationBPImageMultiProduction.ui +++ b/Toolbox/SimulationSARTool/SARImage/QSimulationBPImageMultiProduction.ui @@ -45,7 +45,7 @@ - D:\Programme\vs2022\RasterMergeTest\LAMPCAE_SCANE-all-scane\GF3_Simulation.xml + D:/FZSimulation/LTDQ/Input/xml/xml/165665/echodata/LT1B_DQ_165665_Simulation.xml @@ -93,7 +93,7 @@ - D:\Programme\vs2022\RasterMergeTest\simulationData\demdataset\demxyz.bin + D:/FZSimulation/LTDQ/Input/xml/xml/165665/InSARImageXYZ/LT1A_165665_InSAR_ImageXYZ_looktable.bin @@ -144,7 +144,7 @@ - D:\Programme\vs2022\RasterMergeTest\simulationData\demdataset\demxyz.bin + D:/FZSimulation/LTDQ/Input/DEM1/looktable165665/LT1A_65665_looktable_Range.bin @@ -195,7 +195,7 @@ - D:\Programme\vs2022\RasterMergeTest\simulationData\demdataset\demxyz.bin + D:/FZSimulation/LTDQ/Input/xml/xml/165665/TBPImageProduction/L1/LT1A_165665_L1A @@ -249,7 +249,7 @@ - D:\Programme\vs2022\RasterMergeTest\LAMPCAE_SCANE-all-scane\BPImage\GF3BPImage + D:/FZSimulation/LTDQ/Input/xml/xml/165665/TBPImageProduction/L2/LT1A_165665_L2 diff --git a/Toolbox/SimulationSARTool/SimulationSAR/GPURFPC.cu b/Toolbox/SimulationSARTool/SimulationSAR/GPURFPC.cu index 62b3a4d..afd43d1 100644 --- a/Toolbox/SimulationSARTool/SimulationSAR/GPURFPC.cu +++ b/Toolbox/SimulationSARTool/SimulationSAR/GPURFPC.cu @@ -537,23 +537,23 @@ __global__ void Kernel_Computer_R_amp_NoAntPattern( // 计算斜距衰减 - float antDirectR = sqrtf(antp.antDirectX * antp.antDirectX - + antp.antDirectY * antp.antDirectY - + antp.antDirectZ * antp.antDirectZ); + //float antDirectR = sqrtf(antp.antDirectX * antp.antDirectX + // + antp.antDirectY * antp.antDirectY + // + antp.antDirectZ * antp.antDirectZ); - float diectAngle = -1 * (RstX * antp.antDirectX + - RstY * antp.antDirectY + - RstZ * antp.antDirectZ) / (antDirectR); + //float diectAngle = -1 * (RstX * antp.antDirectX + + // RstY * antp.antDirectY + + // RstZ * antp.antDirectZ) / (antDirectR); - diectAngle = acosf(diectAngle);// 弧度制 - diectAngle = diectAngle * GainWeight; + //diectAngle = acosf(diectAngle);// 弧度制 + //diectAngle = diectAngle * GainWeight; float ampGain = 1; - ampGain = 2 * maxGain * (1 - (powf(diectAngle, 2) / 6) - + (powf(diectAngle, 4) / 120) - - (powf(diectAngle, 6) / 5040)); //dB + //ampGain = 2 * maxGain * (1 - (powf(diectAngle, 2) / 6) + // + (powf(diectAngle, 4) / 120) + // - (powf(diectAngle, 6) / 5040)); //dB - ampGain = powf(10.0, ampGain / 10.0); + //ampGain = powf(10.0, ampGain / 10.0); ampGain = ampGain / (PI4POW2 * powf(RstR, 4)); // 反射强度 float sigma = GPU_getSigma0dB(sigma0Params, localangle); @@ -571,7 +571,6 @@ __global__ void Kernel_Computer_R_amp_NoAntPattern( d_temp_R[idx] =static_cast(temp_R); return; } - } } } diff --git a/Toolbox/SimulationSARTool/SimulationSAR/TBPImageAlgCls.cpp b/Toolbox/SimulationSARTool/SimulationSAR/TBPImageAlgCls.cpp index dc32916..6d50619 100644 --- a/Toolbox/SimulationSARTool/SimulationSAR/TBPImageAlgCls.cpp +++ b/Toolbox/SimulationSARTool/SimulationSAR/TBPImageAlgCls.cpp @@ -81,6 +81,10 @@ ErrorCode TBPImageAlgCls::ProcessWithGridNet(long num_thread,QString xyzRasterPa } + // 澶勭悊鎴愬儚鏄犲皠 + CopyProjectTransformMatrixFromRasterAToRasterB(this->outRasterXYZPath, this->L1ds->getImageRasterPath()); + + qDebug() << u8"棰戝煙鍥炴尝-> 鏃跺煙鍥炴尝 缁撴潫"; if (GPURUN) { @@ -91,8 +95,6 @@ ErrorCode TBPImageAlgCls::ProcessWithGridNet(long num_thread,QString xyzRasterPa return ErrorCode::FAIL; } - // 澶勭悊鎴愬儚鏄犲皠 - CopyProjectTransformMatrixFromRasterAToRasterB(this->outRasterXYZPath, this->L1ds->getImageRasterPath()); return ErrorCode::SUCCESS; diff --git a/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj b/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj index b228c81..62fb8ce 100644 --- a/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj +++ b/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj @@ -124,8 +124,10 @@ true stdcpp14 stdc11 - true - false + false + true + NoExtensions + MaxSpeed true diff --git a/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj.filters b/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj.filters index e53b120..b8510fa 100644 --- a/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj.filters +++ b/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj.filters @@ -151,10 +151,10 @@ PowerSimulationIncoherent - + SARImage - + SARImage diff --git a/enc_temp_folder/3775b1ace76665ec73ebcf8cc5579a/ImageNetOperator.cpp b/enc_temp_folder/3775b1ace76665ec73ebcf8cc5579a/ImageNetOperator.cpp deleted file mode 100644 index f75c122..0000000 --- a/enc_temp_folder/3775b1ace76665ec73ebcf8cc5579a/ImageNetOperator.cpp +++ /dev/null @@ -1,912 +0,0 @@ -#include "ImageNetOperator.h" -#include "LogInfoCls.h" -#include "PrintMsgToQDebug.h" -#include -#include "ImageOperatorBase.h" -#include "GPUBaseTool.h" -#include "GPUBPImageNet.cuh" -#include "BaseTool.h" -#include "BaseConstVariable.h" - - -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 Pxs((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); - std::shared_ptr Pys((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); - std::shared_ptr Pzs((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); - std::shared_ptr AntDirectX((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); - std::shared_ptr AntDirectY((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); - std::shared_ptr AntDirectZ((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); - - { - long colnum = 19; - std::shared_ptr antpos =readDataArr(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 d_Pxs((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice); - std::shared_ptr d_Pys((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice); - std::shared_ptr d_Pzs((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice); - std::shared_ptr d_AntDirectX((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice); - std::shared_ptr d_AntDirectY((double*)mallocCUDADevice(sizeof(double) * prfcount), FreeCUDADevice); - std::shared_ptr 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 demx = readDataArr(outimgxyz, 0, startcolidx, prfcount, tempechocol, 1, GDALREADARRCOPYMETHOD::VARIABLEMETHOD); - std::shared_ptr demy = readDataArr(outimgxyz, 0, startcolidx, prfcount, tempechocol, 2, GDALREADARRCOPYMETHOD::VARIABLEMETHOD); - std::shared_ptr demz = readDataArr(outimgxyz, 0, startcolidx, prfcount, tempechocol, 3, GDALREADARRCOPYMETHOD::VARIABLEMETHOD); - - std::shared_ptr h_demx((double*)mallocCUDAHost(sizeof(double) * prfcount * tempechocol), FreeCUDAHost); - std::shared_ptr h_demy((double*)mallocCUDAHost(sizeof(double) * prfcount * tempechocol), FreeCUDAHost); - std::shared_ptr 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 d_demx((double*)mallocCUDADevice(sizeof(double) * prfcount * tempechocol), FreeCUDADevice); - std::shared_ptr d_demy((double*)mallocCUDADevice(sizeof(double) * prfcount * tempechocol), FreeCUDADevice); - std::shared_ptr 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 demllx = readDataArr(outimgll, 0, startcolidx, prfcount, tempechocol, 1, GDALREADARRCOPYMETHOD::VARIABLEMETHOD); - std::shared_ptr demlly = readDataArr(outimgll, 0, startcolidx, prfcount, tempechocol, 2, GDALREADARRCOPYMETHOD::VARIABLEMETHOD); - std::shared_ptr demllz = readDataArr(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() << "---------------------------------------------------------------------------------"; -} - -bool OverlapCheck(QString& ImageLLPath, QString& ImageDEMPath) -{ - // 检查DEM是否是WGS84坐标系 - //long demEPSG = GetEPSGFromRasterFile(ImageDEMPath); - //if (demEPSG != 4326) { - // qDebug() << u8"DEM坐标系不是WGS84坐标系,ESPG:"<< demEPSG; - // return false; - //} - - gdalImage demimg(ImageDEMPath); - gdalImage imgll(ImageLLPath); - - long imgheight = imgll.height; - long imgwidth = imgll.width; - Eigen::MatrixXd imglonArr = imgll.getData(0, 0, imgheight, imgwidth, 1); - 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 j = 0; j < imgwidth; j++) - { - double lon = imglonArr(i, j); // X - double lat = imglatArr(i, j); // Y - Landpoint point = demimg.getRow_Col(lon, lat); - imglonArr(i, j) = point.lon; - imglatArr(i, j) = point.lat; - } - } - - double minX = imglonArr.minCoeff(); - double maxX = imglonArr.maxCoeff(); - double minY = imglatArr.minCoeff(); - double maxY = imglatArr.maxCoeff(); - - //打印范围 - qDebug() << u8"dem 的范围:"; - qDebug() << u8"minX:"<demimg.width - 1 || minY<1 || maxY>demimg.height - 1) { - return false; - } - else { - return true; - } - - - -} - -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); - gdalImage outimgll = CreategdalImageDouble(outImageLLAPath, imgll.height, imgll.width, 4, true, true); // 经度、纬度、高程、斜距 - - long imgheight = imgll.height; - long imgwidth = imgll.width; - - Eigen::MatrixXd imglonArr = imgll.getData(0, 0, imgheight, imgwidth, 1); - 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 imgRArr = Eigen::MatrixXd::Zero(imgheight, imgwidth); - - outimgll.saveImage(imglonArr, 0, 0, 1); - outimgll.saveImage(imglatArr, 0, 0, 2); - - - double minX = imglonArr.minCoeff(); - double maxX = imglonArr.maxCoeff(); - double minY = imglatArr.minCoeff(); - 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; - - - 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++) { - double lon = imglonArr(i, j); - double lat = imglatArr(i, j); - Landpoint point = demimg.getRow_Col(lon, lat); - - if (point.lon<1 || point.lon>demimg.width - 2 || point.lat < 1 || point.lat - 2) { - continue; - } - else {} - - Landpoint p0, p11, p21, p12, p22; - - p0.lon = point.lon; - p0.lat = point.lat; - - p11.lon = floor(p0.lon); - p11.lat = floor(p0.lat); - p11.ati = demArr(long(p11.lat), long(p11.lon)); - - p12.lon = ceil(p0.lon); - p12.lat = floor(p0.lat); - p12.ati = demArr(long(p12.lat), long(p12.lon)); - - p21.lon = floor(p0.lon); - p21.lat = ceil(p0.lat); - p21.ati = demArr(long(p21.lat), long(p21.lon)); - - p22.lon = ceil(p0.lon); - p22.lat = ceil(p0.lat); - p22.ati = demArr(long(p22.lat), long(p22.lon)); - - p0.lon = p0.lon - p11.lon; - p0.lat = p0.lat - p11.lat; - - p12.lon = p12.lon - p11.lon; - p12.lat = p12.lat - p11.lat; - - p21.lon = p21.lon - p11.lon; - p21.lat = p21.lat - p11.lat; - - p22.lon = p22.lon - p11.lon; - p22.lat = p22.lat - p11.lat; - - p11.lon = p11.lon - p11.lon; - p11.lat = p11.lat - p11.lat; - - p0.ati=Bilinear_interpolation(p0, p11, p21, p12, p22); - imgatiArr(i, j) = p0.ati; - - } - } - 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 Pxs((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); - std::shared_ptr Pys((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); - std::shared_ptr Pzs((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); - std::shared_ptr AntDirectX((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); - std::shared_ptr AntDirectY((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); - std::shared_ptr AntDirectZ((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); - - { - long colnum = 19; - std::shared_ptr antpos = readDataArr(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"插值完成"; -} - - -void InterploateClipAtiByRefDEM(QString ImageLLPath, QString& ImageDEMPath, QString& outImageLLAPath, QString& InEchoGPSDataPath) { - - gdalImage demimg(ImageDEMPath); - gdalImage imgll(ImageLLPath); - - // 裁剪 - long imgheight = imgll.height; - long imgwidth = imgll.width; - - long minRow = -1; - long maxRow = imgheight; - long minCol = -1; - long maxCol = imgwidth; - - - Eigen::MatrixXd imglonArr = imgll.getData(0, 0, imgheight, imgwidth, 1); - Eigen::MatrixXd imglatArr = imgll.getData(0, 0, imgheight, imgwidth, 2); - -#pragma omp parallel for - for (long i = 0; i < imgheight; i++) { - for (long j = 0; j < imgwidth; j++) { - double lon = imglonArr(i, j); - double lat = imglatArr(i, j); - Landpoint point = demimg.getRow_Col(lon, lat); - imglonArr(i, j) = point.lon; - imglatArr(i, j) = point.lat; - } - } - - // 开始逐行扫描 - - bool minRowFlag=true, maxRowFlag= true, minColFlag = true, maxColFlag = true; - - for (long i = 0; i < imgheight; i++) { - for (long j = 0; j < imgwidth; j++) { - if (imglonArr(i, j) > 0 && minRowFlag) { - minRowFlag = false; - minRow = i; - break; - } - if (imglonArr(i, j) < imgheight) { - maxRow = i; - } - } - } - - for (long j = 0; j < imgwidth; j++) { - for (long i = 0; i < imgheight; i++) { - if (imglatArr(i, j) > 0 && minColFlag) { - minColFlag = false; - minCol = j; - break; - } - if (imglatArr(i, j) < imgheight) { - maxCol = j; - } - } - } - - - long RowCount = maxRow - minRow; - long ColCount = maxCol - minCol; - - gdalImage outimgll = CreategdalImageDouble(outImageLLAPath, RowCount, ColCount, 4, true, true); // 经度、纬度、高程、斜距 - - imgheight = outimgll.height; - imgwidth = outimgll.width; - - imglonArr = imgll.getData(minRow, minCol, RowCount, ColCount, 1); - imglatArr = imgll.getData(minRow, minCol, RowCount, ColCount, 2); - - Eigen::MatrixXd demArr = demimg.getData(0, 0, demimg.height, demimg.width, 1); - - 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); - - - double minX = imglonArr.minCoeff(); - double maxX = imglonArr.maxCoeff(); - double minY = imglatArr.minCoeff(); - 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; - - - 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++) { - double lon = imglonArr(i, j); - double lat = imglatArr(i, j); - Landpoint point = demimg.getRow_Col(lon, lat); - - if (point.lon<1 || point.lon>demimg.width - 2 || point.lat < 1 || point.lat - 2) { - continue; - } - else {} - - Landpoint p0, p11, p21, p12, p22; - - p0.lon = point.lon; - p0.lat = point.lat; - - p11.lon = floor(p0.lon); - p11.lat = floor(p0.lat); - p11.ati = demArr(long(p11.lat), long(p11.lon)); - - p12.lon = ceil(p0.lon); - p12.lat = floor(p0.lat); - p12.ati = demArr(long(p12.lat), long(p12.lon)); - - p21.lon = floor(p0.lon); - p21.lat = ceil(p0.lat); - p21.ati = demArr(long(p21.lat), long(p21.lon)); - - p22.lon = ceil(p0.lon); - p22.lat = ceil(p0.lat); - p22.ati = demArr(long(p22.lat), long(p22.lon)); - - p0.lon = p0.lon - p11.lon; - p0.lat = p0.lat - p11.lat; - - p12.lon = p12.lon - p11.lon; - p12.lat = p12.lat - p11.lat; - - p21.lon = p21.lon - p11.lon; - p21.lat = p21.lat - p11.lat; - - p22.lon = p22.lon - p11.lon; - p22.lat = p22.lat - p11.lat; - - p11.lon = p11.lon - p11.lon; - p11.lat = p11.lat - p11.lat; - - p0.ati = Bilinear_interpolation(p0, p11, p21, p12, p22); - imgatiArr(i, j) = p0.ati; - } - } - - 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 Pxs((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); - std::shared_ptr Pys((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); - std::shared_ptr Pzs((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); - std::shared_ptr AntDirectX((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); - std::shared_ptr AntDirectY((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); - std::shared_ptr AntDirectZ((double*)mallocCUDAHost(sizeof(double) * prfcount), FreeCUDAHost); - - { - long colnum = 19; - std::shared_ptr antpos = readDataArr(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 = minRow; prfid < maxRow; 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-minRow, j); - LLA.lat = imglatArr(prfid - minRow, j); - LLA.ati = imgatiArr(prfid - minRow, j); - - LLA2XYZ(LLA, XYZ); - - R = sqrt(pow(Px - XYZ.x, 2) + - pow(Py - XYZ.y, 2) + - pow(Pz - XYZ.z, 2)); - imgRArr(prfid - minRow, j) = R; - } - } - - outimgll.saveImage(imgRArr, 0, 0, 4); - - qDebug() << u8"插值完成"; - -} - - - - -int ReflectTable_WGS2Range(QString dem_rc_path,QString outOriSimTiffPath,QString ori_sim_count_tiffPath,long OriHeight,long OriWidth) -{ - gdalImage sim_rc(dem_rc_path); - gdalImage sim_sar_img = CreategdalImage(outOriSimTiffPath, OriHeight, OriWidth, 2, sim_rc.gt, sim_rc.projection, false);// 注意这里保留仿真结果 - for (int max_rows_ids = 0; max_rows_ids < OriHeight; max_rows_ids = max_rows_ids + 1000) { - Eigen::MatrixXd sim_sar = sim_sar_img.getData(max_rows_ids, 0, 1000, OriWidth, 1); - Eigen::MatrixXd sim_sarc = sim_sar_img.getData(max_rows_ids, 0, 1000, OriWidth, 2); - sim_sar = sim_sar.array() * 0 - 9999; - sim_sarc = sim_sar.array() * 0 - 9999; - sim_sar_img.saveImage(sim_sar, max_rows_ids, 0, 1); - sim_sar_img.saveImage(sim_sarc, max_rows_ids, 0, 2); - } - sim_sar_img.setNoDataValue(-9999, 1); - sim_sar_img.setNoDataValue(-9999, 2); - int conver_lines = 5000; - int line_invert = 4000;// 计算重叠率 - int line_offset = 60; - // 逐区域迭代计算 - omp_lock_t lock; - omp_init_lock(&lock); // 初始化互斥锁 - int allCount = 0; - - for (int max_rows_ids = 0; max_rows_ids < sim_rc.height; max_rows_ids = max_rows_ids + line_invert) { - Eigen::MatrixXd dem_r = sim_rc.getData(max_rows_ids, 0, conver_lines, sim_rc.width, 1); - Eigen::MatrixXd dem_c = sim_rc.getData(max_rows_ids, 0, conver_lines, sim_rc.width, 2); - int dem_rows_num = dem_r.rows(); - int dem_cols_num = dem_r.cols(); - // 更新插值经纬度 - //Eigen::MatrixXd dem_lon = dem_r; - //Eigen::MatrixXd dem_lat = dem_c; - // 构建索引 更新经纬度并更新链 - - int temp_r, temp_c; - - int min_row = dem_r.minCoeff() + 1; - int max_row = dem_r.maxCoeff() + 1; - - if (max_row < 0) { - continue; - } - - int len_rows = max_row - min_row; - min_row = min_row < 0 ? 0 : min_row; - Eigen::MatrixXd sar_r = sim_sar_img.getData(min_row, 0, len_rows, OriWidth, 1); - Eigen::MatrixXd sar_c = sim_sar_img.getData(min_row, 0, len_rows, OriWidth, 2); - len_rows = sar_r.rows(); - - -#pragma omp parallel for num_threads(8) // NEW ADD - for (int i = 0; i < dem_rows_num - 1; i++) { - for (int j = 0; j < dem_cols_num - 1; j++) { - Point3 p, p1, p2, p3, p4; - Landpoint lp1, lp2, lp3, lp4; - lp1 = sim_rc.getLandPoint(i + max_rows_ids, j, 0); - lp2 = sim_rc.getLandPoint(i + max_rows_ids, j + 1, 0); - lp3 = sim_rc.getLandPoint(i + 1 + max_rows_ids, j + 1, 0); - lp4 = sim_rc.getLandPoint(i + 1 + max_rows_ids, j, 0); - - p1 = { dem_r(i,j),dem_c(i,j) }; - p2 = { dem_r(i,j + 1),dem_c(i,j + 1) }; - p3 = { dem_r(i + 1,j + 1),dem_c(i + 1,j + 1) }; - p4 = { dem_r(i + 1,j),dem_c(i + 1,j) }; - - //if (angle(i, j) >= 90 && angle(i, j + 1) >= 90 && angle(i + 1, j) >= 90 && angle(i + 1, j + 1) >= 90) { - // continue; - //} - - double temp_min_r = dem_r.block(i, j, 2, 2).minCoeff(); - double temp_max_r = dem_r.block(i, j, 2, 2).maxCoeff(); - double temp_min_c = dem_c.block(i, j, 2, 2).minCoeff(); - double temp_max_c = dem_c.block(i, j, 2, 2).maxCoeff(); - if ((int(temp_min_r) != int(temp_max_r)) && (int(temp_min_c) != int(temp_max_c))) { - for (int ii = int(temp_min_r); ii <= temp_max_r + 1; ii++) { - for (int jj = int(temp_min_c); jj < temp_max_c + 1; jj++) { - if (ii < min_row || ii - min_row >= len_rows || jj < 0 || jj >= OriWidth) { - continue; - } - p = { double(ii),double(jj),0 }; - //if (PtInRect(p, p1, p2, p3, p4)) { - p1.z = lp1.lon; - p2.z = lp2.lon; - p3.z = lp3.lon; - p4.z = lp4.lon; - - p = invBilinear(p, p1, p2, p3, p4); - if (isnan(p.z)) { - continue; - } - - if (p.x < 0) { - continue; - } - double mean = (p1.z + p2.z + p3.z + p4.z) / 4; - if (p.z > p1.z && p.z > p2.z && p.z > p3.z && p.z > p4.z) { - p.z = mean; - } - if (p.z < p1.z && p.z < p2.z && p.z < p3.z && p.z < p4.z) { - p.z = mean; - } - sar_r(ii - min_row, jj) = p.z; - p1.z = lp1.lat; - p2.z = lp2.lat; - p3.z = lp3.lat; - p4.z = lp4.lat; - p = invBilinear(p, p1, p2, p3, p4); - if (isnan(p.z)) { - continue; - } - - if (p.x < 0) { - continue; - } - mean = (p1.z + p2.z + p3.z + p4.z) / 4; - if (p.z > p1.z && p.z > p2.z && p.z > p3.z && p.z > p4.z) { - p.z = mean; - } - if (p.z < p1.z && p.z < p2.z && p.z < p3.z && p.z < p4.z) { - p.z = mean; - } - sar_c(ii - min_row, jj) = p.z; - //} - } - } - - } - } - } - - omp_set_lock(&lock); //获得互斥器 - sim_sar_img.saveImage(sar_r, min_row, 0, 1); - sim_sar_img.saveImage(sar_c, min_row, 0, 2); - allCount = allCount + conver_lines; - qDebug() << "rows:\t" << allCount << "/" << sim_rc.height << "\t computing.....\t" ; - omp_unset_lock(&lock); //释放互斥器 - - - } - - return 0; -} - - - -int ResampleEChoDataFromGeoEcho(QString L2echodataPath, QString RangeLooktablePath, QString L1AEchoDataPath) { - gdalImageComplex echodata(L2echodataPath); - gdalImage looktable(RangeLooktablePath); - gdalImageComplex l1adata = CreategdalImageComplexNoProj(L1AEchoDataPath, looktable.height, looktable.width, 1, true); - - Eigen::MatrixXd imglonArr = looktable.getData(0, 0, looktable.height, looktable.width, 1); - Eigen::MatrixXd imglatArr = looktable.getData(0, 0, looktable.height, looktable.width, 2); - - Eigen::MatrixXcd echoArr = echodata.getDataComplex(0, 0, echodata.height, echodata.width, 1); - Eigen::MatrixXcd l1aArr= l1adata.getDataComplex(0, 0, l1adata.height, l1adata.width, 1); - l1aArr = l1aArr.array() * 0; - - long imgheight = looktable.height; - long imgwidth = looktable.width; - - - for (long i = 0; i < imgheight; i++) { - printf("\rGEC: process:%f precent\t\t\t",i*100.0/imgheight); - for (long j = 0; j < imgwidth; j++) { - double lon = imglonArr(i, j); - double lat = imglatArr(i, j); - Landpoint point = echodata.getRow_Col(lon, lat); - - if (point.lon<1 || point.lon>echodata.width - 2 || point.lat < 1 || point.lat >echodata.height - 2) { - continue; - } - else {} - // 实部插值 - { - Landpoint p0, p11, p21, p12, p22; - - p0.lon = point.lon; - p0.lat = point.lat; - - p11.lon = floor(p0.lon); - p11.lat = floor(p0.lat); - p11.ati = echoArr(long(p11.lat), long(p11.lon)).real(); - - p12.lon = ceil(p0.lon); - p12.lat = floor(p0.lat); - p12.ati = echoArr(long(p12.lat), long(p12.lon)).real(); - - p21.lon = floor(p0.lon); - p21.lat = ceil(p0.lat); - p21.ati = echoArr(long(p21.lat), long(p21.lon)).real(); - - p22.lon = ceil(p0.lon); - p22.lat = ceil(p0.lat); - p22.ati = echoArr(long(p22.lat), long(p22.lon)).real(); - - p0.lon = p0.lon - p11.lon; - p0.lat = p0.lat - p11.lat; - - p12.lon = p12.lon - p11.lon; - p12.lat = p12.lat - p11.lat; - - p21.lon = p21.lon - p11.lon; - p21.lat = p21.lat - p11.lat; - - p22.lon = p22.lon - p11.lon; - p22.lat = p22.lat - p11.lat; - - p11.lon = p11.lon - p11.lon; - p11.lat = p11.lat - p11.lat; - - p0.ati = Bilinear_interpolation(p0, p11, p21, p12, p22); - l1aArr(i, j).real(p0.ati); - } - //虚部插值 - { - Landpoint p0, p11, p21, p12, p22; - - p0.lon = point.lon; - p0.lat = point.lat; - - p11.lon = floor(p0.lon); - p11.lat = floor(p0.lat); - p11.ati = echoArr(long(p11.lat), long(p11.lon)).imag(); - - p12.lon = ceil(p0.lon); - p12.lat = floor(p0.lat); - p12.ati = echoArr(long(p12.lat), long(p12.lon)).imag(); - - p21.lon = floor(p0.lon); - p21.lat = ceil(p0.lat); - p21.ati = echoArr(long(p21.lat), long(p21.lon)).imag(); - - p22.lon = ceil(p0.lon); - p22.lat = ceil(p0.lat); - p22.ati = echoArr(long(p22.lat), long(p22.lon)).imag(); - - p0.lon = p0.lon - p11.lon; - p0.lat = p0.lat - p11.lat; - - p12.lon = p12.lon - p11.lon; - p12.lat = p12.lat - p11.lat; - - p21.lon = p21.lon - p11.lon; - p21.lat = p21.lat - p11.lat; - - p22.lon = p22.lon - p11.lon; - p22.lat = p22.lat - p11.lat; - - p11.lon = p11.lon - p11.lon; - p11.lat = p11.lat - p11.lat; - - p0.ati = Bilinear_interpolation(p0, p11, p21, p12, p22); - l1aArr(i, j).imag(p0.ati); - } - - } - } - - l1adata.saveImage(l1aArr, 0, 0, 1); - return 0; - -} - - - - - - - - - From cd293e4a8e19150c8d4965a086621a2e7bef8cce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=A2=9E=E8=BE=89?= <3045316072@qq.com> Date: Thu, 10 Apr 2025 01:15:55 +0800 Subject: [PATCH 29/44] =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=BA=86=E5=90=8E?= =?UTF-8?q?=E5=90=91=E6=95=A3=E5=B0=84=E7=B3=BB=E6=95=B0=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Toolbox/SimulationSARTool/SimulationSAR/SigmaDatabase.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Toolbox/SimulationSARTool/SimulationSAR/SigmaDatabase.cpp b/Toolbox/SimulationSARTool/SimulationSAR/SigmaDatabase.cpp index 366f977..8f612f7 100644 --- a/Toolbox/SimulationSARTool/SimulationSAR/SigmaDatabase.cpp +++ b/Toolbox/SimulationSARTool/SimulationSAR/SigmaDatabase.cpp @@ -44,7 +44,7 @@ SigmaDatabase::SigmaDatabase() this->HH_sigmaParam.insert(std::pair(10, SigmaParam{ -21.1019701821713, 9.00621457243906, 6.52932182540331, -1.11157376729893, -15.8022895411007, 11.4690828129602 })); this->HH_sigmaParam.insert(std::pair(20, SigmaParam{ -43.6677042155964, 32.0245140457417, 0.511060658303930, -2.68482232690106, 6.29783274559538, 1.96648609622833 })); this->HH_sigmaParam.insert(std::pair(40, SigmaParam{ 50.97, -62.9, -0.0968, 1.604, -4.637, 6.108 })); - this->HH_sigmaParam.insert(std::pair(60, SigmaParam{ -12.45,23.3097,3.187,-2.482,8.244,0.3632 })); + this->HH_sigmaParam.insert(std::pair(60, SigmaParam{ -32.45, 23.3097, 3.187, -2.482, 8.244, 0.3632 })); ////12 this->HH_sigmaParam.insert(std::pair(12, SigmaParam{ -21.1019701821713, 9.00621457243906, 6.52932182540331, - 1.11157376729893, - 15.8022895411007, 11.4690828129602 })); @@ -65,7 +65,7 @@ SigmaDatabase::SigmaDatabase() //this->VV_sigmaParam.insert(std::pair(30, SigmaParam{ -59.1080014669385, 47.6710707363975, 0.300193452564135, -3.93463636916976, 5.99799798331127, -10.3772604045974 })); ////50 - this->HH_sigmaParam.insert(std::pair(50, SigmaParam{ -22.9105602882378, 8170.54100628307, 15.4916054293135, - 0.970580847008280, 28.9025325818511, - 21.4319176514170 })); + this->HH_sigmaParam.insert(std::pair(50, SigmaParam{ -22.9105602882378, 30.54100628307, 15.4916054293135, - 0.970580847008280, 28.9025325818511, - 21.4319176514170 })); //this->HV_sigmaParam.insert(std::pair(50, SigmaParam{ -39.7459019584805, 151.391039247574, 5.17117231380975, - 4.10303899418773, 8.04893424718507, - 3.17171678851531 })); //this->VH_sigmaParam.insert(std::pair(50, SigmaParam{ -39.7459019584805, 151.391039247574, 5.17117231380975, -4.10303899418773, 8.04893424718507, -3.17171678851531 })); //this->VV_sigmaParam.insert(std::pair(50, SigmaParam{ -22.9105602882378, 8170.54100628307, 15.4916054293135, -0.970580847008280, 28.9025325818511, -21.4319176514170 })); From a074003d6f4a74c886c7251ca3d5d7eaae4e1934 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=A2=9E=E8=BE=89?= <3045316072@qq.com> Date: Thu, 10 Apr 2025 18:32:25 +0800 Subject: [PATCH 30/44] =?UTF-8?q?1.=E5=A2=9E=E5=8A=A0=E4=BA=86L1B=E7=BA=A7?= =?UTF-8?q?=E4=BA=A7=E5=93=81=E7=94=9F=E4=BA=A7=E5=8A=9F=E8=83=BD=202.?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=9F=BA=E4=BA=8E=E7=BB=8F=E7=BA=AC=E5=BA=A6?= =?UTF-8?q?=E9=87=87=E6=A0=B7=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BaseTool/ImageOperatorBase.h | 15 + BaseCommonLibrary/BaseTool/RasterToolBase.cpp | 7 +- BaseCommonLibrary/BaseTool/RasterToolBase.h | 42 +- .../BaseTool/SARSimulationImageL1.h | 6 + BaseCommonLibrary/ImageOperatorFuntion.cpp | 616 +++++++++++++----- Toolbox/BaseToolbox/BaseToolbox.vcxproj | 4 +- .../GF3CalibrationAndGeocodingClass.cpp | 88 --- .../GF3CalibrationAndGeocodingClass.h | 10 - .../BaseToolbox/QComplex2AmpPhase.cpp | 1 + .../SARImage/ImageNetOperator.cpp | 123 +++- .../SARImage/ImageNetOperator.h | 6 + .../SARImage/QL1ASARProcessDialog.cpp | 114 ++++ .../SARImage/QL1ASARProcessDialog.h | 30 + .../SARImage/QL1ASARProcessDialog.ui | 232 +++++++ .../SARImage/QLonLatInterpAtiFromDEM.cpp | 124 ++++ .../SARImage/QLonLatInterpAtiFromDEM.h | 29 + .../SARImage/QLonLatInterpAtiFromDEM.ui | 191 ++++++ .../SimulationSARTool/SimulationSARTool.cpp | 37 ++ Toolbox/SimulationSARTool/SimulationSARTool.h | 28 + .../SimulationSARTool.vcxproj | 6 + .../SimulationSARTool.vcxproj.filters | 18 + 21 files changed, 1433 insertions(+), 294 deletions(-) create mode 100644 Toolbox/SimulationSARTool/SARImage/QL1ASARProcessDialog.cpp create mode 100644 Toolbox/SimulationSARTool/SARImage/QL1ASARProcessDialog.h create mode 100644 Toolbox/SimulationSARTool/SARImage/QL1ASARProcessDialog.ui create mode 100644 Toolbox/SimulationSARTool/SARImage/QLonLatInterpAtiFromDEM.cpp create mode 100644 Toolbox/SimulationSARTool/SARImage/QLonLatInterpAtiFromDEM.h create mode 100644 Toolbox/SimulationSARTool/SARImage/QLonLatInterpAtiFromDEM.ui diff --git a/BaseCommonLibrary/BaseTool/ImageOperatorBase.h b/BaseCommonLibrary/BaseTool/ImageOperatorBase.h index d47ad7c..2f52328 100644 --- a/BaseCommonLibrary/BaseTool/ImageOperatorBase.h +++ b/BaseCommonLibrary/BaseTool/ImageOperatorBase.h @@ -316,6 +316,21 @@ void BASECONSTVARIABLEAPI testOutDataArr(QString filename, long* data, long row void BASECONSTVARIABLEAPI CreateSARIntensityByLookTable(QString IntensityRasterPath, QString LookTableRasterPath, QString SARIntensityPath, long min_rid, long max_rid, long min_cid, long max_cid, std::function processBarShow = {}); +bool BASECONSTVARIABLEAPI ConvertVrtToEnvi(QString vrtPath, QString outPath); + + + + +void BASECONSTVARIABLEAPI MultiLookRaster(QString inRasterPath, QString outRasterPath, long looklineNumrow, long looklineNumCol); +ErrorCode BASECONSTVARIABLEAPI Complex2PhaseRaster(QString inComplexPath, QString outRasterPath); +ErrorCode BASECONSTVARIABLEAPI Complex2dBRaster(QString inComplexPath, QString outRasterPath); +ErrorCode BASECONSTVARIABLEAPI Complex2AmpRaster(QString inComplexPath, QString outRasterPath); +ErrorCode BASECONSTVARIABLEAPI ResampleDEM(QString indemPath, QString outdemPath, double gridx, double gridy); + + + + + //--------------------- 鍥惧儚鏂囦欢璇诲啓 ------------------------------ diff --git a/BaseCommonLibrary/BaseTool/RasterToolBase.cpp b/BaseCommonLibrary/BaseTool/RasterToolBase.cpp index 32711fb..5debe6f 100644 --- a/BaseCommonLibrary/BaseTool/RasterToolBase.cpp +++ b/BaseCommonLibrary/BaseTool/RasterToolBase.cpp @@ -15,6 +15,8 @@ #include #include #include +#include "SARSimulationImageL1.h" +#include namespace RasterToolBase { long getProjectEPSGCodeByLon_Lat(double lon, double lat, ProjectStripDelta stripState) @@ -268,4 +270,7 @@ namespace RasterToolBase { return CoordinateSystemType::UNKNOW; } } -} // namespace RasterToolBase \ No newline at end of file +}; // namespace RasterToolBase + + + diff --git a/BaseCommonLibrary/BaseTool/RasterToolBase.h b/BaseCommonLibrary/BaseTool/RasterToolBase.h index bc6842f..254d4bb 100644 --- a/BaseCommonLibrary/BaseTool/RasterToolBase.h +++ b/BaseCommonLibrary/BaseTool/RasterToolBase.h @@ -12,40 +12,42 @@ #include "BaseConstVariable.h" #include "gdal_priv.h" #include +#include "LogInfoCls.h" + namespace RasterToolBase { - static bool GDALAllRegisterEnable=false; + static bool GDALAllRegisterEnable = false; - enum ProjectStripDelta{ + enum ProjectStripDelta { Strip_6, // 6搴﹀甫 Strip_3 }; - enum CoordinateSystemType{ // 鍧愭爣绯荤被鍨 + enum CoordinateSystemType { // 鍧愭爣绯荤被鍨 GeoCoordinateSystem, ProjectCoordinateSystem, UNKNOW }; - struct PointRaster{ // 褰卞儚鍧愭爣鐐 + struct PointRaster { // 褰卞儚鍧愭爣鐐 double x; double y; double z; }; - struct PointXYZ{ - double x,y,z; + struct PointXYZ { + double x, y, z; }; - struct PointGeo{ - double lon,lat,ati; + struct PointGeo { + double lon, lat, ati; }; - struct PointImage{ - double pixel_x,pixel_y; + struct PointImage { + double pixel_x, pixel_y; }; /// 鏍规嵁缁忕含搴﹁幏鍙 @@ -56,14 +58,14 @@ namespace RasterToolBase { /// \param lat 绾害 /// \return 瀵瑰簲鎶曞奖鍧愭爣绯荤粺鐨 EPSG缂栫爜,-1 琛ㄧず璁$畻閿欒 long BASECONSTVARIABLEAPI getProjectEPSGCodeByLon_Lat(double long, double lat, - ProjectStripDelta stripState = ProjectStripDelta::Strip_3); + ProjectStripDelta stripState = ProjectStripDelta::Strip_3); long BASECONSTVARIABLEAPI getProjectEPSGCodeByLon_Lat_inStrip3(double lon, double lat); long BASECONSTVARIABLEAPI getProjectEPSGCodeByLon_Lat_inStrip6(double lon, double lat); - QString BASECONSTVARIABLEAPI GetProjectionNameFromEPSG(long epsgCode) ; + QString BASECONSTVARIABLEAPI GetProjectionNameFromEPSG(long epsgCode); long BASECONSTVARIABLEAPI GetEPSGFromRasterFile(QString filepath); @@ -72,9 +74,23 @@ namespace RasterToolBase { CoordinateSystemType BASECONSTVARIABLEAPI getCoordinateSystemTypeByEPSGCode(long EPSGCODE); +};// namespace RasterProjectConvertor + + + + +// 閬ユ劅绫诲父鐢ㄦ暟鎹 + + + + + + + + + -} // namespace RasterProjectConvertor #endif // LAMPCAE_RASTERTOOLBASE_H diff --git a/BaseCommonLibrary/BaseTool/SARSimulationImageL1.h b/BaseCommonLibrary/BaseTool/SARSimulationImageL1.h index c2abecf..3d85682 100644 --- a/BaseCommonLibrary/BaseTool/SARSimulationImageL1.h +++ b/BaseCommonLibrary/BaseTool/SARSimulationImageL1.h @@ -208,3 +208,9 @@ private: }; + + + + + + diff --git a/BaseCommonLibrary/ImageOperatorFuntion.cpp b/BaseCommonLibrary/ImageOperatorFuntion.cpp index 67c620a..6313329 100644 --- a/BaseCommonLibrary/ImageOperatorFuntion.cpp +++ b/BaseCommonLibrary/ImageOperatorFuntion.cpp @@ -1,4 +1,4 @@ -#include "stdafx.h" +锘#include "stdafx.h" #include "ImageOperatorBase.h" #include "BaseTool.h" #include "GeoOperator.h" @@ -25,8 +25,12 @@ #include #include #include -#include // OGRSpatialReference 用于空间参考转换 -#include // 用于 GDALWarp 操作 +#include // OGRSpatialReference 鐢ㄤ簬绌洪棿鍙傝冭浆鎹 +#include // 鐢ㄤ簬 GDALWarp 鎿嶄綔 + +#include "gdal_priv.h" +#include "cpl_conv.h" +#include std::shared_ptr OpenDataset(const QString& in_path, GDALAccess rwmode) @@ -105,13 +109,13 @@ GDALDataType getGDALDataType(QString fileptah) CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); GDALDataset* rasterDataset = (GDALDataset*)(GDALOpen( - fileptah.toUtf8().constData(), GA_ReadOnly)); // 锟斤拷只斤拷式锟斤拷取斤拷影锟斤拷 + fileptah.toUtf8().constData(), GA_ReadOnly)); // 閿熸枻鎷峰彧鏂ゆ嫹寮忛敓鏂ゆ嫹鍙栨枻鎷峰奖閿熸枻鎷 GDALDataType gdal_datatype = rasterDataset->GetRasterBand(1)->GetRasterDataType(); GDALClose((GDALDatasetH)rasterDataset); - omp_unset_lock(&lock); // 锟酵放伙拷斤拷 - omp_destroy_lock(&lock); // 劫伙拷斤拷 + omp_unset_lock(&lock); // 閿熼叺鏀句紮鎷锋枻鎷 + omp_destroy_lock(&lock); // 鍔紮鎷锋枻鎷 return gdal_datatype; } @@ -124,14 +128,14 @@ GDALDataType getGDALDataType(QString fileptah) int block_num_pre_memory(int block_width, int height, GDALDataType gdal_datatype, double memey_size) { - // 计算大小 + // 璁$畻澶у皬 int size_meta = 0; if (gdal_datatype == GDT_Byte) { size_meta = 1; } else if (gdal_datatype == GDT_UInt16) { - size_meta = 2; // 只有双通道才能构建 复数矩阵 + size_meta = 2; // 鍙湁鍙岄氶亾鎵嶈兘鏋勫缓 澶嶆暟鐭╅樀 } else if (gdal_datatype == GDT_UInt16) { size_meta = 2; @@ -172,7 +176,7 @@ int block_num_pre_memory(int block_width, int height, GDALDataType gdal_datatype else { } int block_num = int(memey_size / (size_meta * block_width)); - block_num = block_num > height ? height : block_num; // 行数 + block_num = block_num > height ? height : block_num; // 琛屾暟 block_num = block_num < 1 ? 1 : block_num; return block_num; } @@ -203,84 +207,84 @@ int ENVI2TIFF(QString in_envi_path, QString out_tiff_path) void ConvertCoordinateSystem(QString inRasterPath, QString outRasterPath, long outepsgcode) { - // 注册所有GDAL驱动 + // 娉ㄥ唽鎵鏈塆DAL椹卞姩 GDALAllRegister(); - // 打开输入栅格文件 + // 鎵撳紑杈撳叆鏍呮牸鏂囦欢 GDALDataset* srcDataset = (GDALDataset*)GDALOpen(inRasterPath.toUtf8().constData(), GA_ReadOnly); if (!srcDataset) { - // 错误处理:输出文件打开失败 - // qDebug() << "无法打开输入文件:" << inRasterPath; + // 閿欒澶勭悊锛氳緭鍑烘枃浠舵墦寮澶辫触 + // qDebug() << "鏃犳硶鎵撳紑杈撳叆鏂囦欢锛" << inRasterPath; return; } - // 创建目标坐标系 + // 鍒涘缓鐩爣鍧愭爣绯 OGRSpatialReference targetSRS; if (targetSRS.importFromEPSG(outepsgcode) != OGRERR_NONE) { GDALClose(srcDataset); - // qDebug() << "无效的EPSG代码:" << outepsgcode; + // qDebug() << "鏃犳晥鐨凟PSG浠g爜锛" << outepsgcode; return; } GDALDataType datetype = srcDataset->GetRasterBand(1)->GetRasterDataType(); - // 获取目标坐标系的WKT表示 + // 鑾峰彇鐩爣鍧愭爣绯荤殑WKT琛ㄧず char* targetSRSWkt = nullptr; targetSRS.exportToWkt(&targetSRSWkt); bool flag = (datetype == GDT_Byte || datetype == GDT_Int8 || datetype == GDT_Int16 || datetype == GDT_UInt16 || datetype == GDT_Int32 || datetype == GDT_UInt32 || datetype == GDT_Int64 || datetype == GDT_UInt64); - // 创建重投影后的虚拟数据集(Warped VRT) + // 鍒涘缓閲嶆姇褰卞悗鐨勮櫄鎷熸暟鎹泦锛圵arped VRT锛 GDALDataset* warpedVRT = flag ? (GDALDataset*)GDALAutoCreateWarpedVRT( srcDataset, - nullptr, // 输入坐标系(默认使用源数据) - targetSRSWkt, // 目标坐标系 - GRA_NearestNeighbour, // 重采样方法:双线性插值 - 0.0, // 最大误差(0表示自动计算) - nullptr // 其他选项 + nullptr, // 杈撳叆鍧愭爣绯伙紙榛樿浣跨敤婧愭暟鎹級 + targetSRSWkt, // 鐩爣鍧愭爣绯 + GRA_NearestNeighbour, // 閲嶉噰鏍锋柟娉曪細鍙岀嚎鎬ф彃鍊 + 0.0, // 鏈澶ц宸紙0琛ㄧず鑷姩璁$畻锛 + nullptr // 鍏朵粬閫夐」 ) : (GDALDataset*)GDALAutoCreateWarpedVRT( srcDataset, - nullptr, // 输入坐标系(默认使用源数据) - targetSRSWkt, // 目标坐标系 - GRA_Bilinear, // 重采样方法:双线性插值 - 0.0, // 最大误差(0表示自动计算) - nullptr // 其他选项 + nullptr, // 杈撳叆鍧愭爣绯伙紙榛樿浣跨敤婧愭暟鎹級 + targetSRSWkt, // 鐩爣鍧愭爣绯 + GRA_Bilinear, // 閲嶉噰鏍锋柟娉曪細鍙岀嚎鎬ф彃鍊 + 0.0, // 鏈澶ц宸紙0琛ㄧず鑷姩璁$畻锛 + nullptr // 鍏朵粬閫夐」 ); - CPLFree(targetSRSWkt); // 释放WKT内存 + CPLFree(targetSRSWkt); // 閲婃斁WKT鍐呭瓨 if (!warpedVRT) { GDALClose(srcDataset); - qDebug() << u8"创建投影转换VRT失败"; + qDebug() << u8"鍒涘缓鎶曞奖杞崲VRT澶辫触"; return; } - // 获取输出驱动(GeoTIFF格式) + // 鑾峰彇杈撳嚭椹卞姩锛圙eoTIFF鏍煎紡锛 QString filesuffer = getFileExtension(outRasterPath).toLower(); bool isTiff = filesuffer.contains("tif"); GDALDriver* driver = isTiff ? GetGDALDriverManager()->GetDriverByName("GTiff") : GetGDALDriverManager()->GetDriverByName("ENVI"); if (!driver) { GDALClose(warpedVRT); GDALClose(srcDataset); - // qDebug() << "无法获取GeoTIFF驱动"; + // qDebug() << "鏃犳硶鑾峰彇GeoTIFF椹卞姩"; return; } - // 创建输出栅格文件 + // 鍒涘缓杈撳嚭鏍呮牸鏂囦欢 GDALDataset* dstDataset = driver->CreateCopy( - outRasterPath.toUtf8().constData(), // 输出文件路径 - warpedVRT, // 输入数据集(VRT) - false, // 是否严格复制 - nullptr, // 创建选项 - nullptr, // 进度回调 - nullptr // 回调参数 + outRasterPath.toUtf8().constData(), // 杈撳嚭鏂囦欢璺緞 + warpedVRT, // 杈撳叆鏁版嵁闆嗭紙VRT锛 + false, // 鏄惁涓ユ牸澶嶅埗 + nullptr, // 鍒涘缓閫夐」 + nullptr, // 杩涘害鍥炶皟 + nullptr // 鍥炶皟鍙傛暟 ); if (!dstDataset) { - // qDebug() << "创建输出文件失败:" << outRasterPath; + // qDebug() << "鍒涘缓杈撳嚭鏂囦欢澶辫触锛" << outRasterPath; GDALClose(warpedVRT); GDALClose(srcDataset); return; } - // 释放资源 + // 閲婃斁璧勬簮 GDALClose(dstDataset); GDALClose(warpedVRT); GDALClose(srcDataset); @@ -320,11 +324,11 @@ void ResampleByReferenceRasterB(QString pszSrcFile, QString RefrasterBPath, QStr char* pszSrcWKT = NULL; pszSrcWKT = const_cast(pDSrc->GetProjectionRef()); - // 锟斤拷锟矫伙拷锟酵队帮拷锟斤拷锟轿?拷锟斤拷锟揭伙拷锟?1锟?7 + // 閿熸枻鎷烽敓鐭紮鎷烽敓閰甸槦甯嫹閿熸枻鎷烽敓杞?鎷烽敓鏂ゆ嫹閿熸彮浼欐嫹閿?1閿?7 if (strlen(pszSrcWKT) <= 0) { OGRSpatialReference oSRS; oSRS.importFromEPSG(4326); - // oSRS.SetUTM(50, true); //锟斤拷锟斤拷锟斤拷 锟斤拷锟斤拷120锟斤拷 + // oSRS.SetUTM(50, true); //閿熸枻鎷烽敓鏂ゆ嫹閿熸枻鎷 閿熸枻鎷烽敓鏂ゆ嫹120閿熸枻鎷 // oSRS.SetWellKnownGeogCS("WGS84"); oSRS.exportToWkt(&pszSrcWKT); } @@ -332,12 +336,12 @@ void ResampleByReferenceRasterB(QString pszSrcFile, QString RefrasterBPath, QStr char* pdstSrcWKT = NULL; pdstSrcWKT = const_cast(pDRef->GetProjectionRef()); - // 锟斤拷锟矫伙拷锟酵队帮拷锟斤拷锟轿?拷锟斤拷锟揭伙拷锟?1锟?7 + // 閿熸枻鎷烽敓鐭紮鎷烽敓閰甸槦甯嫹閿熸枻鎷烽敓杞?鎷烽敓鏂ゆ嫹閿熸彮浼欐嫹閿?1閿?7 if (strlen(pdstSrcWKT) <= 0) { OGRSpatialReference oSRS; oSRS.importFromEPSG(4326); - // oSRS.SetUTM(50, true); //锟斤拷锟斤拷锟斤拷 锟斤拷锟斤拷120锟斤拷 + // oSRS.SetUTM(50, true); //閿熸枻鎷烽敓鏂ゆ嫹閿熸枻鎷 閿熸枻鎷烽敓鏂ゆ嫹120閿熸枻鎷 // oSRS.SetWellKnownGeogCS("WGS84"); oSRS.exportToWkt(&pdstSrcWKT); } @@ -369,7 +373,7 @@ void ResampleByReferenceRasterB(QString pszSrcFile, QString RefrasterBPath, QStr hTransformArg = GDALCreateGenImgProjTransformer((GDALDatasetH)pDSrc, pszSrcWKT, NULL, pszSrcWKT, FALSE, 0.0, 1); qDebug() << "no proj "; - //(没锟斤拷投影锟斤拷影锟斤拷锟斤拷锟斤拷锟斤拷卟锟酵?拷锟?1锟?7) + //(娌¢敓鏂ゆ嫹鎶曞奖閿熸枻鎷峰奖閿熸枻鎷烽敓鏂ゆ嫹閿熸枻鎷烽敓鏂ゆ嫹鍗熼敓閰?鎷烽敓?1閿?7) if (hTransformArg == NULL) { qDebug() << "hTransformArg create failure"; GDALClose((GDALDatasetH)(GDALDatasetH)pDSrc); @@ -392,8 +396,8 @@ void ResampleByReferenceRasterB(QString pszSrcFile, QString RefrasterBPath, QStr GDALWarpOptions* psWo = GDALCreateWarpOptions(); - CPLSetConfigOption("GDAL_NUM_THREADS", "ALL_CPUS"); // 使用所有可用的CPU核心 - CPLSetConfigOption("GDAL_CACHEMAX", "16000"); // 设置缓存大小为500MB + CPLSetConfigOption("GDAL_NUM_THREADS", "ALL_CPUS"); // 浣跨敤鎵鏈夊彲鐢ㄧ殑CPU鏍稿績 + CPLSetConfigOption("GDAL_CACHEMAX", "16000"); // 璁剧疆缂撳瓨澶у皬涓500MB // psWo->papszWarpOptions = CSLDuplicate(NULL); psWo->eWorkingDataType = dataType; @@ -440,20 +444,20 @@ void ResampleByReferenceRasterB(QString pszSrcFile, QString RefrasterBPath, QStr void ResampleByReferenceRasterB(QString InrasterAPath, QString RefrasterBPath, QString OutrasterCPath) { - // 注册所有GDAL驱动 + // 娉ㄥ唽鎵鏈塆DAL椹卞姩 GDALAllRegister(); - // 打开参考栅格B + // 鎵撳紑鍙傝冩爡鏍糂 GDALDataset* refDS = (GDALDataset*)GDALOpen(RefrasterBPath.toUtf8().constData(), GA_ReadOnly); if (!refDS) { - qDebug() << "无法打开参考栅格B:" << RefrasterBPath; + qDebug() << "鏃犳硶鎵撳紑鍙傝冩爡鏍糂锛" << RefrasterBPath; return; } - // 获取参考栅格的地理变换、投影和尺寸 + // 鑾峰彇鍙傝冩爡鏍肩殑鍦扮悊鍙樻崲銆佹姇褰卞拰灏哄 double geotransform[6]; if (refDS->GetGeoTransform(geotransform) != CE_None) { - qDebug() << "获取参考栅格的地理变换失败。"; + qDebug() << "鑾峰彇鍙傝冩爡鏍肩殑鍦扮悊鍙樻崲澶辫触銆"; GDALClose(refDS); return; } @@ -461,28 +465,28 @@ void ResampleByReferenceRasterB(QString InrasterAPath, QString RefrasterBPath, Q const char* proj = refDS->GetProjectionRef(); int cols = refDS->GetRasterXSize(); int rows = refDS->GetRasterYSize(); - GDALClose(refDS); // 获取信息后关闭参考栅格 + GDALClose(refDS); // 鑾峰彇淇℃伅鍚庡叧闂弬鑰冩爡鏍 - // 打开输入栅格A + // 鎵撳紑杈撳叆鏍呮牸A GDALDataset* srcDS = (GDALDataset*)GDALOpen(InrasterAPath.toUtf8().constData(), GA_ReadOnly); if (!srcDS) { - qDebug() << "无法打开输入栅格A:" << InrasterAPath; + qDebug() << "鏃犳硶鎵撳紑杈撳叆鏍呮牸A锛" << InrasterAPath; return; } - // 获取输入栅格的波段数和数据类型 + // 鑾峰彇杈撳叆鏍呮牸鐨勬尝娈垫暟鍜屾暟鎹被鍨 int nBands = srcDS->GetRasterCount(); if (nBands == 0) { - qDebug() << "输入栅格没有波段数据。"; + qDebug() << "杈撳叆鏍呮牸娌℃湁娉㈡鏁版嵁銆"; GDALClose(srcDS); return; } GDALDataType dataType = srcDS->GetRasterBand(1)->GetRasterDataType(); - // 创建输出栅格C + // 鍒涘缓杈撳嚭鏍呮牸C GDALDriver* driver = GetGDALDriverManager()->GetDriverByName("GTiff"); if (!driver) { - qDebug() << "无法获取GeoTIFF驱动。"; + qDebug() << "鏃犳硶鑾峰彇GeoTIFF椹卞姩銆"; GDALClose(srcDS); return; } @@ -496,16 +500,16 @@ void ResampleByReferenceRasterB(QString InrasterAPath, QString RefrasterBPath, Q nullptr ); if (!dstDS) { - qDebug() << "无法创建输出栅格:" << OutrasterCPath; + qDebug() << "鏃犳硶鍒涘缓杈撳嚭鏍呮牸锛" << OutrasterCPath; GDALClose(srcDS); return; } - // 设置输出栅格的地理变换和投影 + // 璁剧疆杈撳嚭鏍呮牸鐨勫湴鐞嗗彉鎹㈠拰鎶曞奖 dstDS->SetGeoTransform(geotransform); dstDS->SetProjection(proj); - // 配置GDAL Warp选项 + // 閰嶇疆GDAL Warp閫夐」 GDALWarpOptions* psWO = GDALCreateWarpOptions(); psWO->hSrcDS = srcDS; psWO->hDstDS = dstDS; @@ -516,9 +520,9 @@ void ResampleByReferenceRasterB(QString InrasterAPath, QString RefrasterBPath, Q psWO->panSrcBands[i] = i + 1; psWO->panDstBands[i] = i + 1; } - psWO->eResampleAlg = GRA_NearestNeighbour; // 使用最近邻重采样 + psWO->eResampleAlg = GRA_NearestNeighbour; // 浣跨敤鏈杩戦偦閲嶉噰鏍 - // 初始化坐标转换器 + // 鍒濆鍖栧潗鏍囪浆鎹㈠櫒 psWO->pfnTransformer = GDALGenImgProjTransform; psWO->pTransformerArg = GDALCreateGenImgProjTransformer( srcDS, GDALGetProjectionRef(srcDS), @@ -526,17 +530,17 @@ void ResampleByReferenceRasterB(QString InrasterAPath, QString RefrasterBPath, Q FALSE, 0.0, 1 ); if (!psWO->pTransformerArg) { - qDebug() << "创建坐标转换器失败。"; + qDebug() << "鍒涘缓鍧愭爣杞崲鍣ㄥけ璐ャ"; GDALDestroyWarpOptions(psWO); GDALClose(srcDS); GDALClose(dstDS); return; } - // 执行Warp操作 + // 鎵цWarp鎿嶄綔 GDALWarpOperation oWarp; if (oWarp.Initialize(psWO) != CE_None) { - qDebug() << "初始化Warp操作失败。"; + qDebug() << "鍒濆鍖朩arp鎿嶄綔澶辫触銆"; GDALDestroyGenImgProjTransformer(psWO->pTransformerArg); GDALDestroyWarpOptions(psWO); GDALClose(srcDS); @@ -546,79 +550,79 @@ void ResampleByReferenceRasterB(QString InrasterAPath, QString RefrasterBPath, Q CPLErr eErr = oWarp.ChunkAndWarpImage(0, 0, cols, rows); if (eErr != CE_None) { - qDebug() << "执行Warp操作失败。"; + qDebug() << "鎵цWarp鎿嶄綔澶辫触銆"; } - // 清理资源 + // 娓呯悊璧勬簮 GDALDestroyGenImgProjTransformer(psWO->pTransformerArg); GDALDestroyWarpOptions(psWO); GDALClose(srcDS); GDALClose(dstDS); - qDebug() << "重采样完成,结果已保存至:" << OutrasterCPath; + qDebug() << "閲嶉噰鏍峰畬鎴愶紝缁撴灉宸蹭繚瀛樿嚦锛" << OutrasterCPath; } void cropRasterByLatLon(const char* inputFile, const char* outputFile, double minLon, double maxLon, double minLat, double maxLat) { - // 初始化 GDAL 库 + // 鍒濆鍖 GDAL 搴 GDALAllRegister(); - // 打开栅格数据集 + // 鎵撳紑鏍呮牸鏁版嵁闆 GDALDataset* poDataset = (GDALDataset*)GDALOpen(inputFile, GA_ReadOnly); if (poDataset == nullptr) { - std::cerr << "Failed to open input raster." << std::endl; + qDebug() << "Failed to open input raster." ; return; } - // 获取栅格数据的地理参考信息 + // 鑾峰彇鏍呮牸鏁版嵁鐨勫湴鐞嗗弬鑰冧俊鎭 double adfGeoTransform[6]; if (poDataset->GetGeoTransform(adfGeoTransform) != CE_None) { - std::cerr << "Failed to get geotransform." << std::endl; + qDebug() << "Failed to get geotransform." ; GDALClose(poDataset); return; } - // 获取输入影像的投影信息 + // 鑾峰彇杈撳叆褰卞儚鐨勬姇褰变俊鎭 const char* projection = poDataset->GetProjectionRef(); - // 根据经纬度计算出裁剪区域对应的栅格像素坐标 + // 鏍规嵁缁忕含搴﹁绠楀嚭瑁佸壀鍖哄煙瀵瑰簲鐨勬爡鏍煎儚绱犲潗鏍 int xMin = (int)((minLon - adfGeoTransform[0]) / adfGeoTransform[1]); int xMax = (int)((maxLon - adfGeoTransform[0]) / adfGeoTransform[1]); int yMin = (int)((maxLat - adfGeoTransform[3]) / adfGeoTransform[5]); int yMax = (int)((minLat - adfGeoTransform[3]) / adfGeoTransform[5]); - // 创建裁剪区域的目标栅格数据集 + // 鍒涘缓瑁佸壀鍖哄煙鐨勭洰鏍囨爡鏍兼暟鎹泦 GDALDriver* poDriver = GetGDALDriverManager()->GetDriverByName("GTiff"); if (poDriver == nullptr) { - std::cerr << "Failed to get GTiff driver." << std::endl; + qDebug() << "Failed to get GTiff driver." ; GDALClose(poDataset); return; } - // 创建输出栅格数据集,指定尺寸 + // 鍒涘缓杈撳嚭鏍呮牸鏁版嵁闆嗭紝鎸囧畾灏哄 int width = xMax - xMin; int height = yMax - yMin; GDALDataset* poOutDataset = poDriver->Create(outputFile, width, height, poDataset->GetRasterCount(), GDT_Float32, nullptr); if (poOutDataset == nullptr) { - std::cerr << "Failed to create output raster." << std::endl; + qDebug() << "Failed to create output raster." ; GDALClose(poDataset); return; } - // 设置输出栅格的投影信息和地理变换 + // 璁剧疆杈撳嚭鏍呮牸鐨勬姇褰变俊鎭拰鍦扮悊鍙樻崲 poOutDataset->SetProjection(projection); double newGeoTransform[6] = { adfGeoTransform[0] + xMin * adfGeoTransform[1], adfGeoTransform[1], 0.0, adfGeoTransform[3] + yMin * adfGeoTransform[5], 0.0, adfGeoTransform[5] }; poOutDataset->SetGeoTransform(newGeoTransform); - // 循环读取源数据并写入目标数据集 + // 寰幆璇诲彇婧愭暟鎹苟鍐欏叆鐩爣鏁版嵁闆 for (int i = 0; i < poDataset->GetRasterCount(); ++i) { GDALRasterBand* poBand = poDataset->GetRasterBand(i + 1); GDALRasterBand* poOutBand = poOutDataset->GetRasterBand(i + 1); - // 读取源数据 + // 璇诲彇婧愭暟鎹 int* pData = new int[width * height]; poBand->RasterIO(GF_Read, xMin, yMin, width, height, pData, width, height, GDT_Int32, 0, 0); - // 写入目标数据 + // 鍐欏叆鐩爣鏁版嵁 poOutBand->RasterIO(GF_Write, 0, 0, width, height, pData, width, height, GDT_Int32, 0, 0); delete[] pData; @@ -626,28 +630,28 @@ void cropRasterByLatLon(const char* inputFile, const char* outputFile, double mi qDebug() << "Raster cropped and saved to: " << outputFile; - // 清理 + // 娓呯悊 GDALClose(poDataset); GDALClose(poOutDataset); } ErrorCode transformCoordinate(double x, double y, int sourceEPSG, int targetEPSG, Point2& p) { - // 创建源坐标系(原始坐标系) + // 鍒涘缓婧愬潗鏍囩郴锛堝師濮嬪潗鏍囩郴锛 OGRSpatialReference sourceSRS; - sourceSRS.importFromEPSG(sourceEPSG); // 使用 EPSG 编码来指定坐标系 + sourceSRS.importFromEPSG(sourceEPSG); // 浣跨敤 EPSG 缂栫爜鏉ユ寚瀹氬潗鏍囩郴 - // 创建目标坐标系(目标坐标系) + // 鍒涘缓鐩爣鍧愭爣绯伙紙鐩爣鍧愭爣绯伙級 OGRSpatialReference targetSRS; - targetSRS.importFromEPSG(targetEPSG); // WGS84 坐标系 EPSG:4326 + targetSRS.importFromEPSG(targetEPSG); // WGS84 鍧愭爣绯 EPSG:4326 - // 创建坐标变换对象 + // 鍒涘缓鍧愭爣鍙樻崲瀵硅薄 OGRCoordinateTransformation* transform = OGRCreateCoordinateTransformation(&sourceSRS, &targetSRS); if (transform == nullptr) { qDebug() << "Failed to create coordinate transformation."; return ErrorCode::FAIL; } - // 转换坐标 + // 杞崲鍧愭爣 double transformedX = x; double transformedY = y; if (transform->Transform(1, &transformedX, &transformedY)) { @@ -658,7 +662,7 @@ ErrorCode transformCoordinate(double x, double y, int sourceEPSG, int targetEPSG qDebug() << "Coordinate transformation failed."; } - // 清理 + // 娓呯悊 delete transform; p.x = transformedX; p.y = transformedY; @@ -668,23 +672,23 @@ ErrorCode transformCoordinate(double x, double y, int sourceEPSG, int targetEPSG void transformRaster(const char* inputFile, const char* outputFile, int sourceEPSG, int targetEPSG) { - // 初始化 GDAL 库 + // 鍒濆鍖 GDAL 搴 GDALAllRegister(); - // 打开源栅格文件 + // 鎵撳紑婧愭爡鏍兼枃浠 GDALDataset* poSrcDS = (GDALDataset*)GDALOpen(inputFile, GA_ReadOnly); if (poSrcDS == nullptr) { qDebug() << "Failed to open input file:" << inputFile; return; } - // 获取源栅格的基本信息 + // 鑾峰彇婧愭爡鏍肩殑鍩烘湰淇℃伅 int nXSize = poSrcDS->GetRasterXSize(); int nYSize = poSrcDS->GetRasterYSize(); int nBands = poSrcDS->GetRasterCount(); GDALDataType eDT = poSrcDS->GetRasterBand(1)->GetRasterDataType(); - // 创建目标栅格文件 + // 鍒涘缓鐩爣鏍呮牸鏂囦欢 GDALDriver* poDriver = GetGDALDriverManager()->GetDriverByName("GTiff"); if (poDriver == nullptr) { qDebug() << "GTiff driver not available."; @@ -699,7 +703,7 @@ void transformRaster(const char* inputFile, const char* outputFile, int sourceEP return; } - // 设置目标栅格的空间参考系统 + // 璁剧疆鐩爣鏍呮牸鐨勭┖闂村弬鑰冪郴缁 OGRSpatialReference oSRS; oSRS.importFromEPSG(targetEPSG); @@ -708,10 +712,10 @@ void transformRaster(const char* inputFile, const char* outputFile, int sourceEP poDstDS->SetProjection(pszWKT); CPLFree(pszWKT); - // 复制元数据 + // 澶嶅埗鍏冩暟鎹 poDstDS->SetMetadata(poSrcDS->GetMetadata()); - // 复制每个波段的数据 + // 澶嶅埗姣忎釜娉㈡鐨勬暟鎹 for (int i = 1; i <= nBands; ++i) { GDALRasterBand* poSrcBand = poSrcDS->GetRasterBand(i); GDALRasterBand* poDstBand = poDstDS->GetRasterBand(i); @@ -726,7 +730,7 @@ void transformRaster(const char* inputFile, const char* outputFile, int sourceEP CPLFree(pafScanline); } - // 关闭数据集 + // 鍏抽棴鏁版嵁闆 GDALClose(poSrcDS); GDALClose(poDstDS); @@ -735,68 +739,68 @@ void transformRaster(const char* inputFile, const char* outputFile, int sourceEP void resampleRaster(const char* inputRaster, const char* outputRaster, double targetPixelSizeX, double targetPixelSizeY) { - // 初始化GDAL + // 鍒濆鍖朑DAL GDALAllRegister(); - // 打开输入栅格文件 + // 鎵撳紑杈撳叆鏍呮牸鏂囦欢 GDALDataset* poDataset = (GDALDataset*)GDALOpen(inputRaster, GA_ReadOnly); if (poDataset == nullptr) { - std::cerr << "Failed to open raster file." << std::endl; + qDebug() << "Failed to open raster file." ; return; } - // 获取原始栅格的空间参考 + // 鑾峰彇鍘熷鏍呮牸鐨勭┖闂村弬鑰 double adfGeoTransform[6]; if (poDataset->GetGeoTransform(adfGeoTransform) != CE_None) { - std::cerr << "Failed to get geotransform." << std::endl; + qDebug() << "Failed to get geotransform." ; GDALClose(poDataset); return; } - // 获取原始栅格的尺寸 + // 鑾峰彇鍘熷鏍呮牸鐨勫昂瀵 int nXSize = poDataset->GetRasterXSize(); int nYSize = poDataset->GetRasterYSize(); - // 计算目标栅格的尺寸 + // 璁$畻鐩爣鏍呮牸鐨勫昂瀵 double targetXSize = (adfGeoTransform[1] * nXSize) / targetPixelSizeX; double targetYSize = (adfGeoTransform[5] * nYSize) / targetPixelSizeY; - // 创建目标数据集(输出栅格) + // 鍒涘缓鐩爣鏁版嵁闆嗭紙杈撳嚭鏍呮牸锛 GDALDriver* poDriver = GetGDALDriverManager()->GetDriverByName("GTiff"); if (poDriver == nullptr) { - std::cerr << "Failed to get GTiff driver." << std::endl; + qDebug() << "Failed to get GTiff driver." ; GDALClose(poDataset); return; } - // 创建输出数据集 + // 鍒涘缓杈撳嚭鏁版嵁闆 GDALDataset* poOutDataset = poDriver->Create(outputRaster, (int)targetXSize, (int)targetYSize, poDataset->GetRasterCount(), GDT_Float32, nullptr); if (poOutDataset == nullptr) { - std::cerr << "Failed to create output raster." << std::endl; + qDebug() << "Failed to create output raster." ; GDALClose(poDataset); return; } - // 设置输出数据集的地理变换(坐标系) + // 璁剧疆杈撳嚭鏁版嵁闆嗙殑鍦扮悊鍙樻崲锛堝潗鏍囩郴锛 double targetGeoTransform[6] = { adfGeoTransform[0], targetPixelSizeX, 0, adfGeoTransform[3], 0, -targetPixelSizeY }; poOutDataset->SetGeoTransform(targetGeoTransform); - // 设置输出数据集的投影信息 + // 璁剧疆杈撳嚭鏁版嵁闆嗙殑鎶曞奖淇℃伅 poOutDataset->SetProjection(poDataset->GetProjectionRef()); - // 进行重采样 + // 杩涜閲嶉噰鏍 for (int i = 0; i < poDataset->GetRasterCount(); i++) { GDALRasterBand* poBand = poDataset->GetRasterBand(i + 1); GDALRasterBand* poOutBand = poOutDataset->GetRasterBand(i + 1); - // 使用GDAL的重采样方法,选择一个适当的重采样方式 + // 浣跨敤GDAL鐨勯噸閲囨牱鏂规硶锛岄夋嫨涓涓傚綋鐨勯噸閲囨牱鏂瑰紡 poOutBand->RasterIO(GF_Write, 0, 0, (int)targetXSize, (int)targetYSize, nullptr, (int)targetXSize, (int)targetYSize, poBand->GetRasterDataType(), 0, 0, nullptr); } - // 关闭数据集 + // 鍏抽棴鏁版嵁闆 GDALClose(poDataset); GDALClose(poOutDataset); @@ -806,10 +810,10 @@ void resampleRaster(const char* inputRaster, const char* outputRaster, double ta std::shared_ptr GetCenterPointInRaster(QString filepath) { qDebug() << "============= GetCenterPointInRaster ======================"; - // QTextCodec* codec = QTextCodec::codecForLocale(); // 获取系统默认编码的文本编解码器 - // QByteArray byteArray = codec->fromUnicode(filepath); // 将QString转换为QByteArray - //,这个应该会自动释放 const char* charArray = byteArray.constData(); // - // 获取QByteArray的const char*指针 + // QTextCodec* codec = QTextCodec::codecForLocale(); // 鑾峰彇绯荤粺榛樿缂栫爜鐨勬枃鏈紪瑙g爜鍣 + // QByteArray byteArray = codec->fromUnicode(filepath); // 灏哘String杞崲涓篞ByteArray + //,杩欎釜搴旇浼氳嚜鍔ㄩ噴鏀 const char* charArray = byteArray.constData(); // + // 鑾峰彇QByteArray鐨刢onst char*鎸囬拡 GDALAllRegister(); CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); @@ -817,7 +821,7 @@ std::shared_ptr GetCenterPointInRaster(QString filepath) GDALDataset* poDataset = (GDALDataset*)GDALOpen(filepath.toUtf8().data(), GA_ReadOnly); if (nullptr == poDataset || NULL == poDataset) { qDebug() << "Could not open dataset"; - return nullptr; // 表示读取失败 + return nullptr; // 琛ㄧず璇诲彇澶辫触 } double x, y, z; @@ -834,7 +838,7 @@ std::shared_ptr GetCenterPointInRaster(QString filepath) double dfWidth = poDataset->GetRasterXSize(); double dfHeight = poDataset->GetRasterYSize(); - // 计算中心点坐标(像素坐标) + // 璁$畻涓績鐐瑰潗鏍囷紙鍍忕礌鍧愭爣锛 double dfCenterX = adfGeoTransform[0] + dfWidth * adfGeoTransform[1] / 2.0 + dfHeight * adfGeoTransform[2] / 2.0; double dfCenterY = adfGeoTransform[3] + dfWidth * adfGeoTransform[4] / 2.0 @@ -851,7 +855,7 @@ std::shared_ptr GetCenterPointInRaster(QString filepath) y = dfCenterY; } else { - // 如果不是地理坐标系,转换到WGS84 + // 濡傛灉涓嶆槸鍦扮悊鍧愭爣绯伙紝杞崲鍒癢GS84 OGRSpatialReference oSRS_WGS84; oSRS_WGS84.SetWellKnownGeogCS("WGS84"); @@ -899,10 +903,10 @@ std::shared_ptr GetCenterPointInRaster(QString filepath) long GetEPSGFromRasterFile(QString filepath) { qDebug() << "============= GetEPSGFromRasterFile ======================"; - // QTextCodec* codec = QTextCodec::codecForLocale(); // 获取系统默认编码的文本编解码器 - // QByteArray byteArray = codec->fromUnicode(filepath); // 将QString转换为QByteArray - //,这个应该会自动释放 const char* charArray = byteArray.constData(); // - // 获取QByteArray的const char*指针 + // QTextCodec* codec = QTextCodec::codecForLocale(); // 鑾峰彇绯荤粺榛樿缂栫爜鐨勬枃鏈紪瑙g爜鍣 + // QByteArray byteArray = codec->fromUnicode(filepath); // 灏哘String杞崲涓篞ByteArray + //,杩欎釜搴旇浼氳嚜鍔ㄩ噴鏀 const char* charArray = byteArray.constData(); // + // 鑾峰彇QByteArray鐨刢onst char*鎸囬拡 { if (QFile(filepath).exists()) { @@ -913,9 +917,9 @@ long GetEPSGFromRasterFile(QString filepath) } GDALAllRegister(); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); // 注册GDAL驱动 + CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); // 娉ㄥ唽GDAL椹卞姩 // qDebug()<GetProjectionRef(); qDebug() << QString::fromUtf8(pszProjection); - // 创建SpatialReference对象 + // 鍒涘缓SpatialReference瀵硅薄 OGRSpatialReference oSRS; if (oSRS.importFromWkt((char**)&pszProjection) != OGRERR_NONE) { qDebug() << ("Error: Unable to import projection information.\n"); @@ -945,7 +949,7 @@ long GetEPSGFromRasterFile(QString filepath) return -1; } - long epsgCode = atoi(epscodestr); // 获取EPSG代码 + long epsgCode = atoi(epscodestr); // 鑾峰彇EPSG浠g爜 if (epsgCode != 0) { GDALClose(poDataset); @@ -983,16 +987,16 @@ long getProjectEPSGCodeByLon_Lat(double long, double lat, ProjectStripDelta stri } long getProjectEPSGCodeByLon_Lat_inStrip3(double lon, double lat) { - // EPSG 4534 ~ 4554 3 度带 - // 首先判断是否是在 中国带宽范围 - // 中心经度范围 :75E ~ 135E 实际范围 73.5E ~ 136.5E, - // 纬度范围 3N ~ 54N,放宽到 0N~ 60N - if (73.5 <= lon && lon <= 136.5 && 0 <= lat && lat <= 60) { // 中国境内 + // EPSG 4534 ~ 4554 3 搴﹀甫 + // 棣栧厛鍒ゆ柇鏄惁鏄湪 涓浗甯﹀鑼冨洿 + // 涓績缁忓害鑼冨洿 锛75E ~ 135E 瀹為檯鑼冨洿 73.5E ~ 136.5E, + // 绾害鑼冨洿 3N ~ 54N锛屾斁瀹藉埌 0N~ 60N + if (73.5 <= lon && lon <= 136.5 && 0 <= lat && lat <= 60) { // 涓浗澧冨唴 long code = trunc((lon - 73.5) / 3) + 4534; return code; } - else { // 非中国境内 使用 高斯克吕格 - bool isSouth = lat < 0; // 简单判断南北半球,这里仅为示例,实际应用可能需要更细致的逻辑 + else { // 闈炰腑鍥藉鍐 浣跨敤 楂樻柉鍏嬪悤鏍 + bool isSouth = lat < 0; // 绠鍗曞垽鏂崡鍖楀崐鐞冿紝杩欓噷浠呬负绀轰緥锛屽疄闄呭簲鐢ㄥ彲鑳介渶瑕佹洿缁嗚嚧鐨勯昏緫 long prefix = isSouth ? 327000 : 326000; // std::string prefix = isSouth ? "327" : "326"; lon = fmod(lon + 360.0, 360.0); @@ -1004,18 +1008,18 @@ long getProjectEPSGCodeByLon_Lat_inStrip3(double lon, double lat) } long getProjectEPSGCodeByLon_Lat_inStrip6(double lon, double lat) { - // EPSG 4502 ~ 4512 6度带 - // 首先判断是否是在 中国带宽范围 - // 中心经度范围 :75E ~ 135E 实际范围 72.0E ~ 138E, - // 纬度范围 3N ~ 54N,放宽到 0N~ 60N - if (73.5 <= lon && lon <= 136.5 && 0 <= lat && lat <= 60) { // 中国境内 + // EPSG 4502 ~ 4512 6搴﹀甫 + // 棣栧厛鍒ゆ柇鏄惁鏄湪 涓浗甯﹀鑼冨洿 + // 涓績缁忓害鑼冨洿 锛75E ~ 135E 瀹為檯鑼冨洿 72.0E ~ 138E, + // 绾害鑼冨洿 3N ~ 54N锛屾斁瀹藉埌 0N~ 60N + if (73.5 <= lon && lon <= 136.5 && 0 <= lat && lat <= 60) { // 涓浗澧冨唴 long code = trunc((lon - 72.0) / 6) + 4502; return code; } - else { // 非中国境内 使用 UTM// 确定带号,6度带从1开始到60,每6度一个带 + else { // 闈炰腑鍥藉鍐 浣跨敤 UTM// 纭畾甯﹀彿锛6搴﹀甫浠1寮濮嬪埌60锛屾瘡6搴︿竴涓甫 int zone = static_cast((lon + 180.0) / 6.0) + 1; - bool isSouth = lon < 0; // 判断是否在南半球 - long epsgCodeBase = isSouth ? 32700 : 32600; // 计算EPSG代码 + bool isSouth = lon < 0; // 鍒ゆ柇鏄惁鍦ㄥ崡鍗婄悆 + long epsgCodeBase = isSouth ? 32700 : 32600; // 璁$畻EPSG浠g爜 long prefix = static_cast(epsgCodeBase + zone); return prefix; } @@ -1027,13 +1031,13 @@ QString GetProjectionNameFromEPSG(long epsgCode) qDebug() << "============= GetProjectionNameFromEPSG ======================"; OGRSpatialReference oSRS; - // 设置EPSG代码 + // 璁剧疆EPSG浠g爜 if (oSRS.importFromEPSG(epsgCode) != OGRERR_NONE) { qDebug() << "epsgcode not recognition"; return ""; } - // 获取并输出坐标系的描述(名称) + // 鑾峰彇骞惰緭鍑哄潗鏍囩郴鐨勬弿杩帮紙鍚嶇О锛 const char* pszName = oSRS.GetAttrValue("GEOGCS"); if (pszName) { qDebug() << "Coordinate system name for EPSG " + QString::number(epsgCode) @@ -1046,19 +1050,19 @@ QString GetProjectionNameFromEPSG(long epsgCode) } // char* wkt = NULL; - // // 转换为WKT格式 + // // 杞崲涓篧KT鏍煎紡 // oSRS.exportToWkt(&wkt); // // qDebug() << wkt; // - // // 从WKT中解析投影名称,这里简化处理,实际可能需要更复杂的逻辑来准确提取名称 + // // 浠嶹KT涓В鏋愭姇褰卞悕绉帮紝杩欓噷绠鍖栧鐞嗭紝瀹為檯鍙兘闇瑕佹洿澶嶆潅鐨勯昏緫鏉ュ噯纭彁鍙栧悕绉 // std::string wktStr(wkt); - // long start = wktStr.find("PROJCS[\"") + 8; // 找到"PROJCS["后的第一个双引号位置 - // // 从start位置开始找下一个双引号,这之间的内容即为投影名称 + // long start = wktStr.find("PROJCS[\"") + 8; // 鎵惧埌"PROJCS["鍚庣殑绗竴涓弻寮曞彿浣嶇疆 + // // 浠巗tart浣嶇疆寮濮嬫壘涓嬩竴涓弻寮曞彿锛岃繖涔嬮棿鐨勫唴瀹瑰嵆涓烘姇褰卞悕绉 // int end = wktStr.find('\"', start); // QString projName = QString::fromStdString(wktStr.substr(start, end - start)); // - // // 释放WKT字符串内存 + // // 閲婃斁WKT瀛楃涓插唴瀛 // CPLFree(wkt); // return projName; @@ -1111,11 +1115,11 @@ int ResampleGDAL(const char* pszSrcFile, const char* pszOutFile, double* gt, int char* pszSrcWKT = NULL; pszSrcWKT = const_cast(pDSrc->GetProjectionRef()); - // 锟斤拷锟矫伙拷锟酵队帮拷锟斤拷锟轿?拷锟斤拷锟揭伙拷锟?1锟?7 + // 閿熸枻鎷烽敓鐭紮鎷烽敓閰甸槦甯嫹閿熸枻鎷烽敓杞?鎷烽敓鏂ゆ嫹閿熸彮浼欐嫹閿?1閿?7 if (strlen(pszSrcWKT) <= 0) { OGRSpatialReference oSRS; oSRS.importFromEPSG(4326); - // oSRS.SetUTM(50, true); //锟斤拷锟斤拷锟斤拷 锟斤拷锟斤拷120锟斤拷 + // oSRS.SetUTM(50, true); //閿熸枻鎷烽敓鏂ゆ嫹閿熸枻鎷 閿熸枻鎷烽敓鏂ゆ嫹120閿熸枻鎷 // oSRS.SetWellKnownGeogCS("WGS84"); oSRS.exportToWkt(&pszSrcWKT); } @@ -1124,7 +1128,7 @@ int ResampleGDAL(const char* pszSrcFile, const char* pszOutFile, double* gt, int hTransformArg = GDALCreateGenImgProjTransformer((GDALDatasetH)pDSrc, pszSrcWKT, NULL, pszSrcWKT, FALSE, 0.0, 1); qDebug() << "no proj " << Qt::endl; - //(没锟斤拷投影锟斤拷影锟斤拷锟斤拷锟斤拷锟斤拷卟锟酵?拷锟?1锟?7) + //(娌¢敓鏂ゆ嫹鎶曞奖閿熸枻鎷峰奖閿熸枻鎷烽敓鏂ゆ嫹閿熸枻鎷烽敓鏂ゆ嫹鍗熼敓閰?鎷烽敓?1閿?7) if (hTransformArg == NULL) { GDALClose((GDALDatasetH)(GDALDatasetH)pDSrc); return -3; @@ -1152,8 +1156,8 @@ int ResampleGDAL(const char* pszSrcFile, const char* pszOutFile, double* gt, int pDDst->SetGeoTransform(gt); GDALWarpOptions* psWo = GDALCreateWarpOptions(); - CPLSetConfigOption("GDAL_NUM_THREADS", "ALL_CPUS"); // 使用所有可用的CPU核心 - CPLSetConfigOption("GDAL_CACHEMAX", "4000"); // 设置缓存大小为500MB + CPLSetConfigOption("GDAL_NUM_THREADS", "ALL_CPUS"); // 浣跨敤鎵鏈夊彲鐢ㄧ殑CPU鏍稿績 + CPLSetConfigOption("GDAL_CACHEMAX", "4000"); // 璁剧疆缂撳瓨澶у皬涓500MB // psWo->papszWarpOptions = CSLDuplicate(NULL); psWo->eWorkingDataType = dataType; psWo->eResampleAlg = eResample; @@ -1361,7 +1365,7 @@ int alignRaster(QString inputPath, QString referencePath, QString outputPath, GD -/** 2025.03.25 下面的函数存在 Eigen使用****************************/ +/** 2025.03.25 涓嬮潰鐨勫嚱鏁板瓨鍦 Eigen浣跨敤****************************/ @@ -1392,8 +1396,8 @@ int saveMatrixXcd2TiFF(Eigen::MatrixXcd data, QString out_tiff_path) Eigen::MatrixXd gt = Eigen::MatrixXd::Zero(2, 3); gdalImage image_tiff = - CreategdalImage(out_tiff_path, rows, cols, 2, gt, "", false, true); // 注意这里保留仿真结果 - // 保存二进制文件 + CreategdalImage(out_tiff_path, rows, cols, 2, gt, "", false, true); // 娉ㄦ剰杩欓噷淇濈暀浠跨湡缁撴灉 + // 淇濆瓨浜岃繘鍒舵枃浠 Eigen::MatrixXd real_img = data.array().real(); Eigen::MatrixXd imag_img = data.array().imag(); image_tiff.saveImage(real_img, 0, 0, 1); @@ -1433,7 +1437,7 @@ ErrorCode DEM2XYZRasterAndSlopRaster(QString dempath, QString demxyzpath, QStri gdalImage demds(dempath); gdalImage demxyz = CreategdalImage(demxyzpath, demds.height, demds.width, 3, demds.gt, demds.projection, true, true);// X,Y,Z - // 分块计算并转换为XYZ + // 鍒嗗潡璁$畻骞惰浆鎹负XYZ Eigen::MatrixXd demArr = demds.getData(0, 0, demds.height, demds.width, 1); Eigen::MatrixXd demR = demArr; @@ -1459,8 +1463,8 @@ ErrorCode DEM2XYZRasterAndSlopRaster(QString dempath, QString demxyzpath, QStri for (int j = 0; j < datacols; j++) { rowidx = i + max_rows_ids; colidx = j; - demds.getLandPoint(rowidx, colidx, demdata(i, j), LandP); // 获取地理坐标 - LLA2XYZ(LandP, GERpoint); // 经纬度转换为地心坐标系 + demds.getLandPoint(rowidx, colidx, demdata(i, j), LandP); // 鑾峰彇鍦扮悊鍧愭爣 + LLA2XYZ(LandP, GERpoint); // 缁忕含搴﹁浆鎹负鍦板績鍧愭爣绯 xyzdata_x(i, j) = GERpoint.x; xyzdata_y(i, j) = GERpoint.y; xyzdata_z(i, j) = GERpoint.z; @@ -1472,7 +1476,7 @@ ErrorCode DEM2XYZRasterAndSlopRaster(QString dempath, QString demxyzpath, QStri } - // 计算坡向角 + // 璁$畻鍧″悜瑙 gdalImage demsloperxyz = CreategdalImage(demsloperPath, demds.height, demds.width, 4, demds.gt, demds.projection, true, true);// X,Y,Z,cosangle line_invert = 1000; @@ -1507,13 +1511,13 @@ ErrorCode DEM2XYZRasterAndSlopRaster(QString dempath, QString demxyzpath, QStri demds.getLandPoint(rowidx + 1, colidx, demdata(i + 1, j), p3); demds.getLandPoint(rowidx, colidx + 1, demdata(i, j + 1), p4); - pslopeVector = getSlopeVector(p0, p1, p2, p3, p4); // 地面坡向矢量 + pslopeVector = getSlopeVector(p0, p1, p2, p3, p4); // 鍦伴潰鍧″悜鐭㈤噺 slopeVector = { pslopeVector.lon,pslopeVector.lat,pslopeVector.ati }; pp = LLA2XYZ(p0); Zaxis.x = pp.lon; Zaxis.y = pp.lat; Zaxis.z = pp.ati; - sloperAngle = getCosAngle(slopeVector, Zaxis); // 地面坡向角 + sloperAngle = getCosAngle(slopeVector, Zaxis); // 鍦伴潰鍧″悜瑙 demsloper_x(i, j) = slopeVector.x; demsloper_y(i, j) = slopeVector.y; @@ -1549,7 +1553,7 @@ void CreateSARIntensityByLookTable(QString IntensityRasterPath, Eigen::MatrixXd SARData = SARIntensity.getData(0, 0, SARIntensity.height, SARIntensity.width, 1); SARData = SARData.array() * 0; - // 分块处理 + // 鍒嗗潡澶勭悊 for (int yOff = 0; yOff < looktableds.height; yOff += blockYSize) { processBarShow(yOff, looktableds.height); @@ -1575,9 +1579,267 @@ void CreateSARIntensityByLookTable(QString IntensityRasterPath, } -/* 启动下面的函数,会导致编译器错误,可能与Eigen 库 本身的bug相关,不建议排查,太费时间,而且不一定能排查出来 + + + + + + +/**鈥 +* @brief 灏哣RT鏂囦欢杞崲涓篍NVI鏍煎紡锛堢敓鎴.dat鍜.hdr鏂囦欢锛 +* @param inputVrtPath 杈撳叆VRT鏂囦欢璺緞 +* @param outputEnviPath 杈撳嚭ENVI鏁版嵁鏂囦欢璺緞锛堜笉鍚墿灞曞悕锛岃嚜鍔ㄧ敓鎴.dat鍜.hdr锛 +* @param papszOptions GDAL鍒涘缓閫夐」锛堝鍘嬬缉鍙傛暟銆佸瓨鍌ㄩ『搴忕瓑锛岄粯璁ULL锛 +* @return 鎴愬姛杩斿洖true锛屽け璐ヨ繑鍥瀎alse +*/ +bool ConvertVrtToEnvi(QString vrtPath, QString outPath) { + + GDALAllRegister(); + CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); // 娉ㄧ粸鏂ゆ嫹鏂ゆ嫹閿?1閿?7 + CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); + + const char* inputVrtPath = vrtPath.toUtf8().constData(); + const char* outputEnviPath = outPath.toUtf8().constData(); + + // 娉ㄥ唽鎵鏈塆DAL椹卞姩[7](@ref) + GDALAllRegister(); + + // 鎵撳紑杈撳叆VRT鏂囦欢[1,3](@ref) + GDALDataset* poVRTDataset = (GDALDataset*)GDALOpen(inputVrtPath, GA_ReadOnly); + if (!poVRTDataset) { + qDebug() << "閿欒锛氭棤娉曟墦寮VRT鏂囦欢 " << inputVrtPath ; + return false; + } + + // 鑾峰彇ENVI椹卞姩[4,7](@ref) + GDALDriver* poENVIDriver = GetGDALDriverManager()->GetDriverByName("ENVI"); + if (!poENVIDriver) { + qDebug() << "閿欒锛欵NVI椹卞姩鏈姞杞" ; + GDALClose(poVRTDataset); + return false; + } + + // 鏋勯犺緭鍑烘枃浠跺悕锛堝己鍒舵坊鍔.dat鍚庣紑锛塠4](@ref) + std::string outputPath = std::string(outputEnviPath) + ".dat"; + + // 鎵ц鏍煎紡杞崲锛堣嚜鍔ㄧ敓鎴.hdr澶存枃浠讹級[4,7](@ref) + GDALDataset* poENVIDataset = poENVIDriver->CreateCopy( + outputPath.c_str(), // 杈撳嚭璺緞 + poVRTDataset, // 杈撳叆鏁版嵁闆 + FALSE, // 闈炰弗鏍兼ā寮忥紙鍏佽鏍煎紡璋冩暣锛 + nullptr, // 鐢ㄦ埛鑷畾涔夐夐」锛堝鍘嬬缉鍙傛暟锛 + nullptr, nullptr // 杩涘害鏉″拰鍙傛暟锛堟殏涓嶅惎鐢級 + ); + + // 妫鏌ヨ浆鎹㈢粨鏋 + bool success = (poENVIDataset != nullptr); + if (!success) { + qDebug() << "閿欒锛欵NVI鏂囦欢鍒涘缓澶辫触" ; + } + else { + GDALClose(poENVIDataset); + } + + // 鍏抽棴杈撳叆鏁版嵁闆 + GDALClose(poVRTDataset); + return success; +} + + + + +// 閬ユ劅绫 +ErrorCode ResampleDEM(QString indemPath, QString outdemPath, double gridx, double gridy) +{ + double gridlat = gridy / 110000.0; + double gridlon = gridx / 100000.0; + + long espgcode = GetEPSGFromRasterFile(indemPath.toUtf8().constData()); + if (espgcode == 4326) { + resampleRaster(indemPath.toUtf8().constData(), outdemPath.toUtf8().constData(), gridlon, gridlat); + return ErrorCode::SUCCESS; + } + else { + QMessageBox::warning(nullptr, u8"璀﹀憡", u8"璇疯緭鍏GS84鍧愭爣鐨凞EM褰卞儚"); + return ErrorCode::FAIL; + } +} + + + +ErrorCode Complex2AmpRaster(QString inComplexPath, QString outRasterPath) +{ + gdalImageComplex inimg(inComplexPath); + gdalImage ampimg = 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 imgArrb1 = Eigen::MatrixXd::Zero(blocklines, ampimg.width); + Eigen::MatrixXcd imgArr = Eigen::MatrixXcd::Zero(blocklines, inimg.width); + + long startrow = 0; + 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); + imgArrb1 = imgArr.array().abs(); + ampimg.saveImage(imgArrb1, startrow, 0, 1); + } + qDebug() << "褰卞儚鍐欏叆鍒帮細" << outRasterPath; + return ErrorCode::SUCCESS; +} + +ErrorCode Complex2PhaseRaster(QString inComplexPath, QString outRasterPath) +{ + gdalImageComplex inimg(inComplexPath); + gdalImage ampimg = 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 imgArrb1 = Eigen::MatrixXd::Zero(blocklines, ampimg.width); + Eigen::MatrixXcd imgArr = Eigen::MatrixXcd::Zero(blocklines, inimg.width); + + long startrow = 0; + 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); + imgArrb1 = imgArr.array().arg(); + ampimg.saveImage(imgArrb1, startrow, 0, 1); + } + qDebug() << "褰卞儚鍐欏叆鍒帮細" << outRasterPath; + return ErrorCode::SUCCESS; +} + +ErrorCode Complex2dBRaster(QString inComplexPath, QString outRasterPath) +{ + gdalImageComplex inimg(inComplexPath); + gdalImage ampimg = 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 imgArrb1 = Eigen::MatrixXd::Zero(blocklines, ampimg.width); + Eigen::MatrixXcd imgArr = Eigen::MatrixXcd::Zero(blocklines, inimg.width); + + long startrow = 0; + 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); + imgArrb1 = imgArr.array().abs().log10() * 20.0; + ampimg.saveImage(imgArrb1, startrow, 0, 1); + } + qDebug() << "褰卞儚鍐欏叆鍒帮細" << outRasterPath; + return ErrorCode::SUCCESS; +} + + + + + +void MultiLookRaster(QString inRasterPath, QString outRasterPath, long looklineNumrow, long looklineNumCol) +{ + gdalImage inRaster(inRasterPath); + + int outRows = inRaster.height / looklineNumrow; + int outCols = inRaster.width / looklineNumCol; + int bandnum = 1; + QString project = inRaster.projection; + Eigen::MatrixXd inRasterGt = inRaster.gt; + GDALDataType datetype = inRaster.getDataType(); + + gdalImage outRaster = CreategdalImage(outRasterPath, outRows, outCols, 1, inRasterGt, project, true, true, true, datetype); + + Eigen::MatrixXd inRasterArr = inRaster.getData(0, 0, inRaster.height, inRaster.width, 1); + Eigen::MatrixXd outRasterArr = outRaster.getData(0, 0, outRows, outCols, 1); + + + // 澶氳澶勭悊 +#pragma omp parallel for collapse(2) + for (int row = 0; row < outRows; ++row) { + for (int col = 0; col < outCols; ++col) { + // 璁$畻杈撳叆鐭╅樀鐨勭獥鍙d綅缃甗2,3](@ref) + const int inputRow = row * looklineNumrow; + const int inputCol = col * looklineNumCol; + + // 鍔ㄦ佽绠楀疄闄呯獥鍙eぇ灏忥紙澶勭悊杈圭晫鎯呭喌锛塠3](@ref) + const int actualRows = (row == outRows - 1) ? + (inRaster.height - inputRow) : looklineNumrow; + const int actualCols = (col == outCols - 1) ? + (inRaster.width - inputCol) : looklineNumCol; + + // 鎻愬彇褰撳墠绐楀彛鏁版嵁鍧梉7](@ref) + Eigen::MatrixXd window = inRasterArr.block(inputRow, inputCol, actualRows, actualCols); + + // 璁$畻澶氳骞冲潎鍊硷紙鑷姩澶勭悊鏁版嵁绫诲瀷杞崲锛塠2,7](@ref) + double sum = 0.0; + if constexpr (std::is_integral_v) { + sum = window.cast().sum(); // 鏁村瀷鏁版嵁杞崲涓哄弻绮惧害璁$畻 + } + else { + sum = window.sum(); + } + outRasterArr(row, col) = sum / (actualRows * actualCols); + } + } + + // 鍙夛細澶勭悊娈嬬暀杈圭晫锛堝綋杈撳叆灏哄涓嶆槸鏁存暟鍊嶆椂锛 + if ((inRaster.height % looklineNumrow != 0) || (inRaster.width % looklineNumCol != 0)) { + // 搴曢儴杈圭晫澶勭悊[3](@ref) + const int residualRowStart = outRows * looklineNumrow; + const int residualRowSize = inRaster.height - residualRowStart; + if (residualRowSize > 0) { +#pragma omp parallel for + for (int col = 0; col < outCols; ++col) { + const int inputCol = col * looklineNumCol; + const int actualCols = (col == outCols - 1) ? + (inRaster.width - inputCol) : looklineNumCol; + + Eigen::MatrixXd window = inRasterArr.block(residualRowStart, inputCol, + residualRowSize, actualCols); + outRasterArr(outRows - 1, col) = window.mean(); + } + } + + // 鍙充晶杈圭晫澶勭悊[3](@ref) + const int residualColStart = outCols * looklineNumCol; + const int residualColSize = inRaster.width - residualColStart; + if (residualColSize > 0) { +#pragma omp parallel for + for (int row = 0; row < outRows; ++row) { + const int inputRow = row * looklineNumrow; + const int actualRows = (row == outRows - 1) ? + (inRaster.height - inputRow) : looklineNumrow; + + Eigen::MatrixXd window = inRasterArr.block(inputRow, residualColStart, + actualRows, residualColSize); + outRasterArr(row, outCols - 1) = window.mean(); + } + } + } + + // 淇濆瓨缁撴灉 + outRaster.saveImage(outRasterArr, 0, 0, 1); + +} + + + + + + + + + + + + + +/* 鍚姩涓嬮潰鐨勫嚱鏁帮紝浼氬鑷寸紪璇戝櫒閿欒锛屽彲鑳戒笌Eigen 搴 鏈韩鐨刡ug鐩稿叧锛屼笉寤鸿鎺掓煡锛屽お璐规椂闂达紝鑰屼笖涓嶄竴瀹氳兘鎺掓煡鍑烘潵 * -*** +*** Eigen::Matrix ReadComplexMatrixData(int start_line, int width, int line_num, std::shared_ptr rasterDataset, GDALDataType gdal_datatype) @@ -1601,7 +1863,7 @@ Eigen::Matrix ReadCompl } bool _flag = false; Eigen::Matrix data_mat( - line_num * width, 2); // 必须强制行优先 + line_num * width, 2); // 蹇呴』寮哄埗琛屼紭鍏 if (gdal_datatype == GDT_Byte) { Eigen::MatrixX real_mat(line_num * width, 1); Eigen::MatrixX imag_mat(line_num * width, 1); @@ -1751,14 +2013,14 @@ Eigen::Matrix ReadCompl } else { } - // 保存数据 + // 淇濆瓨鏁版嵁 if (_flag) { return data_mat; } else { return Eigen::Matrix( - 0, 0); // 必须强制行优先; + 0, 0); // 蹇呴』寮哄埗琛屼紭鍏; } } @@ -1767,10 +2029,10 @@ ReadMatrixDoubleData(int start_line, int width, int line_num, std::shared_ptr rasterDataset, GDALDataType gdal_datatype, int band_idx) { - // 构建矩阵块,使用eigen 进行矩阵计算,加速计算 + // 鏋勫缓鐭╅樀鍧楋紝浣跨敤eigen 杩涜鐭╅樀璁$畻锛屽姞閫熻绠 bool _flag = false; Eigen::Matrix data_mat( - line_num * width, 1); // 必须强制行优先 + line_num * width, 1); // 蹇呴』寮哄埗琛屼紭鍏 if (gdal_datatype == GDT_Byte) { Eigen::MatrixX real_mat(line_num * width, 1); rasterDataset->GetRasterBand(band_idx)->RasterIO(GF_Read, 0, start_line, width, line_num, diff --git a/Toolbox/BaseToolbox/BaseToolbox.vcxproj b/Toolbox/BaseToolbox/BaseToolbox.vcxproj index 5384b55..5ec3f82 100644 --- a/Toolbox/BaseToolbox/BaseToolbox.vcxproj +++ b/Toolbox/BaseToolbox/BaseToolbox.vcxproj @@ -60,12 +60,12 @@ tools_qt5 - core + core;gui;widgets debug tools_qt5 - core + core;gui;widgets debug diff --git a/Toolbox/BaseToolbox/BaseToolbox/GF3CalibrationAndGeocodingClass.cpp b/Toolbox/BaseToolbox/BaseToolbox/GF3CalibrationAndGeocodingClass.cpp index 76188ba..1e5fdcd 100644 --- a/Toolbox/BaseToolbox/BaseToolbox/GF3CalibrationAndGeocodingClass.cpp +++ b/Toolbox/BaseToolbox/BaseToolbox/GF3CalibrationAndGeocodingClass.cpp @@ -209,90 +209,6 @@ ErrorCode ImportGF3L1AProcess(QString inMetaxmlPath, QString outWorkDirPath) return errorcode; } -ErrorCode Complex2AmpRaster(QString inComplexPath, QString outRasterPath) -{ - gdalImageComplex inimg(inComplexPath); - gdalImage ampimg = 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 imgArrb1 = Eigen::MatrixXd::Zero(blocklines, ampimg.width); - Eigen::MatrixXcd imgArr = Eigen::MatrixXcd::Zero(blocklines, inimg.width); - - long startrow = 0; - 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); - imgArrb1 = imgArr.array().abs(); - ampimg.saveImage(imgArrb1, startrow, 0, 1); - } - qDebug() << "影像写入到:" << outRasterPath; - return ErrorCode::SUCCESS; -} - -ErrorCode Complex2PhaseRaster(QString inComplexPath, QString outRasterPath) -{ - gdalImageComplex inimg(inComplexPath); - gdalImage ampimg = 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 imgArrb1 = Eigen::MatrixXd::Zero(blocklines, ampimg.width); - Eigen::MatrixXcd imgArr = Eigen::MatrixXcd::Zero(blocklines, inimg.width); - - long startrow = 0; - 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); - imgArrb1 = imgArr.array().arg(); - ampimg.saveImage(imgArrb1, startrow, 0, 1); - } - qDebug() << "影像写入到:" << outRasterPath; - return ErrorCode::SUCCESS; -} - -ErrorCode Complex2dBRaster(QString inComplexPath, QString outRasterPath) -{ - gdalImageComplex inimg(inComplexPath); - gdalImage ampimg = 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 imgArrb1 = Eigen::MatrixXd::Zero(blocklines, ampimg.width); - Eigen::MatrixXcd imgArr = Eigen::MatrixXcd::Zero(blocklines, inimg.width); - - long startrow = 0; - 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); - imgArrb1 = imgArr.array().abs().log10() * 20.0; - ampimg.saveImage(imgArrb1, startrow, 0, 1); - } - qDebug() << "影像写入到:" << outRasterPath; - return ErrorCode::SUCCESS; -} - -ErrorCode ResampleDEM(QString indemPath, QString outdemPath, double gridx, double gridy) -{ - double gridlat = gridy / 110000.0; - double gridlon = gridx / 100000.0; - - long espgcode = GetEPSGFromRasterFile(indemPath.toUtf8().constData()); - if (espgcode == 4326) { - resampleRaster(indemPath.toUtf8().constData(), outdemPath.toUtf8().constData(), gridlon, gridlat); - return ErrorCode::SUCCESS; - } - else { - QMessageBox::warning(nullptr, u8"警告", u8"请输入WGS84坐标的DEM影像"); - return ErrorCode::FAIL; - } -} - ErrorCode RD_PSTN(double& refrange, double& lamda, double& timeR, double& R, double& tx, double& ty, double& tz, double& slopex, double& slopey, double& slopez, GF3PolyfitSatelliteOribtModel& polyfitmodel, SatelliteOribtNode& node, double& d0, double& d1, double& d2, double& d3, double& d4) { @@ -605,7 +521,3 @@ ErrorCode GF3RDProcess(QString inxmlPath, QString indemPath, QString outworkdir, } return ErrorCode::SUCCESS; } - - - - diff --git a/Toolbox/BaseToolbox/BaseToolbox/GF3CalibrationAndGeocodingClass.h b/Toolbox/BaseToolbox/BaseToolbox/GF3CalibrationAndGeocodingClass.h index 2309c4c..db71e8c 100644 --- a/Toolbox/BaseToolbox/BaseToolbox/GF3CalibrationAndGeocodingClass.h +++ b/Toolbox/BaseToolbox/BaseToolbox/GF3CalibrationAndGeocodingClass.h @@ -17,14 +17,7 @@ QVector SearchGF3DataTiff(QString inMetaxmlPath); POLARTYPEENUM getDatasetGF3FilePolsarType(QString fileName); ErrorCode ImportGF3L1AProcess(QString inMetaxmlPath, QString outWorkDirPath); -// 复数转实部 -ErrorCode Complex2AmpRaster(QString inComplexPath, QString outRasterPath); -//复数转相位 -ErrorCode Complex2PhaseRaster(QString inComplexPath, QString outRasterPath); -ErrorCode Complex2dBRaster(QString inComplexPath, QString outRasterPath); - -ErrorCode ResampleDEM(QString indemPath, QString outdemPath, double gridx, double gridy); // RD 算法类 ErrorCode RD_PSTN(double& refrange,double& lamda, double& timeR, double& R, double& tx, double& ty, double& tz, double& slopex, double& slopey, double& slopez, GF3PolyfitSatelliteOribtModel& polyfitmodel, SatelliteOribtNode& node,double& d0,double& d1, double& d2, double& d3, double& d4); @@ -36,6 +29,3 @@ ErrorCode GF3OrthSLC( QString inRasterPath, QString inlooktablePath, QString out // 正射处理流程 ErrorCode GF3RDProcess(QString inxmlPath, QString indemPath, QString outworkdir, double gridx, double gridy); - - - diff --git a/Toolbox/BaseToolbox/BaseToolbox/QComplex2AmpPhase.cpp b/Toolbox/BaseToolbox/BaseToolbox/QComplex2AmpPhase.cpp index 90b6580..af2d5a6 100644 --- a/Toolbox/BaseToolbox/BaseToolbox/QComplex2AmpPhase.cpp +++ b/Toolbox/BaseToolbox/BaseToolbox/QComplex2AmpPhase.cpp @@ -5,6 +5,7 @@ #include "BaseTool.h" #include "SARSimulationImageL1.h" #include "GF3CalibrationAndGeocodingClass.h" +#include "RasterToolBase.h" QComplex2AmpPhase::QComplex2AmpPhase(QWidget *parent) : QDialog(parent) diff --git a/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.cpp b/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.cpp index 36a432d..334bc9c 100644 --- a/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.cpp +++ b/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.cpp @@ -639,8 +639,6 @@ void InterploateClipAtiByRefDEM(QString ImageLLPath, QString& ImageDEMPath, QStr } - - int ReflectTable_WGS2Range(QString dem_rc_path,QString outOriSimTiffPath,QString ori_sim_count_tiffPath,long OriHeight,long OriWidth) { gdalImage sim_rc(dem_rc_path); @@ -783,7 +781,6 @@ int ReflectTable_WGS2Range(QString dem_rc_path,QString outOriSimTiffPath,QStrin } - int ResampleEChoDataFromGeoEcho(QString L2echodataPath, QString RangeLooktablePath, QString L1AEchoDataPath) { gdalImageComplex echodata(L2echodataPath); gdalImage looktable(RangeLooktablePath); @@ -909,6 +906,126 @@ int ResampleEChoDataFromGeoEcho(QString L2echodataPath, QString RangeLooktablePa } +void InterpLookTableRfromDEM(QString lonlatPath, QString DEMPath, QString outllrpath) +{ + gdalImage LLimg(lonlatPath); + gdalImage demimg(DEMPath); + gdalImage LLRimg = CreategdalImageDouble(outllrpath, LLimg.height, LLimg.width, 3, true, true); + + long llimgheight = LLimg.height; + long llimgWidth = LLimg.width; + + Eigen::MatrixXd imglonArr = LLimg.getData(0, 0, llimgheight, llimgWidth, 1); + Eigen::MatrixXd imglatArr = LLimg.getData(0, 0, llimgheight, llimgWidth, 2); + Eigen::MatrixXd demArr = demimg.getData(0, 0, demimg.height, demimg.width, 1); + + Eigen::MatrixXd outRArr = imglonArr.array() * 0; + + LLRimg.saveImage(imglonArr, 0, 0, 1); + LLRimg.saveImage(imglatArr, 0, 0, 2); + + + for (long i = 0; i < llimgheight; i++) { + for (long j = 0; j < llimgWidth; j++) { + double lon = imglonArr(i, j); + double lat = imglatArr(i, j); + Landpoint point = demimg.getRow_Col(lon, lat); + + if (point.lon<1 || point.lon>demimg.width - 2 || point.lat < 1 || point.lat - 2) { + continue; + } + else {} + + Landpoint p0, p11, p21, p12, p22; + + p0.lon = point.lon; + p0.lat = point.lat; + + p11.lon = floor(p0.lon); + p11.lat = floor(p0.lat); + p11.ati = demArr(long(p11.lat), long(p11.lon)); + + p12.lon = ceil(p0.lon); + p12.lat = floor(p0.lat); + p12.ati = demArr(long(p12.lat), long(p12.lon)); + + p21.lon = floor(p0.lon); + p21.lat = ceil(p0.lat); + p21.ati = demArr(long(p21.lat), long(p21.lon)); + + p22.lon = ceil(p0.lon); + p22.lat = ceil(p0.lat); + p22.ati = demArr(long(p22.lat), long(p22.lon)); + + p0.lon = p0.lon - p11.lon; + p0.lat = p0.lat - p11.lat; + + p12.lon = p12.lon - p11.lon; + p12.lat = p12.lat - p11.lat; + + p21.lon = p21.lon - p11.lon; + p21.lat = p21.lat - p11.lat; + + p22.lon = p22.lon - p11.lon; + p22.lat = p22.lat - p11.lat; + + p11.lon = p11.lon - p11.lon; + p11.lat = p11.lat - p11.lat; + + p0.ati = Bilinear_interpolation(p0, p11, p21, p12, p22); + outRArr(i, j) = p0.ati; + + } + } + + LLRimg.saveImage(outRArr, 0, 0, 3); + + return; +} + +void RangeLooktableLLA_2_RangeLooktableXYZ(QString LLAPath, QString outXYZPath) +{ + + gdalImage LLAimg(LLAPath); + gdalImage xyzimg = CreategdalImageDouble(outXYZPath, LLAimg.height, LLAimg.width, 3, true, true); + + long llimgheight = LLAimg.height; + long llimgWidth = LLAimg.width; + + Eigen::MatrixXd lonArr = LLAimg.getData(0, 0, llimgheight, llimgWidth, 1); + Eigen::MatrixXd latArr = LLAimg.getData(0, 0, llimgheight, llimgWidth, 2); + Eigen::MatrixXd atiArr = LLAimg.getData(0, 0, llimgheight, llimgWidth, 3); + + // 使用LLA抓换为XYZ + Eigen::MatrixXd xArr = lonArr.array() * 0; + Eigen::MatrixXd yArr = lonArr.array() * 0; + Eigen::MatrixXd zArr = lonArr.array() * 0; + + + + for (long i = 0; i < llimgheight; i++) { + for (long j = 0; j < llimgWidth; j++) { + double lon = lonArr(i, j); + double lat = latArr(i, j); + double ati = atiArr(i, j); + Landpoint p{ lon,lat,ati }; + Landpoint XYZP=LLA2XYZ(p); + + xArr(i, j) = XYZP.lon; + yArr(i, j) = XYZP.lat; + zArr(i, j) = XYZP.ati; + + + } + } + + xyzimg.saveImage(xArr, 0, 0, 1); + xyzimg.saveImage(yArr, 0, 0, 2); + xyzimg.saveImage(zArr, 0, 0, 3); + + return; +} + diff --git a/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.h b/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.h index b3a0be9..bf329ae 100644 --- a/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.h +++ b/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.h @@ -17,4 +17,10 @@ int ReflectTable_WGS2Range(QString dem_rc_path, QString outOriSimTiffPath, QStr int ResampleEChoDataFromGeoEcho(QString L2echodataPath, QString RangeLooktablePath, QString L1AEchoDataPath); + +void InterpLookTableRfromDEM(QString lonlatPath, QString DEMPath, QString outllrpath); + +void RangeLooktableLLA_2_RangeLooktableXYZ(QString LLAPath, QString outXYZPath); + + #endif diff --git a/Toolbox/SimulationSARTool/SARImage/QL1ASARProcessDialog.cpp b/Toolbox/SimulationSARTool/SARImage/QL1ASARProcessDialog.cpp new file mode 100644 index 0000000..09b37cd --- /dev/null +++ b/Toolbox/SimulationSARTool/SARImage/QL1ASARProcessDialog.cpp @@ -0,0 +1,114 @@ +#include "QL1ASARProcessDialog.h" +#include "ui_QL1ASARProcessDialog.h" +#include "BaseConstVariable.h" +#include "BaseTool.h" +#include "RasterToolBase.h" +#include "LogInfoCls.h" +#include +#include +#include "ImageNetOperator.h" +#include "ImageOperatorBase.h" + +QL1ASARProcessDialog::QL1ASARProcessDialog(QWidget *parent) + : QDialog(parent) + ,ui(new Ui::QL1ASARProcessDialogClass) +{ + ui->setupUi(this); + + + connect(ui->pushButtonL1BSelect, SIGNAL(clicked()), this, SLOT(onpushButtonL1BSelect_clicked())); + connect(ui->pushButtonL1ASelect, SIGNAL(clicked()), this, SLOT(onpushButtonL1ASelect_clicked())); + connect(ui->pushButtonS1ASelect, SIGNAL(clicked()), this, SLOT(onpushButtonS1ASelect_clicked())); + connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(onbuttonBox_accepted())); + connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(onbuttonBox_rejected())); + + + + +} + +QL1ASARProcessDialog::~QL1ASARProcessDialog() +{ + + + +} + +void QL1ASARProcessDialog::onpushButtonL1BSelect_clicked() +{ + + QString fileNames = QFileDialog::getSaveFileName( + this, // 父窗口 + tr(u8"选择L1B数据文件"), // 标题 + QString(), // 默认路径 + tr(ENVI_FILE_FORMAT_FILTER) // 文件过滤器 + ); + // 如果用户选择了文件 + if (!fileNames.isEmpty()) { + QString message = "选择的文件有:\n"; + this->ui->lineEditL1ADataPath->setText(fileNames); + } + else { + QMessageBox::information(this, tr(u8"没有选择文件"), tr(u8"没有选择任何文件。")); + } + +} + +void QL1ASARProcessDialog::onpushButtonL1ASelect_clicked() +{ + QString fileNames = QFileDialog::getOpenFileName( + this, // 父窗口 + tr(u8"选择L1A数据文件"), // 标题 + QString(), // 默认路径 + tr(ENVI_FILE_FORMAT_FILTER) // 文件过滤器 + ); + // 如果用户选择了文件 + if (!fileNames.isEmpty()) { + QString message = "选择的文件有:\n"; + this->ui->lineEditL1ADataPath->setText(fileNames); + } + else { + QMessageBox::information(this, tr(u8"没有选择文件"), tr(u8"没有选择任何文件。")); + } +} + +void QL1ASARProcessDialog::onpushButtonS1ASelect_clicked() +{ + QString fileNames = QFileDialog::getSaveFileName( + this, // 父窗口 + tr(u8"选择单视斜距振幅产品文件"), // 标题 + QString(), // 默认路径 + tr(ENVI_FILE_FORMAT_FILTER) // 文件过滤器 + ); + // 如果用户选择了文件 + if (!fileNames.isEmpty()) { + QString message = "选择的文件有:\n"; + this->ui->lineSlAPath->setText(fileNames); + } + else { + QMessageBox::information(this, tr(u8"没有选择文件"), tr(u8"没有选择任何文件。")); + } +} + +void QL1ASARProcessDialog::onbuttonBox_accepted() +{ + QString l1arasterpath = ui->lineEditL1ADataPath->text(); + QString s1arasterpath = ui->lineSlAPath->text(); + QString l1brasterpath = ui->lineEditL1BDataPath->text(); + + long nlaz = ui->spinBoxLNAz->value(); + long nlra = ui->spinBoxLNRa->value(); + + qDebug() << "单视斜距复数产品 转 单视斜距幅度产品"; + Complex2AmpRaster(l1arasterpath, s1arasterpath); + + qDebug() << "单视斜距幅度产品 转 多视斜距幅度产品"; + MultiLookRaster(s1arasterpath, l1brasterpath, nlaz, nlra); + + QMessageBox::information(this, tr(u8"提示"), tr(u8"多视处理完成")); +} + +void QL1ASARProcessDialog::onbuttonBox_rejected() +{ + this->close(); +} diff --git a/Toolbox/SimulationSARTool/SARImage/QL1ASARProcessDialog.h b/Toolbox/SimulationSARTool/SARImage/QL1ASARProcessDialog.h new file mode 100644 index 0000000..3e27297 --- /dev/null +++ b/Toolbox/SimulationSARTool/SARImage/QL1ASARProcessDialog.h @@ -0,0 +1,30 @@ +#pragma once + +#include + + +namespace Ui { + class QL1ASARProcessDialogClass; + +}; + +class QL1ASARProcessDialog : public QDialog +{ + Q_OBJECT + +public: + QL1ASARProcessDialog(QWidget *parent = nullptr); + ~QL1ASARProcessDialog(); + + +public slots: + + void onpushButtonL1BSelect_clicked(); + void onpushButtonL1ASelect_clicked(); + void onpushButtonS1ASelect_clicked(); + void onbuttonBox_accepted(); + void onbuttonBox_rejected(); + +private: + Ui::QL1ASARProcessDialogClass* ui; +}; diff --git a/Toolbox/SimulationSARTool/SARImage/QL1ASARProcessDialog.ui b/Toolbox/SimulationSARTool/SARImage/QL1ASARProcessDialog.ui new file mode 100644 index 0000000..b3957fd --- /dev/null +++ b/Toolbox/SimulationSARTool/SARImage/QL1ASARProcessDialog.ui @@ -0,0 +1,232 @@ + + + QL1ASARProcessDialogClass + + + + 0 + 0 + 475 + 354 + + + + QL1ASARProcessDialog + + + + + + + 0 + 30 + + + + + + + + + + + + 0 + 30 + + + + + + + + + + + + 0 + 30 + + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + 0 + 30 + + + + 鍗曡鎸箙浜у搧锛 + + + + + + + + 0 + 30 + + + + 閫夋嫨 + + + + + + + + 0 + 30 + + + + L1B锛 + + + + + + + + 0 + 30 + + + + L1A浜у搧锛 + + + + + + + + 0 + 30 + + + + 閫夋嫨 + + + + + + + + 0 + 30 + + + + + + + + + + + 澶氳鍙傛暟 + + + + + + + 0 + 30 + + + + + 100 + 16777215 + + + + 鏂逛綅鍚戣鏁帮細 + + + + + + + + 0 + 30 + + + + + + + + + 0 + 30 + + + + + 100 + 16777215 + + + + 鏂逛綅鍚戣鏁帮細 + + + + + + + + 0 + 30 + + + + + + + + + + + + 0 + 30 + + + + 閫夋嫨 + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + diff --git a/Toolbox/SimulationSARTool/SARImage/QLonLatInterpAtiFromDEM.cpp b/Toolbox/SimulationSARTool/SARImage/QLonLatInterpAtiFromDEM.cpp new file mode 100644 index 0000000..4fbc603 --- /dev/null +++ b/Toolbox/SimulationSARTool/SARImage/QLonLatInterpAtiFromDEM.cpp @@ -0,0 +1,124 @@ +#include "QLonLatInterpAtiFromDEM.h" +#include "ui_QLonLatInterpAtiFromDEM.h" +#include "BaseConstVariable.h" +#include "BaseTool.h" +#include "RasterToolBase.h" +#include "LogInfoCls.h" +#include +#include +#include "ImageNetOperator.h" + +QLonLatInterpAtiFromDEM::QLonLatInterpAtiFromDEM(QWidget *parent) + : QDialog(parent) + ,ui(new Ui::QLonLatInterpAtiFromDEMClass) +{ + ui->setupUi(this); + + connect(ui->pushButtonLonLatRasterSelect, SIGNAL(clicked()), this, SLOT(onpushButtonLonLatRasterSelect_clicked())); + connect(ui->pushButtonDEMRasterSelect, SIGNAL(clicked()), this, SLOT(onpushButtonDEMRasterSelect_clicked())); + connect(ui->pushButtonLLARasterSelect, SIGNAL(clicked()), this, SLOT(onpushButtonLLARasterSelect_clicked())); + connect(ui->pushButtonXYZRasterSelect, SIGNAL(clicked()), this, SLOT(onpushButtonXYZRasterSelect_clicked())); + connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(onbuttonBox_accepted())); + connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(onbuttonBox_rejected())); + + +} + +QLonLatInterpAtiFromDEM::~QLonLatInterpAtiFromDEM() +{ + +} + +void QLonLatInterpAtiFromDEM::onpushButtonLonLatRasterSelect_clicked() +{ + + QString fileNames = QFileDialog::getOpenFileName( + this, // 父窗口 + tr(u8"选择坐标点数据文件"), // 标题 + QString(), // 默认路径 + tr(ENVI_FILE_FORMAT_FILTER) // 文件过滤器 + ); + // 如果用户选择了文件 + if (!fileNames.isEmpty()) { + QString message = "选择的文件有:\n"; + this->ui->lineEditLonLatRasterPath->setText(fileNames); + } + else { + QMessageBox::information(this, tr(u8"没有选择文件"), tr(u8"没有选择任何文件。")); + } + +} + +void QLonLatInterpAtiFromDEM::onpushButtonDEMRasterSelect_clicked() +{ + QString fileNames = QFileDialog::getOpenFileName( + this, // 父窗口 + tr(u8"选择DEM数据文件"), // 标题 + QString(), // 默认路径 + tr(ENVI_FILE_FORMAT_FILTER) // 文件过滤器 + ); + // 如果用户选择了文件 + if (!fileNames.isEmpty()) { + QString message = "选择的文件有:\n"; + this->ui->lineEditDEMRasterPath->setText(fileNames); + } + else { + QMessageBox::information(this, tr(u8"没有选择文件"), tr(u8"没有选择任何文件。")); + } +} + +void QLonLatInterpAtiFromDEM::onpushButtonLLARasterSelect_clicked() +{ + QString fileNames = QFileDialog::getSaveFileName( + this, // 父窗口 + tr(u8"选择保存采样后数据文件"), // 标题 + QString(), // 默认路径 + tr(ENVI_FILE_FORMAT_FILTER) // 文件过滤器 + ); + // 如果用户选择了文件 + if (!fileNames.isEmpty()) { + QString message = "选择的文件有:\n"; + this->ui->lineEditLLARasterPath->setText(fileNames); + } + else { + QMessageBox::information(this, tr(u8"没有选择文件"), tr(u8"没有选择任何文件。")); + } +} + +void QLonLatInterpAtiFromDEM::onpushButtonXYZRasterSelect_clicked() +{ + QString fileNames = QFileDialog::getSaveFileName( + this, // 父窗口 + tr(u8"选择采样后转换数据文件"), // 标题 + QString(), // 默认路径 + tr(ENVI_FILE_FORMAT_FILTER) // 文件过滤器 + ); + // 如果用户选择了文件 + if (!fileNames.isEmpty()) { + QString message = "选择的文件有:\n"; + this->ui->lineEditXYZRasterPath->setText(fileNames); + } + else { + QMessageBox::information(this, tr(u8"没有选择文件"), tr(u8"没有选择任何文件。")); + } +} + +void QLonLatInterpAtiFromDEM::onbuttonBox_accepted() +{ + QString llrasterpath = ui->lineEditLonLatRasterPath->text(); + QString demrasterpath = ui->lineEditDEMRasterPath->text(); + QString llarasterpath = ui->lineEditLLARasterPath->text(); + QString xyzrasterpath = ui->lineEditXYZRasterPath->text(); + + qDebug() << "从DEM采样高程中。。。。"; + InterpLookTableRfromDEM(llrasterpath, demrasterpath, llarasterpath); + qDebug() << "经纬度转换为XYZ中。。。。"; + RangeLooktableLLA_2_RangeLooktableXYZ(llarasterpath, xyzrasterpath); + QMessageBox::information(this, tr(u8"提示"), tr(u8"完成")); +} + +void QLonLatInterpAtiFromDEM::onbuttonBox_rejected() +{ + this->close(); +} + diff --git a/Toolbox/SimulationSARTool/SARImage/QLonLatInterpAtiFromDEM.h b/Toolbox/SimulationSARTool/SARImage/QLonLatInterpAtiFromDEM.h new file mode 100644 index 0000000..b728ef8 --- /dev/null +++ b/Toolbox/SimulationSARTool/SARImage/QLonLatInterpAtiFromDEM.h @@ -0,0 +1,29 @@ +#pragma once + +#include + +namespace Ui { + class QLonLatInterpAtiFromDEMClass; +} + +class QLonLatInterpAtiFromDEM : public QDialog +{ + Q_OBJECT + +public: + QLonLatInterpAtiFromDEM(QWidget *parent = nullptr); + ~QLonLatInterpAtiFromDEM(); + + +public slots: + void onpushButtonLonLatRasterSelect_clicked(); + void onpushButtonDEMRasterSelect_clicked(); + void onpushButtonLLARasterSelect_clicked(); + void onpushButtonXYZRasterSelect_clicked(); + void onbuttonBox_accepted(); + void onbuttonBox_rejected(); + + +private: + Ui::QLonLatInterpAtiFromDEMClass* ui; +}; diff --git a/Toolbox/SimulationSARTool/SARImage/QLonLatInterpAtiFromDEM.ui b/Toolbox/SimulationSARTool/SARImage/QLonLatInterpAtiFromDEM.ui new file mode 100644 index 0000000..4a31eca --- /dev/null +++ b/Toolbox/SimulationSARTool/SARImage/QLonLatInterpAtiFromDEM.ui @@ -0,0 +1,191 @@ + + + QLonLatInterpAtiFromDEMClass + + + + 0 + 0 + 600 + 400 + + + + QLonLatInterpAtiFromDEM + + + + + + + 0 + 30 + + + + 缁忕含搴︽暟鎹煩闃碉細 + + + + + + + + 0 + 30 + + + + + + + + + + + + 0 + 30 + + + + 閫夋嫨 + + + + + + + + 0 + 30 + + + + 寰呴噰鏍稤EM锛 + + + + + + + + 0 + 30 + + + + + + + + + + + + 0 + 30 + + + + 閫夋嫨 + + + + + + + + 0 + 30 + + + + 閲囨牱鐭╅樀锛圠LA锛夛細 + + + + + + + + 0 + 30 + + + + + + + + + + + + 0 + 30 + + + + 閫夋嫨 + + + + + + + + 0 + 30 + + + + 閲囨牱鐭╅樀锛圶YZ锛夛細 + + + + + + + + 0 + 30 + + + + + + + + + + + + 0 + 30 + + + + 閫夋嫨 + + + + + + + + 0 + 30 + + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + diff --git a/Toolbox/SimulationSARTool/SimulationSARTool.cpp b/Toolbox/SimulationSARTool/SimulationSARTool.cpp index 0d16cc6..0d01313 100644 --- a/Toolbox/SimulationSARTool/SimulationSARTool.cpp +++ b/Toolbox/SimulationSARTool/SimulationSARTool.cpp @@ -13,6 +13,8 @@ #include "QLookTableResampleFromWGS84ToRange.h" #include "QSARSimulationComplexEchoDataDialog.h" #include "QSimulationBPImageMultiProduction.h" +#include "QLonLatInterpAtiFromDEM.h" +#include "QL1ASARProcessDialog.h" void RegisterPreToolBox(LAMPMainWidget::RasterMainWidget* mainwindows, ToolBoxWidget* toolbox) @@ -31,6 +33,7 @@ void RegisterPreToolBox(LAMPMainWidget::RasterMainWidget* mainwindows, ToolBoxWi emit toolbox->addBoxToolItemSIGNAL(new QLookTableResampleFromWGS84ToRangeToolButton(toolbox)); emit toolbox->addBoxToolItemSIGNAL(new QSARSimulationComplexEchoDataDialogToolButton(toolbox)); emit toolbox->addBoxToolItemSIGNAL(new QSimulationBPImageMultiProductionToolButton(toolbox)); + emit toolbox->addBoxToolItemSIGNAL(new QLonLatInterpAtiFromDEMToolButton(toolbox)); } @@ -279,3 +282,37 @@ void QSimulationBPImageMultiProductionToolButton::run() QSimulationBPImageMultiProduction* dialog = new QSimulationBPImageMultiProduction; dialog->show(); } + +QLonLatInterpAtiFromDEMToolButton::QLonLatInterpAtiFromDEMToolButton(QWidget* parent) +{ + this->toolPath = QVector(0); + this->toolPath.push_back(u8"成像工具库"); + this->toolname = QString(u8"生产斜距成像平面"); +} + +QLonLatInterpAtiFromDEMToolButton::~QLonLatInterpAtiFromDEMToolButton() +{ +} + +void QLonLatInterpAtiFromDEMToolButton::run() +{ + QLonLatInterpAtiFromDEM* dialog = new QLonLatInterpAtiFromDEM; + dialog->show(); +} + +QL1ASARProcessDialogToolButton::QL1ASARProcessDialogToolButton(QWidget* parent) +{ + this->toolPath = QVector(0); + this->toolPath.push_back(u8"成像工具库"); + this->toolname = QString(u8"L1A级产品处理"); +} + +QL1ASARProcessDialogToolButton::~QL1ASARProcessDialogToolButton() +{ +} + +void QL1ASARProcessDialogToolButton::run() +{ + QL1ASARProcessDialog* dialog = new QL1ASARProcessDialog; + dialog->show(); +} diff --git a/Toolbox/SimulationSARTool/SimulationSARTool.h b/Toolbox/SimulationSARTool/SimulationSARTool.h index 011b236..9c20a47 100644 --- a/Toolbox/SimulationSARTool/SimulationSARTool.h +++ b/Toolbox/SimulationSARTool/SimulationSARTool.h @@ -175,3 +175,31 @@ public: }; + + + + +class SIMULATIONSARTOOL_EXPORT QLonLatInterpAtiFromDEMToolButton : public QToolAbstract { + Q_OBJECT +public: + QLonLatInterpAtiFromDEMToolButton(QWidget* parent = nullptr); + ~QLonLatInterpAtiFromDEMToolButton(); +public: + virtual void run() override; + +}; + + + + + +class SIMULATIONSARTOOL_EXPORT QL1ASARProcessDialogToolButton : public QToolAbstract { + Q_OBJECT +public: + QL1ASARProcessDialogToolButton(QWidget* parent = nullptr); + ~QL1ASARProcessDialogToolButton(); +public: + virtual void run() override; + +}; + diff --git a/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj b/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj index 62fb8ce..e4bdf9f 100644 --- a/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj +++ b/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj @@ -221,6 +221,8 @@ + + @@ -256,6 +258,8 @@ + + @@ -295,6 +299,8 @@ + + diff --git a/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj.filters b/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj.filters index b8510fa..e32b42e 100644 --- a/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj.filters +++ b/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj.filters @@ -157,6 +157,12 @@ SARImage + + SARImage + + + SARImage + @@ -207,6 +213,12 @@ SARImage + + SARImage + + + SARImage + @@ -260,6 +272,12 @@ SARImage + + SARImage + + + SARImage + From baa5f446a6280b03d01d78e75bc19bfe9e34cdd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=A2=9E=E8=BE=89?= <3045316072@qq.com> Date: Thu, 10 Apr 2025 18:40:27 +0800 Subject: [PATCH 31/44] =?UTF-8?q?=E5=9C=A8=E5=B7=A5=E5=85=B7=E7=AE=B1?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0L1B=E4=BA=A7=E5=93=81=E7=94=9F=E4=BA=A7?= =?UTF-8?q?=E5=B7=A5=E5=85=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Toolbox/SimulationSARTool/SimulationSARTool.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Toolbox/SimulationSARTool/SimulationSARTool.cpp b/Toolbox/SimulationSARTool/SimulationSARTool.cpp index 0d01313..438dd61 100644 --- a/Toolbox/SimulationSARTool/SimulationSARTool.cpp +++ b/Toolbox/SimulationSARTool/SimulationSARTool.cpp @@ -34,6 +34,7 @@ void RegisterPreToolBox(LAMPMainWidget::RasterMainWidget* mainwindows, ToolBoxWi emit toolbox->addBoxToolItemSIGNAL(new QSARSimulationComplexEchoDataDialogToolButton(toolbox)); emit toolbox->addBoxToolItemSIGNAL(new QSimulationBPImageMultiProductionToolButton(toolbox)); emit toolbox->addBoxToolItemSIGNAL(new QLonLatInterpAtiFromDEMToolButton(toolbox)); + emit toolbox->addBoxToolItemSIGNAL(new QL1ASARProcessDialogToolButton(toolbox)); } @@ -304,7 +305,7 @@ QL1ASARProcessDialogToolButton::QL1ASARProcessDialogToolButton(QWidget* parent) { this->toolPath = QVector(0); this->toolPath.push_back(u8"成像工具库"); - this->toolname = QString(u8"L1A级产品处理"); + this->toolname = QString(u8"生产L1B级产品"); } QL1ASARProcessDialogToolButton::~QL1ASARProcessDialogToolButton() From 005abdb827b5efd5b382a482d5ef5c4f4b249144 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=A2=9E=E8=BE=89?= <3045316072@qq.com> Date: Thu, 10 Apr 2025 19:15:14 +0800 Subject: [PATCH 32/44] =?UTF-8?q?=E5=A2=9E=E5=8A=A0vrt=20=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E8=BD=AC=20envidata=E6=A0=BC=E5=BC=8F=E6=95=B0?= =?UTF-8?q?=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Toolbox/BaseToolbox/BaseToolbox.cpp | 21 ++- Toolbox/BaseToolbox/BaseToolbox.h | 18 ++- Toolbox/BaseToolbox/BaseToolbox.vcxproj | 3 + .../BaseToolbox/BaseToolbox.vcxproj.filters | 9 ++ .../BaseToolbox/RasterVRT2ENVIdataDialog.cpp | 78 +++++++++++ .../BaseToolbox/RasterVRT2ENVIdataDialog.h | 26 ++++ .../BaseToolbox/RasterVRT2ENVIdataDialog.ui | 126 ++++++++++++++++++ 7 files changed, 279 insertions(+), 2 deletions(-) create mode 100644 Toolbox/BaseToolbox/BaseToolbox/RasterVRT2ENVIdataDialog.cpp create mode 100644 Toolbox/BaseToolbox/BaseToolbox/RasterVRT2ENVIdataDialog.h create mode 100644 Toolbox/BaseToolbox/BaseToolbox/RasterVRT2ENVIdataDialog.ui diff --git a/Toolbox/BaseToolbox/BaseToolbox.cpp b/Toolbox/BaseToolbox/BaseToolbox.cpp index 1bad4fa..8d35a95 100644 --- a/Toolbox/BaseToolbox/BaseToolbox.cpp +++ b/Toolbox/BaseToolbox/BaseToolbox.cpp @@ -13,6 +13,7 @@ #include "QResampleRefrenceRaster.h" #include "QtLookTableCorrectOffsetDialog.h" #include "QtCreateGPSPointsDialog.h" +#include "RasterVRT2ENVIdataDialog.h" GF3ImportDataToolButton::GF3ImportDataToolButton(QWidget* parent) :QToolAbstract(parent) { @@ -115,6 +116,7 @@ void RegisterPreToolBox(LAMPMainWidget::RasterMainWidget* mainwindows, ToolBoxWi emit toolbox->addBoxToolItemSIGNAL(new QResampleRefrenceRasterToolButton(toolbox)); emit toolbox->addBoxToolItemSIGNAL(new QLookTableCorrectOffsetToolButton(toolbox)); emit toolbox->addBoxToolItemSIGNAL(new QCreateGPSPointsToolButton(toolbox)); + emit toolbox->addBoxToolItemSIGNAL(new RasterVRT2ENVIdataDialogToolButton(toolbox)); } QDEMResampleDialogToolButton::QDEMResampleDialogToolButton(QWidget* parent) @@ -215,4 +217,21 @@ void QCreateGPSPointsToolButton::excute() { QtCreateGPSPointsDialog* dialog = new QtCreateGPSPointsDialog; dialog->show(); -} \ No newline at end of file +} + +RasterVRT2ENVIdataDialogToolButton::RasterVRT2ENVIdataDialogToolButton(QWidget* parent) +{ + this->toolPath = QVector(0); + this->toolPath.push_back(u8"基础处理"); + this->toolname = QString(u8"vrt文件转换envi数据格式"); +} + +RasterVRT2ENVIdataDialogToolButton::~RasterVRT2ENVIdataDialogToolButton() +{ +} + +void RasterVRT2ENVIdataDialogToolButton::run() +{ + RasterVRT2ENVIdataDialog* dialog = new RasterVRT2ENVIdataDialog; + dialog->show(); +} diff --git a/Toolbox/BaseToolbox/BaseToolbox.h b/Toolbox/BaseToolbox/BaseToolbox.h index 5c15ea7..42a024b 100644 --- a/Toolbox/BaseToolbox/BaseToolbox.h +++ b/Toolbox/BaseToolbox/BaseToolbox.h @@ -10,6 +10,8 @@ namespace LAMPMainWidget { class ToolBoxWidget; +extern "C" BASETOOLBOX_EXPORT void RegisterPreToolBox(LAMPMainWidget::RasterMainWidget* mainwindows, ToolBoxWidget* toolbox); + class BASETOOLBOX_EXPORT GF3ImportDataToolButton : public QToolAbstract { Q_OBJECT public: @@ -132,4 +134,18 @@ public slots: }; -extern "C" BASETOOLBOX_EXPORT void RegisterPreToolBox(LAMPMainWidget::RasterMainWidget* mainwindows, ToolBoxWidget* toolbox); + + + + +class BASETOOLBOX_EXPORT RasterVRT2ENVIdataDialogToolButton : public QToolAbstract { + Q_OBJECT +public: + RasterVRT2ENVIdataDialogToolButton(QWidget* parent = nullptr); + ~RasterVRT2ENVIdataDialogToolButton(); +public : + virtual void run() override; + +}; + + diff --git a/Toolbox/BaseToolbox/BaseToolbox.vcxproj b/Toolbox/BaseToolbox/BaseToolbox.vcxproj index 5ec3f82..699771e 100644 --- a/Toolbox/BaseToolbox/BaseToolbox.vcxproj +++ b/Toolbox/BaseToolbox/BaseToolbox.vcxproj @@ -207,6 +207,7 @@ + @@ -225,6 +226,7 @@ + @@ -246,6 +248,7 @@ + diff --git a/Toolbox/BaseToolbox/BaseToolbox.vcxproj.filters b/Toolbox/BaseToolbox/BaseToolbox.vcxproj.filters index 03e37b6..0eb5ad3 100644 --- a/Toolbox/BaseToolbox/BaseToolbox.vcxproj.filters +++ b/Toolbox/BaseToolbox/BaseToolbox.vcxproj.filters @@ -106,6 +106,9 @@ BaseToolbox + + BaseToolbox + @@ -147,6 +150,9 @@ BaseToolbox + + BaseToolbox + @@ -185,5 +191,8 @@ BaseToolbox + + BaseToolbox + \ No newline at end of file diff --git a/Toolbox/BaseToolbox/BaseToolbox/RasterVRT2ENVIdataDialog.cpp b/Toolbox/BaseToolbox/BaseToolbox/RasterVRT2ENVIdataDialog.cpp new file mode 100644 index 0000000..42e2ed3 --- /dev/null +++ b/Toolbox/BaseToolbox/BaseToolbox/RasterVRT2ENVIdataDialog.cpp @@ -0,0 +1,78 @@ +#include "RasterVRT2ENVIdataDialog.h" +#include "ui_RasterVRT2ENVIdataDialog.h" +#include "BaseConstVariable.h" +#include "BaseTool.h" +#include "RasterToolBase.h" +#include "LogInfoCls.h" +#include +#include +#include "ImageNetOperator.h" +#include "ImageOperatorBase.h" + +RasterVRT2ENVIdataDialog::RasterVRT2ENVIdataDialog(QWidget *parent) + : QDialog(parent) + ,ui(new Ui::RasterVRT2ENVIdataDialogClass) +{ + ui->setupUi(this); + + connect(ui->pushButtonVRTSelect, SIGNAL(clicked()), this, SLOT(onpushButtonVRTSelect_clicked())); + connect(ui->pushButtonENVIDatSelect, SIGNAL(clicked()), this, SLOT(onpushButtonENVIDatSelect_clicked())); + connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(onbuttonBox_accepted())); + connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(onbuttonBox_rejected())); + +} + +RasterVRT2ENVIdataDialog::~RasterVRT2ENVIdataDialog() +{} + +void RasterVRT2ENVIdataDialog::onpushButtonVRTSelect_clicked() +{ + QString fileNames = QFileDialog::getOpenFileName( + this, // 父窗口 + tr(u8"选择L1B数据文件"), // 标题 + QString(), // 默认路径 + tr(ENVI_FILE_FORMAT_FILTER) // 文件过滤器 + ); + // 如果用户选择了文件 + if (!fileNames.isEmpty()) { + QString message = "选择的文件有:\n"; + this->ui->lineEditVRTPath->setText(fileNames); + } + else { + QMessageBox::information(this, tr(u8"没有选择文件"), tr(u8"没有选择任何文件。")); + } +} + +void RasterVRT2ENVIdataDialog::onpushButtonENVIDatSelect_clicked() +{ + QString fileNames = QFileDialog::getSaveFileName( + this, // 父窗口 + tr(u8"选择L1B数据文件"), // 标题 + QString(), // 默认路径 + tr(ENVI_FILE_FORMAT_FILTER) // 文件过滤器 + ); + // 如果用户选择了文件 + if (!fileNames.isEmpty()) { + QString message = "选择的文件有:\n"; + this->ui->lineEditENVIDatPath->setText(fileNames); + } + else { + QMessageBox::information(this, tr(u8"没有选择文件"), tr(u8"没有选择任何文件。")); + } +} + +void RasterVRT2ENVIdataDialog::onbuttonBox_accepted() +{ + QString vrtrasterpath = ui->lineEditVRTPath->text(); + QString envidatapath = ui->lineEditENVIDatPath->text(); + + ConvertVrtToEnvi(vrtrasterpath, envidatapath); + + + QMessageBox::information(this, tr(u8"提示"), tr(u8"完成")); +} + +void RasterVRT2ENVIdataDialog::onbuttonBox_rejected() +{ + this->close(); +} diff --git a/Toolbox/BaseToolbox/BaseToolbox/RasterVRT2ENVIdataDialog.h b/Toolbox/BaseToolbox/BaseToolbox/RasterVRT2ENVIdataDialog.h new file mode 100644 index 0000000..b4123c8 --- /dev/null +++ b/Toolbox/BaseToolbox/BaseToolbox/RasterVRT2ENVIdataDialog.h @@ -0,0 +1,26 @@ +#pragma once + +#include + +namespace Ui { + class RasterVRT2ENVIdataDialogClass; +} + + +class RasterVRT2ENVIdataDialog : public QDialog +{ + Q_OBJECT + +public: + RasterVRT2ENVIdataDialog(QWidget *parent = nullptr); + ~RasterVRT2ENVIdataDialog(); + + +public slots: + void onpushButtonVRTSelect_clicked(); + void onpushButtonENVIDatSelect_clicked(); + void onbuttonBox_accepted(); + void onbuttonBox_rejected(); +private: + Ui::RasterVRT2ENVIdataDialogClass* ui; +}; diff --git a/Toolbox/BaseToolbox/BaseToolbox/RasterVRT2ENVIdataDialog.ui b/Toolbox/BaseToolbox/BaseToolbox/RasterVRT2ENVIdataDialog.ui new file mode 100644 index 0000000..9e76517 --- /dev/null +++ b/Toolbox/BaseToolbox/BaseToolbox/RasterVRT2ENVIdataDialog.ui @@ -0,0 +1,126 @@ + + + RasterVRT2ENVIdataDialogClass + + + + 0 + 0 + 396 + 156 + + + + RasterVRT2ENVIdataDialog + + + + + + + 0 + 30 + + + + 閫夋嫨 + + + + + + + + 0 + 30 + + + + + + + + + + + + 0 + 30 + + + + + + + + + + + + 0 + 30 + + + + 閫夋嫨 + + + + + + + + 0 + 30 + + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + 0 + 30 + + + + vrt鏂囦欢鍦板潃锛 + + + + + + + + 0 + 30 + + + + 杈撳嚭dat鍦板潃锛 + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + From b799682817ba654eec647553beae33357933907a Mon Sep 17 00:00:00 2001 From: chenzenghui <3045316072@qq.com> Date: Thu, 10 Apr 2025 20:51:54 +0800 Subject: [PATCH 33/44] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dvrt=E8=BD=ACenvi=20data?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Toolbox/BaseToolbox/BaseToolbox/RasterVRT2ENVIdataDialog.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Toolbox/BaseToolbox/BaseToolbox/RasterVRT2ENVIdataDialog.cpp b/Toolbox/BaseToolbox/BaseToolbox/RasterVRT2ENVIdataDialog.cpp index 42e2ed3..85964ab 100644 --- a/Toolbox/BaseToolbox/BaseToolbox/RasterVRT2ENVIdataDialog.cpp +++ b/Toolbox/BaseToolbox/BaseToolbox/RasterVRT2ENVIdataDialog.cpp @@ -6,7 +6,6 @@ #include "LogInfoCls.h" #include #include -#include "ImageNetOperator.h" #include "ImageOperatorBase.h" RasterVRT2ENVIdataDialog::RasterVRT2ENVIdataDialog(QWidget *parent) @@ -47,7 +46,7 @@ void RasterVRT2ENVIdataDialog::onpushButtonENVIDatSelect_clicked() { QString fileNames = QFileDialog::getSaveFileName( this, // 父窗口 - tr(u8"选择L1B数据文件"), // 标题 + tr(u8"选择ENVIData数据文件"), // 标题 QString(), // 默认路径 tr(ENVI_FILE_FORMAT_FILTER) // 文件过滤器 ); From 115e11b56824f74bb51d3d79965f31b82c16abbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=A2=9E=E8=BE=89?= <3045316072@qq.com> Date: Thu, 10 Apr 2025 21:28:06 +0800 Subject: [PATCH 34/44] =?UTF-8?q?=E5=90=8C=E6=AD=A5=E7=95=8C=E9=9D=A2?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- RasterMainWidgetGUI/RasterMainWidget/RasterMainWidget.ui | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/RasterMainWidgetGUI/RasterMainWidget/RasterMainWidget.ui b/RasterMainWidgetGUI/RasterMainWidget/RasterMainWidget.ui index af85019..2a2bc0c 100644 --- a/RasterMainWidgetGUI/RasterMainWidget/RasterMainWidget.ui +++ b/RasterMainWidgetGUI/RasterMainWidget/RasterMainWidget.ui @@ -85,7 +85,7 @@ 0 0 906 - 23 + 22 @@ -117,6 +117,7 @@ 宸ュ叿 + @@ -513,6 +514,11 @@ p, li { white-space: pre-wrap; } 椋炴満 + + + 閲婃斁褰卞儚鏂囦欢 + + From 609e140bd912090f08876173acf698c0d3fb8fad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=A2=9E=E8=BE=89?= <3045316072@qq.com> Date: Fri, 11 Apr 2025 10:57:49 +0800 Subject: [PATCH 35/44] =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=BA=86=E6=98=BE?= =?UTF-8?q?=E5=AD=98=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SimulationSAR/BPBasic0_CUDA.cu | 13 ++++++------- .../SimulationSAR/TBPImageAlgCls.cpp | 4 ++-- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/Toolbox/SimulationSARTool/SimulationSAR/BPBasic0_CUDA.cu b/Toolbox/SimulationSARTool/SimulationSAR/BPBasic0_CUDA.cu index f88f3f7..46c7d37 100644 --- a/Toolbox/SimulationSARTool/SimulationSAR/BPBasic0_CUDA.cu +++ b/Toolbox/SimulationSARTool/SimulationSAR/BPBasic0_CUDA.cu @@ -65,16 +65,16 @@ __global__ void processPulseKernel( ) { // - long long idx = blockIdx.x * blockDim.x + threadIdx.x; - long long pixelcount = nx * ny; - if (idx >= pixelcount) return; + int64_t idx = int64_t(blockIdx.x) * int64_t(blockDim.x) + int64_t(threadIdx.x); + int64_t pixelcount = int64_t(nx) * int64_t(ny); + if (idx >= pixelcount) { return; } //printf("processPulseKernel start!!\n"); //if (x >= nx || y >= ny) return; //int idx = x * ny + y; - + double dx = AntX - x_mat[idx]; double dy = AntY - y_mat[idx]; double dz = AntZ - z_mat[idx]; @@ -169,13 +169,12 @@ void bpBasic0CUDA(GPUDATA& data, int flag,double* h_R) { printfinfo("fft finished!!\n"); // 图像重建 - double r_start = data.r_vec[0]; double dr = (data.r_vec[data.Nfft - 1] - r_start) / (data.Nfft - 1); printfinfo("dr = %f\n",dr); - long pixelcount = data.nx* data.ny; - long grid_size = (pixelcount + BLOCK_SIZE - 1) / BLOCK_SIZE; + int64_t pixelcount = int64_t(data.nx)* int64_t(data.ny); + int64_t grid_size = (pixelcount + BLOCK_SIZE - 1) / BLOCK_SIZE; printfinfo("grid finished!!\n"); //double* d_R = (double*)mallocCUDADevice(sizeof(double) * data.nx * data.ny); diff --git a/Toolbox/SimulationSARTool/SimulationSAR/TBPImageAlgCls.cpp b/Toolbox/SimulationSARTool/SimulationSAR/TBPImageAlgCls.cpp index 6d50619..235ad8c 100644 --- a/Toolbox/SimulationSARTool/SimulationSAR/TBPImageAlgCls.cpp +++ b/Toolbox/SimulationSARTool/SimulationSAR/TBPImageAlgCls.cpp @@ -119,7 +119,7 @@ ErrorCode TBPImageAlgCls::ProcessGPU() size_t img_rowCont = L1ds->getrowCount(); size_t img_colCont = L1ds->getcolCount(); - size_t block_imgRowCount = Memory1GB / img_colCont / 8 / 3 * 1;// 4GB-- 鍙互鍒嗛厤鍐呭瓨 + size_t block_imgRowCount = Memory1GB / img_colCont / 8 / 3 * 12;// 4GB-- 鍙互鍒嗛厤鍐呭瓨 gdalImage demgridimg(imgXYZPath); gdalImageComplex im_finalds(outimgDataPath); @@ -310,7 +310,7 @@ void TBPImageAlgCls::EchoFreqToTime() gdalImageComplex outTimeEchoImg = CreategdalImageComplexNoProj(this->TimeEchoDataPath, this->TimeEchoRowCount, this->TimeEchoColCount, 1); // 鍒嗗潡 - long echoBlockline = Memory1GB / 8 / 2 / outColCount * 3; //1GB + long echoBlockline = Memory1GB / 8 / 2 / outColCount *2; //1GB echoBlockline = echoBlockline < 1 ? 1 : echoBlockline; From 0a1497ac5e3e5bac2591a8575c6b41212b5d3d18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=A2=9E=E8=BE=89?= <3045316072@qq.com> Date: Fri, 11 Apr 2025 11:29:12 +0800 Subject: [PATCH 36/44] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=85=B3=E9=97=AD=E6=96=87=E4=BB=B6=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BaseCommonLibrary/BaseTool/ImageOperatorBase.h | 2 +- BaseCommonLibrary/ImageOperatorFuntion.cpp | 6 ++++++ .../RasterMainWidget/RasterMainWidget.cpp | 9 +++++++-- RasterMainWidgetGUI/RasterMainWidget/RasterMainWidget.h | 2 +- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/BaseCommonLibrary/BaseTool/ImageOperatorBase.h b/BaseCommonLibrary/BaseTool/ImageOperatorBase.h index 2f52328..633dd9e 100644 --- a/BaseCommonLibrary/BaseTool/ImageOperatorBase.h +++ b/BaseCommonLibrary/BaseTool/ImageOperatorBase.h @@ -328,7 +328,7 @@ ErrorCode BASECONSTVARIABLEAPI Complex2AmpRaster(QString inComplexPath, QString ErrorCode BASECONSTVARIABLEAPI ResampleDEM(QString indemPath, QString outdemPath, double gridx, double gridy); - +void BASECONSTVARIABLEAPI CloseAllGDALRaster(); diff --git a/BaseCommonLibrary/ImageOperatorFuntion.cpp b/BaseCommonLibrary/ImageOperatorFuntion.cpp index 6313329..2397a00 100644 --- a/BaseCommonLibrary/ImageOperatorFuntion.cpp +++ b/BaseCommonLibrary/ImageOperatorFuntion.cpp @@ -1665,6 +1665,12 @@ ErrorCode ResampleDEM(QString indemPath, QString outdemPath, double gridx, doubl } } +void BASECONSTVARIABLEAPI CloseAllGDALRaster() +{ + GDALDestroyDriverManager(); + return ; +} + ErrorCode Complex2AmpRaster(QString inComplexPath, QString outRasterPath) diff --git a/RasterMainWidgetGUI/RasterMainWidget/RasterMainWidget.cpp b/RasterMainWidgetGUI/RasterMainWidget/RasterMainWidget.cpp index eb4f02a..d985f06 100644 --- a/RasterMainWidgetGUI/RasterMainWidget/RasterMainWidget.cpp +++ b/RasterMainWidgetGUI/RasterMainWidget/RasterMainWidget.cpp @@ -14,7 +14,7 @@ #include "FileOperator.h" #include "RasterWidgetMessageShow.h" - +#include "ImageOperatorBase.h" #pragma execution_character_set("utf-8") @@ -59,7 +59,7 @@ RasterMainWidget::RasterMainWidget(QWidget *parent) //mUi->layerList->setCurrentItem(mLayerList.first()); - + connect(mUi->actioncloseAllRasterFile, SIGNAL(triggered()), this, SLOT(onactioncloseAllRasterFile_triggered())); } @@ -341,6 +341,11 @@ void RasterMainWidget::on_addPlaneaction_triggered() mMapConvas->selectTool("addplane_tool"); } +void RasterMainWidget::onactioncloseAllRasterFile_triggered() +{ + CloseAllGDALRaster(); +} + QTableWidget* RasterMainWidget::getTaskTable() { return this->mUi->taskTable; diff --git a/RasterMainWidgetGUI/RasterMainWidget/RasterMainWidget.h b/RasterMainWidgetGUI/RasterMainWidget/RasterMainWidget.h index a64eb49..f4f3316 100644 --- a/RasterMainWidgetGUI/RasterMainWidget/RasterMainWidget.h +++ b/RasterMainWidgetGUI/RasterMainWidget/RasterMainWidget.h @@ -77,7 +77,7 @@ namespace LAMPMainWidget { private slots: void on_drawArea_triggered(); void on_addPlaneaction_triggered(); - + void onactioncloseAllRasterFile_triggered(); private: Ui::RasterMainWidget* mUi; MapCanvas* mMapConvas; From e3bcfe3e9825117ea7cd70b6fb88f5db3a57f9a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=A2=9E=E8=BE=89?= <3045316072@qq.com> Date: Fri, 11 Apr 2025 17:39:55 +0800 Subject: [PATCH 37/44] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=87=87=E6=A0=B7?= =?UTF-8?q?=E5=B7=A5=E5=85=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SARImage/ImageNetOperator.cpp | 82 +++++++++++++++++++ .../SARImage/ImageNetOperator.h | 4 +- .../QSARSimulationComplexEchoDataDialog.cpp | 32 +++++++- .../QSARSimulationComplexEchoDataDialog.ui | 4 +- 4 files changed, 115 insertions(+), 7 deletions(-) diff --git a/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.cpp b/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.cpp index 334bc9c..cd5078d 100644 --- a/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.cpp +++ b/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.cpp @@ -906,6 +906,88 @@ int ResampleEChoDataFromGeoEcho(QString L2echodataPath, QString RangeLooktablePa } +int ResampleRangeDataFromGeoImage(QString geodataPath, QString RangeLooktablePath, QString RangeDataPath) +{ + gdalImage echodata(geodataPath); + gdalImage looktable(RangeLooktablePath); + gdalImage l1adata(RangeDataPath); + Eigen::MatrixXd echoArr = echodata.getData(0, 0, echodata.height, echodata.width, 1); + + long blockHeight = Memory1GB / looktable.width / 8 * 2; + + for (long startRow = 0; startRow < looktable.height; startRow = startRow + blockHeight) { + printf("\rGEC: process:%f precent\t\t\t", startRow * 100.0 / looktable.height); + blockHeight = blockHeight + startRow < looktable.height ? blockHeight : looktable.height - startRow; + Eigen::MatrixXd imglonArr = looktable.getData(startRow, 0, blockHeight, looktable.width, 1); + Eigen::MatrixXd imglatArr = looktable.getData(startRow, 0, blockHeight, looktable.width, 2); + Eigen::MatrixXd l1aArr = l1adata.getData(0, 0, blockHeight, l1adata.width, 1); + l1aArr = l1aArr.array() * 0; + + long imgheight = blockHeight; + long imgwidth = looktable.width; +#pragma omp parallel for + for (long i = 0; i < imgheight; i++) { + + for (long j = 0; j < imgwidth; j++) { + double lon = imglonArr(i, j); + double lat = imglatArr(i, j); + Landpoint point = echodata.getRow_Col(lon, lat); + + if (point.lon<1 || point.lon>echodata.width - 2 || point.lat < 1 || point.lat >echodata.height - 2) { + continue; + } + else {} + { + Landpoint p0, p11, p21, p12, p22; + + p0.lon = point.lon; + p0.lat = point.lat; + + p11.lon = floor(p0.lon); + p11.lat = floor(p0.lat); + p11.ati = echoArr(long(p11.lat), long(p11.lon)); + + p12.lon = ceil(p0.lon); + p12.lat = floor(p0.lat); + p12.ati = echoArr(long(p12.lat), long(p12.lon)); + + p21.lon = floor(p0.lon); + p21.lat = ceil(p0.lat); + p21.ati = echoArr(long(p21.lat), long(p21.lon)); + + p22.lon = ceil(p0.lon); + p22.lat = ceil(p0.lat); + p22.ati = echoArr(long(p22.lat), long(p22.lon)); + + p0.lon = p0.lon - p11.lon; + p0.lat = p0.lat - p11.lat; + + p12.lon = p12.lon - p11.lon; + p12.lat = p12.lat - p11.lat; + + p21.lon = p21.lon - p11.lon; + p21.lat = p21.lat - p11.lat; + + p22.lon = p22.lon - p11.lon; + p22.lat = p22.lat - p11.lat; + + p11.lon = p11.lon - p11.lon; + p11.lat = p11.lat - p11.lat; + + p0.ati = Bilinear_interpolation(p0, p11, p21, p12, p22); + l1aArr(i, j)=p0.ati; + } + } + } + + l1adata.saveImage(l1aArr, startRow, 0, 1); + } + + + + return 0; +} + void InterpLookTableRfromDEM(QString lonlatPath, QString DEMPath, QString outllrpath) { gdalImage LLimg(lonlatPath); diff --git a/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.h b/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.h index bf329ae..59f5920 100644 --- a/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.h +++ b/Toolbox/SimulationSARTool/SARImage/ImageNetOperator.h @@ -15,7 +15,9 @@ void InterploateClipAtiByRefDEM(QString ImageLLPath, QString& ImageDEMPath, QStr void InterploateAtiByRefDEM(QString& ImageLLPath, QString& ImageDEMPath, QString& outImageLLAPath, QString& InEchoGPSDataPath); int ReflectTable_WGS2Range(QString dem_rc_path, QString outOriSimTiffPath, QString ori_sim_count_tiffPath, long OriHeight, long OriWidth); -int ResampleEChoDataFromGeoEcho(QString L2echodataPath, QString RangeLooktablePath, QString L1AEchoDataPath); +int ResampleEChoDataFromGeoEcho(QString L2complexechodataPath, QString RangeLooktablePath, QString L1AEchoDataPath); + +int ResampleRangeDataFromGeoImage(QString geodataPath, QString RangeLooktablePath, QString RangeDataPath); void InterpLookTableRfromDEM(QString lonlatPath, QString DEMPath, QString outllrpath); diff --git a/Toolbox/SimulationSARTool/SARImage/QSARSimulationComplexEchoDataDialog.cpp b/Toolbox/SimulationSARTool/SARImage/QSARSimulationComplexEchoDataDialog.cpp index 39648cb..5082835 100644 --- a/Toolbox/SimulationSARTool/SARImage/QSARSimulationComplexEchoDataDialog.cpp +++ b/Toolbox/SimulationSARTool/SARImage/QSARSimulationComplexEchoDataDialog.cpp @@ -6,6 +6,8 @@ #include "BaseTool.h" #include "ImageNetOperator.h" #include +#include "FileOperator.h" +#include "ImageOperatorBase.h" QSARSimulationComplexEchoDataDialog::QSARSimulationComplexEchoDataDialog(QWidget *parent) @@ -33,7 +35,7 @@ void QSARSimulationComplexEchoDataDialog::onpushButtonEchoDataSelect_clicked() { QString fileNames = QFileDialog::getOpenFileName( this, // 父窗口 - tr(u8"选择L1A回波数据文件"), // 标题 + tr(u8"选择地距数据文件"), // 标题 QString(), // 默认路径 tr(ENVI_FILE_FORMAT_FILTER) // 文件过滤器 ); @@ -69,7 +71,7 @@ void QSARSimulationComplexEchoDataDialog::onpushButtonL1AEchoDataSelect_clicked( { QString fileNames = QFileDialog::getSaveFileName( this, // 父窗口 - tr(u8"选择L1A回波数据文件"), // 标题 + tr(u8"选择斜距数据文件"), // 标题 QString(), // 默认路径 tr(ENVI_FILE_FORMAT_FILTER) // 文件过滤器 ); @@ -89,9 +91,31 @@ void QSARSimulationComplexEchoDataDialog::onbuttonBox_accepted() QString RangelookTablePath = this->ui->lineEditLookTablePath->text().trimmed(); QString l1AEchoDataPath = this->ui->lineEditL1AEchoDataPath->text().trimmed(); + if (isExists(echoDataPath) && isExists(RangelookTablePath)) { + gdalImage echoData(echoDataPath); + gdalImage RangelookTable(RangelookTablePath); + if (echoData.getDataType() == GDT_CFloat32 + ||echoData.getDataType()==GDT_CFloat64 + || echoData.getDataType() == GDT_CInt16 + || echoData.getDataType()==GDT_CInt32 + ) { - ResampleEChoDataFromGeoEcho(echoDataPath, RangelookTablePath, l1AEchoDataPath); - QMessageBox::information(this, tr(u8"提示"), tr(u8"没有选择任何文件。")); + CreategdalImageComplex(l1AEchoDataPath, RangelookTable.height, RangelookTable.width,1, RangelookTable.gt, RangelookTable.projection, true, true); + + + ResampleEChoDataFromGeoEcho(echoDataPath, RangelookTablePath, l1AEchoDataPath); + } + else { + CreategdalImage(l1AEchoDataPath, RangelookTable.height, RangelookTable.width, 1, RangelookTable.gt, RangelookTable.projection, true, true); + ResampleRangeDataFromGeoImage(echoDataPath, RangelookTablePath, l1AEchoDataPath); + } + + QMessageBox::information(this, tr(u8"提示"), tr(u8"完成")); + } + else { + QMessageBox::information(this, tr(u8"提示"), tr(u8"没有选择任何文件。")); + } + } void QSARSimulationComplexEchoDataDialog::onbuttonBox_rejected() diff --git a/Toolbox/SimulationSARTool/SARImage/QSARSimulationComplexEchoDataDialog.ui b/Toolbox/SimulationSARTool/SARImage/QSARSimulationComplexEchoDataDialog.ui index ceed9c6..6e3e09b 100644 --- a/Toolbox/SimulationSARTool/SARImage/QSARSimulationComplexEchoDataDialog.ui +++ b/Toolbox/SimulationSARTool/SARImage/QSARSimulationComplexEchoDataDialog.ui @@ -23,7 +23,7 @@ - 鎴愬儚鏂囦欢锛 + 鍦拌窛鏂囦欢锛 @@ -98,7 +98,7 @@ - L1A鍥炴尝锛 + 鏂滆窛鏂囦欢锛 From 9fd7bab1f364998cd50d82b733ba7b35196e60e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=A2=9E=E8=BE=89?= <3045316072@qq.com> Date: Mon, 14 Apr 2025 17:54:55 +0800 Subject: [PATCH 38/44] =?UTF-8?q?=E4=BF=AE=E8=A1=A5bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BaseTool/gdalImageComplexOperator.cpp | 3 ++- BaseCommonLibrary/ImageOperatorFuntion.cpp | 8 +++----- .../SARImage/QL1ASARProcessDialog.cpp | 12 +++++------ .../SimulationSAR/BPBasic0_CUDA.cu | 4 ++-- .../SimulationSAR/GPURFPC.cu | 7 +------ .../SimulationSAR/RFPCProcessCls.cpp | 20 +++++++++++++++++-- 6 files changed, 32 insertions(+), 22 deletions(-) diff --git a/BaseCommonLibrary/BaseTool/gdalImageComplexOperator.cpp b/BaseCommonLibrary/BaseTool/gdalImageComplexOperator.cpp index 6676b66..7d0df86 100644 --- a/BaseCommonLibrary/BaseTool/gdalImageComplexOperator.cpp +++ b/BaseCommonLibrary/BaseTool/gdalImageComplexOperator.cpp @@ -293,7 +293,8 @@ Eigen::MatrixXcd gdalImageComplex::getDataComplex(int start_row, int start_col, // 获取数据集的第一个波段 GDALRasterBand* poBand; poBand = poDataset->GetRasterBand(1); - + rows_count = start_row + rows_count <= this->height ? rows_count : this->height - start_row; + cols_count = start_col + cols_count <= this->width ? cols_count : this->width - start_col; // 读取波段信息,假设是复数类型 int nXSize = cols_count; poBand->GetXSize(); int nYSize = rows_count; poBand->GetYSize(); diff --git a/BaseCommonLibrary/ImageOperatorFuntion.cpp b/BaseCommonLibrary/ImageOperatorFuntion.cpp index 2397a00..5154807 100644 --- a/BaseCommonLibrary/ImageOperatorFuntion.cpp +++ b/BaseCommonLibrary/ImageOperatorFuntion.cpp @@ -1680,18 +1680,16 @@ ErrorCode Complex2AmpRaster(QString inComplexPath, QString outRasterPath) long blocklines = Memory1GB * 2 / 8 / inimg.width; blocklines = blocklines < 100 ? 100 : blocklines; - Eigen::MatrixXd imgArrb1 = Eigen::MatrixXd::Zero(blocklines, ampimg.width); - Eigen::MatrixXcd imgArr = Eigen::MatrixXcd::Zero(blocklines, inimg.width); long startrow = 0; 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); + Eigen::MatrixXd imgArrb1 = ampimg.getData(startrow, 0, blocklines, inimg.width, 1); + Eigen::MatrixXcd imgArr = inimg.getDataComplex(startrow, 0, blocklines, inimg.width, 1); imgArrb1 = imgArr.array().abs(); ampimg.saveImage(imgArrb1, startrow, 0, 1); } - qDebug() << "褰卞儚鍐欏叆鍒帮細" << outRasterPath; + qDebug() << u8"褰卞儚鍐欏叆鍒帮細" << outRasterPath; return ErrorCode::SUCCESS; } diff --git a/Toolbox/SimulationSARTool/SARImage/QL1ASARProcessDialog.cpp b/Toolbox/SimulationSARTool/SARImage/QL1ASARProcessDialog.cpp index 09b37cd..88338e9 100644 --- a/Toolbox/SimulationSARTool/SARImage/QL1ASARProcessDialog.cpp +++ b/Toolbox/SimulationSARTool/SARImage/QL1ASARProcessDialog.cpp @@ -45,8 +45,8 @@ void QL1ASARProcessDialog::onpushButtonL1BSelect_clicked() ); // 如果用户选择了文件 if (!fileNames.isEmpty()) { - QString message = "选择的文件有:\n"; - this->ui->lineEditL1ADataPath->setText(fileNames); + QString message = u8"选择的文件有:\n"; + this->ui->lineEditL1BDataPath->setText(fileNames); } else { QMessageBox::information(this, tr(u8"没有选择文件"), tr(u8"没有选择任何文件。")); @@ -64,7 +64,7 @@ void QL1ASARProcessDialog::onpushButtonL1ASelect_clicked() ); // 如果用户选择了文件 if (!fileNames.isEmpty()) { - QString message = "选择的文件有:\n"; + QString message = u8"选择的文件有:\n"; this->ui->lineEditL1ADataPath->setText(fileNames); } else { @@ -82,7 +82,7 @@ void QL1ASARProcessDialog::onpushButtonS1ASelect_clicked() ); // 如果用户选择了文件 if (!fileNames.isEmpty()) { - QString message = "选择的文件有:\n"; + QString message = u8"选择的文件有:\n"; this->ui->lineSlAPath->setText(fileNames); } else { @@ -99,10 +99,10 @@ void QL1ASARProcessDialog::onbuttonBox_accepted() long nlaz = ui->spinBoxLNAz->value(); long nlra = ui->spinBoxLNRa->value(); - qDebug() << "单视斜距复数产品 转 单视斜距幅度产品"; + qDebug() << u8"单视斜距复数产品 转 单视斜距幅度产品"; Complex2AmpRaster(l1arasterpath, s1arasterpath); - qDebug() << "单视斜距幅度产品 转 多视斜距幅度产品"; + qDebug() << u8"单视斜距幅度产品 转 多视斜距幅度产品"; MultiLookRaster(s1arasterpath, l1brasterpath, nlaz, nlra); QMessageBox::information(this, tr(u8"提示"), tr(u8"多视处理完成")); diff --git a/Toolbox/SimulationSARTool/SimulationSAR/BPBasic0_CUDA.cu b/Toolbox/SimulationSARTool/SimulationSAR/BPBasic0_CUDA.cu index 46c7d37..045ebbd 100644 --- a/Toolbox/SimulationSARTool/SimulationSAR/BPBasic0_CUDA.cu +++ b/Toolbox/SimulationSARTool/SimulationSAR/BPBasic0_CUDA.cu @@ -109,8 +109,8 @@ __global__ void processPulseKernel( phCorr.y = rc_interp.x * sin_phase + rc_interp.y * cos_phase; // amp correction - phCorr.x = ampcorrect * phCorr.x; - phCorr.y = ampcorrect * phCorr.y; + //phCorr.x = ampcorrect * phCorr.x; + //phCorr.y = ampcorrect * phCorr.y; // Accumulate im_final[idx].x += phCorr.x; diff --git a/Toolbox/SimulationSARTool/SimulationSAR/GPURFPC.cu b/Toolbox/SimulationSARTool/SimulationSAR/GPURFPC.cu index afd43d1..aa33c8a 100644 --- a/Toolbox/SimulationSARTool/SimulationSAR/GPURFPC.cu +++ b/Toolbox/SimulationSARTool/SimulationSAR/GPURFPC.cu @@ -700,15 +700,10 @@ extern "C" void ProcessRFPCTask(RFPCTask& task, long devid, float* h_R, float* h ); PrintLasterError("CUDA_Kernel_Computer_echo"); cudaDeviceSynchronize(); - if ((sTi * 100.0 / task.targetnum) - process >= 10) { + if ((sTi * 100.0 / task.targetnum) - process >= 1) { process = sTi * 100.0 / task.targetnum; PRINT("device ID : %d , TargetID [%f]: %d / %d finished %d\n", devid, sTi * 100.0 / task.targetnum, sTi, task.targetnum, devid); } - - - - - } diff --git a/Toolbox/SimulationSARTool/SimulationSAR/RFPCProcessCls.cpp b/Toolbox/SimulationSARTool/SimulationSAR/RFPCProcessCls.cpp index 160d4b1..e8ae0b6 100644 --- a/Toolbox/SimulationSARTool/SimulationSAR/RFPCProcessCls.cpp +++ b/Toolbox/SimulationSARTool/SimulationSAR/RFPCProcessCls.cpp @@ -929,6 +929,8 @@ ErrorCode RFPCProcessCls::RFPCMainProcess_GPU() { ErrorCode RFPCProcessCls::RFPCMainProcess_MultiGPU_NoAntPattern() { + + int num_devices = 0; cudaGetDeviceCount(&num_devices); PRINT("GPU Count : %d \n", num_devices); @@ -943,7 +945,11 @@ ErrorCode RFPCProcessCls::RFPCMainProcess_MultiGPU_NoAntPattern() std::shared_ptr sateOirbtNodes = this->getSatelliteOribtNodes(prf_time, dt, antflag, imageStarttime); - + for (int devid = 0; devid < num_devices; devid++) { + printf("GPU ID: %d \n", devid); + printDeviceInfo(devid); + printf("----------------------------------------\n"); + } #pragma omp parallel for for (int devid = 0; devid < num_devices; devid++) { @@ -969,6 +975,16 @@ ErrorCode RFPCProcessCls::RFPCMainProcess_GPU_NoAntPattern(size_t startprfid, si std::map clssigmaParamsDict = this->SigmaDatabasePtr->getsigmaParams(polartype);; std::map clsCUDASigmaParamsDict; for (const auto& pair : clssigmaParamsDict) { + + if (abs(pair.second.p1)<1e-5&& + abs(pair.second.p2) < 1e-5 && + abs(pair.second.p3) < 1e-5 && + abs(pair.second.p4) < 1e-5 && + abs(pair.second.p5) < 1e-5 && + abs(pair.second.p6) < 1e-5) { + continue; + } + clsCUDASigmaParamsDict.insert(std::pair(pair.first, CUDASigmaParam{ float(pair.second.p1), @@ -994,7 +1010,7 @@ ErrorCode RFPCProcessCls::RFPCMainProcess_GPU_NoAntPattern(size_t startprfid, si gdalImage demlandcls(this->LandCoverPath);// 鍦拌〃瑕嗙洊绫诲瀷 gdalImage slpxyz(this->demsloperPath);// 鍦伴潰鍧″悜 - long allDemRow = Memory1MB/demxyz.width/8/3*6000; + long allDemRow = Memory1GB/demxyz.width/8/3*6; //allDemRow = allDemRow < demxyz.height ? allDemRow : demxyz.height; for(long demId=0;demId< demxyz.height;demId=demId+ allDemRow){ From d2ee22b0f196c47616df64a48f6d856647cdee3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=A2=9E=E8=BE=89?= <3045316072@qq.com> Date: Fri, 18 Apr 2025 03:30:28 +0800 Subject: [PATCH 39/44] =?UTF-8?q?=E4=BF=AE=E8=A1=A5=E9=AB=98=E5=88=86?= =?UTF-8?q?=E4=B8=89=E5=8F=B7=E6=96=87=E4=BB=B6=E8=AF=BB=E5=86=99=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BaseCommonLibrary/BaseTool/BaseTool.cpp | 73 +++++- BaseCommonLibrary/BaseTool/BaseTool.h | 18 +- BaseCommonLibrary/BaseTool/FileOperator.cpp | 3 +- BaseCommonLibrary/BaseTool/GeoOperator.cpp | 54 ++++- BaseCommonLibrary/BaseTool/GeoOperator.h | 20 ++ .../BaseTool/ImageOperatorBase.h | 2 +- .../BaseTool/SARSimulationImageL1.cpp | 110 ++++----- .../BaseTool/gdalImageOperator.cpp | 9 + BaseCommonLibrary/ImageOperatorFuntion.cpp | 10 +- .../GF3CalibrationAndGeocodingClass.cpp | 79 +++++-- .../BaseToolbox/BaseToolbox/GF3PSTNClass.cpp | 2 +- .../BaseToolbox/QComplex2AmpPhase.cpp | 11 +- .../BaseToolbox/QImportGF3StripL1ADataset.cpp | 7 +- .../BaseToolbox/QRDOrthProcessClass.cpp | 4 +- .../BaseToolbox/SatelliteGF3xmlParser.cpp | 217 ++++++++++-------- 15 files changed, 428 insertions(+), 191 deletions(-) diff --git a/BaseCommonLibrary/BaseTool/BaseTool.cpp b/BaseCommonLibrary/BaseTool/BaseTool.cpp index 64d6252..5ea4ed0 100644 --- a/BaseCommonLibrary/BaseTool/BaseTool.cpp +++ b/BaseCommonLibrary/BaseTool/BaseTool.cpp @@ -38,7 +38,10 @@ #include // 鍖呭惈SSE鎸囦护闆嗗ご鏂囦欢 #include // 鍖呭惈SSE2鎸囦护闆嗗ご鏂囦欢 #include // 鍖呭惈OpenMP澶存枃浠 - +#include +#include +#include +#include QString longDoubleToQStringScientific(long double value) { std::ostringstream stream; @@ -702,3 +705,71 @@ Eigen::MatrixXd BASECONSTVARIABLEAPI dB2Amp(Eigen::MatrixXd& sigma0) } + +QDateTime parseCustomDateTime(const QString& dateTimeStr) { + // 鎵嬪姩瑙f瀽鏃ユ湡鏃堕棿瀛楃涓 + int year = dateTimeStr.left(4).toInt(); + int month = dateTimeStr.mid(5, 2).toInt(); + int day = dateTimeStr.mid(8, 2).toInt(); + int hour = dateTimeStr.mid(11, 2).toInt(); + int minute = dateTimeStr.mid(14, 2).toInt(); + int second = dateTimeStr.mid(17, 2).toInt(); + int msec = dateTimeStr.mid(20, 6).toInt(); // 鍙彇姣鐨勫墠涓変綅锛屽洜涓篞DateTime鏀寔鍒版绉 + + // 鍒涘缓 QDate 鍜 QTime 瀵硅薄 + QDate date(year, month, day); + QTime time(hour, minute, second, msec ); // 杞崲涓哄井绉掞紝浣哘Time鍙敮鎸佹绉掔簿搴 + + // 鏋勯 QDateTime 瀵硅薄 + QDateTime result(date, time); + + return result; +} + + +bool isLeapYear(int year) { + return (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)); +} + +int daysInMonth(int year, int month) { + if (month == 2) return isLeapYear(year) ? 29 : 28; + else if (month == 4 || month == 6 || month == 9 || month == 11) return 30; + else return 31; +} + + +TimestampMicroseconds parseAndConvert( std::string dateTimeStr) { + // 瑙f瀽骞淬佹湀銆佹棩銆佹椂銆佸垎銆佺鍜屽井绉 + int year = std::stoi(dateTimeStr.substr(0, 4)); + int month = std::stoi(dateTimeStr.substr(5, 2)); + int day = std::stoi(dateTimeStr.substr(8, 2)); + int hour = std::stoi(dateTimeStr.substr(11, 2)); + int minute = std::stoi(dateTimeStr.substr(14, 2)); + int second = std::stoi(dateTimeStr.substr(17, 2)); + int microsec = std::stoi(dateTimeStr.substr(20, 6)); + + // 璁$畻浠1970骞磋嚦鐩爣骞翠唤鍓嶄竴骞寸殑鎬诲ぉ鏁 + long long totalDays = 0; + for (int y = 1970; y < year; ++y) { + totalDays += isLeapYear(y) ? 366 : 365; + } + + // 鍔犱笂鐩爣骞翠唤浠1鏈堝埌涓婁竴涓湀鐨勫ぉ鏁 + for (int m = 1; m < month; ++m) { + totalDays += daysInMonth(year, m); + } + + // 鍔犱笂鏈湀鐨勫ぉ鏁 + totalDays += day - 1; + + // 杞崲涓烘荤鏁帮紝鍐嶅姞涓婂皬鏃躲佸垎閽熴佺 + long long totalSeconds = totalDays * 24 * 60 * 60 + hour * 60 * 60 + minute * 60 + second; + + // 杞崲涓烘绉掑拰寰 + long long msecsSinceEpoch = totalSeconds * 1000 + microsec / 1000; + int microseconds = microsec % 1000; + + return { msecsSinceEpoch, microseconds }; +} + + diff --git a/BaseCommonLibrary/BaseTool/BaseTool.h b/BaseCommonLibrary/BaseTool/BaseTool.h index 9bc6296..6ad57ff 100644 --- a/BaseCommonLibrary/BaseTool/BaseTool.h +++ b/BaseCommonLibrary/BaseTool/BaseTool.h @@ -31,7 +31,8 @@ #include #include #include - +#include +#include ///////////////////////////////////// 鍩虹鏁板鍑芥暟 ///////////////////////////////////////////////////////////// @@ -101,7 +102,7 @@ Eigen::Matrix3d BASECONSTVARIABLEAPI rotationMatrix(const Eigen::Vector3d& axis long double BASECONSTVARIABLEAPI convertToMilliseconds(const std::string& dateTimeStr); - +QDateTime BASECONSTVARIABLEAPI parseCustomDateTime(const QString& dateTimeStr); /// /// list 搴旇鏄寜鐓т粠灏忓埌澶х殑椤哄簭鎺掑ソ /// @@ -132,6 +133,19 @@ void initializeMatrixWithSSE2(Eigen::MatrixXf& mat, const float* data, long rowc Eigen::MatrixXd BASECONSTVARIABLEAPI MuhlemanSigmaArray(Eigen::MatrixXd& eta_deg); Eigen::MatrixXd BASECONSTVARIABLEAPI dB2Amp(Eigen::MatrixXd& sigma0); + +struct TimestampMicroseconds { + boost::int64_t msecsSinceEpoch; // 鑷1970-01-01T00:00:00 UTC浠ユ潵鐨勬绉掓暟 + int microseconds; // 棰濆鐨勫井绉掞紙绮剧‘鍒板井绉掞級 +}; + + +bool BASECONSTVARIABLEAPI isLeapYear(int year); +int BASECONSTVARIABLEAPI daysInMonth(int year, int month); + +TimestampMicroseconds BASECONSTVARIABLEAPI parseAndConvert( std::string dateTimeStr); + + /** 妯℃澘鍑芥暟绫 ***********************************************************************************************************/ inline double calculate_MuhlemanSigma(double eta_deg) { diff --git a/BaseCommonLibrary/BaseTool/FileOperator.cpp b/BaseCommonLibrary/BaseTool/FileOperator.cpp index d2b1343..6d6ba6c 100644 --- a/BaseCommonLibrary/BaseTool/FileOperator.cpp +++ b/BaseCommonLibrary/BaseTool/FileOperator.cpp @@ -93,7 +93,8 @@ QString getFileNameFromPath(const QString& path) QString getFileNameWidthoutExtend(QString path) { QFileInfo fileInfo(path); - QString fileNameWithoutExtension = fileInfo.baseName(); // 鑾峰彇鏃犲悗缂鏂囦欢鍚 + QString fileNameWithoutExtension = fileInfo.completeBaseName(); // 鑾峰彇鏃犲悗缂鏂囦欢鍚 + qDebug() << u8"File name without extension: " << fileNameWithoutExtension; return fileNameWithoutExtension; } diff --git a/BaseCommonLibrary/BaseTool/GeoOperator.cpp b/BaseCommonLibrary/BaseTool/GeoOperator.cpp index 5a1d12a..ce49a3e 100644 --- a/BaseCommonLibrary/BaseTool/GeoOperator.cpp +++ b/BaseCommonLibrary/BaseTool/GeoOperator.cpp @@ -18,7 +18,9 @@ #include #include #include "GeoOperator.h" - +#include // OGRSpatialReference 用于空间参考转换 +#include // 用于 GDALWarp 操作 +#include Landpoint operator +(const Landpoint& p1, const Landpoint& p2) @@ -446,3 +448,53 @@ double getlocalIncAngle(Vector3D& satepoint, Vector3D& landpoint, Vector3D& slop return angle; } } + +bool BASECONSTVARIABLEAPI ConvertResolutionToDegrees(int sourceEPSG, double resolutionMeters, double refLon, double refLat, double& degreePerPixelX, double& degreePerPixelY){ + // 初始化源坐标系(平面投影)和目标坐标系(WGS84 经纬度) + OGRSpatialReference sourceSRS, targetSRS; + sourceSRS.importFromEPSG(sourceEPSG); // 源坐标系需明确 EPSG + targetSRS.importFromEPSG(4326); // 目标为 WGS84 经纬度 + + // 创建坐标转换器:经纬度 -> 平面坐标 + OGRCoordinateTransformation* toPlane = OGRCreateCoordinateTransformation(&targetSRS, &sourceSRS); + if (!toPlane) return false; + + // 将参考点经纬度转换为平面坐标 + double x = refLon, y = refLat; + if (!toPlane->Transform(1, &x, &y)) { + OGRCoordinateTransformation::DestroyCT(toPlane); + return false; + } + + // 创建坐标转换器:平面坐标 -> 经纬度 + OGRCoordinateTransformation* toGeo = OGRCreateCoordinateTransformation(&sourceSRS, &targetSRS); + if (!toGeo) { + OGRCoordinateTransformation::DestroyCT(toPlane); + return false; + } + + // 计算东向分辨率(经度变化量) + double eastX = x + resolutionMeters, eastY = y; + double eastLon = eastX, eastLat = eastY; + if (!toGeo->Transform(1, &eastLon, &eastLat)) { + OGRCoordinateTransformation::DestroyCT(toPlane); + OGRCoordinateTransformation::DestroyCT(toGeo); + return false; + } + degreePerPixelX = (eastLon - refLon) / resolutionMeters; // 经度方向每米对应度数 + + // 计算北向分辨率(纬度变化量) + double northX = x, northY = y + resolutionMeters; + double northLon = northX, northLat = northY; + if (!toGeo->Transform(1, &northLon, &northLat)) { + OGRCoordinateTransformation::DestroyCT(toPlane); + OGRCoordinateTransformation::DestroyCT(toGeo); + return false; + } + degreePerPixelY = (northLat - refLat) / resolutionMeters; // 纬度方向每米对应度数 + + // 释放资源 + OGRCoordinateTransformation::DestroyCT(toPlane); + OGRCoordinateTransformation::DestroyCT(toGeo); + return true; +} diff --git a/BaseCommonLibrary/BaseTool/GeoOperator.h b/BaseCommonLibrary/BaseTool/GeoOperator.h index a2c42cc..66ce525 100644 --- a/BaseCommonLibrary/BaseTool/GeoOperator.h +++ b/BaseCommonLibrary/BaseTool/GeoOperator.h @@ -124,4 +124,24 @@ CartesianCoordinates BASECONSTVARIABLEAPI sphericalToCartesian(const Spheric double BASECONSTVARIABLEAPI getlocalIncAngle(Vector3D& satepoint, Vector3D& landpoint, Vector3D& slopeVector); + +/** + * @brief 灏嗗钩闈㈠潗鏍囧垎杈ㄧ巼锛堢背锛夎浆鎹负缁忕含搴﹀垎杈ㄧ巼锛堝害锛 + * @param sourceEPSG 骞抽潰鍧愭爣绯 EPSG 鐮侊紙濡 UTM Zone 50N 瀵瑰簲 32650锛 + * @param resolutionMeters 杈撳叆鍒嗚鲸鐜囷紙鍗曚綅锛氱背锛 + * @param refLon 鍙傝冪偣缁忓害锛堝崄杩涘埗搴︼紝鐢ㄤ簬璁$畻灞閮ㄨ浆鎹㈢郴鏁帮級 + * @param refLat 鍙傝冪偣绾害锛堝崄杩涘埗搴︼紝鐢ㄤ簬璁$畻灞閮ㄨ浆鎹㈢郴鏁帮級 + * @param[out] degreePerPixelX 缁忓害鏂瑰悜鍒嗚鲸鐜囷紙搴/鍍忕礌锛 + * @param[out] degreePerPixelY 绾害鏂瑰悜鍒嗚鲸鐜囷紙搴/鍍忕礌锛 + * @return 鏄惁杞崲鎴愬姛 + */ +bool BASECONSTVARIABLEAPI ConvertResolutionToDegrees( + int sourceEPSG, + double resolutionMeters, + double refLon, + double refLat, + double& degreePerPixelX, + double& degreePerPixelY +); + #endif \ No newline at end of file diff --git a/BaseCommonLibrary/BaseTool/ImageOperatorBase.h b/BaseCommonLibrary/BaseTool/ImageOperatorBase.h index 633dd9e..9b52766 100644 --- a/BaseCommonLibrary/BaseTool/ImageOperatorBase.h +++ b/BaseCommonLibrary/BaseTool/ImageOperatorBase.h @@ -89,7 +89,7 @@ enum GDALREADARRCOPYMETHOD { /// \param long 缁忓害 /// \param lat 绾害 /// \return 瀵瑰簲鎶曞奖鍧愭爣绯荤粺鐨 EPSG缂栫爜,-1 琛ㄧず璁$畻閿欒 -long BASECONSTVARIABLEAPI getProjectEPSGCodeByLon_Lat(double long, double lat, ProjectStripDelta stripState); +long BASECONSTVARIABLEAPI getProjectEPSGCodeByLon_Lat(double lon, double lat, ProjectStripDelta stripState= ProjectStripDelta::Strip_6); long BASECONSTVARIABLEAPI getProjectEPSGCodeByLon_Lat_inStrip3(double lon, double lat); diff --git a/BaseCommonLibrary/BaseTool/SARSimulationImageL1.cpp b/BaseCommonLibrary/BaseTool/SARSimulationImageL1.cpp index 16134d2..8bc4245 100644 --- a/BaseCommonLibrary/BaseTool/SARSimulationImageL1.cpp +++ b/BaseCommonLibrary/BaseTool/SARSimulationImageL1.cpp @@ -106,7 +106,7 @@ ErrorCode SARSimulationImageL1Dataset::OpenOrNew(QString folder, QString filenam this->saveToXml(); } - if (this->Rasterlevel!=RasterL2||QFile(this->GPSPointFilePath).exists() == false) { + if (this->Rasterlevel==RasterL2||QFile(this->GPSPointFilePath).exists() == false) { // 创建新文件 omp_lock_t lock; omp_init_lock(&lock); @@ -122,7 +122,7 @@ ErrorCode SARSimulationImageL1Dataset::OpenOrNew(QString folder, QString filenam omp_destroy_lock(&lock); } - if (this->Rasterlevel == RasterLevel::RasterSLC || QFile(this->ImageRasterPath).exists() == false) { + else if (this->Rasterlevel == RasterLevel::RasterSLC || QFile(this->ImageRasterPath).exists() == false) { // 创建新文件 omp_lock_t lock; @@ -140,7 +140,7 @@ ErrorCode SARSimulationImageL1Dataset::OpenOrNew(QString folder, QString filenam } - if (this->Rasterlevel != RasterLevel::RasterSLC || QFile(this->ImageRasterPath).exists() == false) { + else if (this->Rasterlevel == RasterLevel::RasterL1B || QFile(this->ImageRasterPath).exists() == false) { // 创建新文件 omp_lock_t lock; @@ -150,11 +150,11 @@ ErrorCode SARSimulationImageL1Dataset::OpenOrNew(QString folder, QString filenam CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); GDALDriver* poDriver = GetGDALDriverManager()->GetDriverByName("ENVI"); - std::shared_ptr poDstDS(poDriver->Create(this->ImageRasterPath.toUtf8().constData(), colCount, rowCount, 1, GDT_CFloat32, NULL)); + std::shared_ptr poDstDS(poDriver->Create(this->GPSPointFilePath.toUtf8().constData(), 19, rowCount, 1, GDT_Float64, NULL)); GDALFlushCache((GDALDatasetH)poDstDS.get()); poDstDS.reset(); - omp_unset_lock(&lock); // - omp_destroy_lock(&lock); // + omp_unset_lock(&lock); + omp_destroy_lock(&lock); } @@ -203,7 +203,7 @@ ErrorCode SARSimulationImageL1Dataset::Open(QString xmlPath) QFileInfo fileInfo(xmlPath); QString fileName = fileInfo.fileName(); // 获取文件名 QString fileSuffix = fileInfo.suffix(); // 获取后缀名 - QString fileNameWithoutSuffix = fileInfo.baseName(); // 获取不带后缀的文件名 + QString fileNameWithoutSuffix = fileInfo.completeBaseName(); // 获取不带后缀的文件名 QString directoryPath = fileInfo.path(); // 获取文件夹路径 if (fileSuffix.toLower() == "xml" || fileSuffix.toLower() == ".xml") { return this->Open(directoryPath, fileNameWithoutSuffix); @@ -246,12 +246,12 @@ void SARSimulationImageL1Dataset::saveToXml() xmlWriter.writeTextElement("RowCount", QString::number(this->rowCount)); xmlWriter.writeTextElement("ColCount", QString::number(this->colCount)); - xmlWriter.writeTextElement("Rnear", QString::number(this->Rnear)); - xmlWriter.writeTextElement("Rfar", QString::number(this->Rfar)); - xmlWriter.writeTextElement("Rref", QString::number(this->Rref)); - xmlWriter.writeTextElement("CenterFreq", QString::number(this->centerFreq)); - xmlWriter.writeTextElement("Fs", QString::number(this->Fs)); - xmlWriter.writeTextElement("CenterAngle", QString::number(this->CenterAngle)); + xmlWriter.writeTextElement("Rnear", QString::number(this->Rnear, 'e', 18)); + xmlWriter.writeTextElement("Rfar", QString::number(this->Rfar, 'e', 18)); + xmlWriter.writeTextElement("Rref", QString::number(this->Rref, 'e', 18)); + xmlWriter.writeTextElement("CenterFreq", QString::number(this->centerFreq, 'e', 18)); + xmlWriter.writeTextElement("Fs", QString::number(this->Fs, 'e', 18)); + xmlWriter.writeTextElement("CenterAngle", QString::number(this->CenterAngle, 'e', 18)); xmlWriter.writeTextElement("LookSide", this->LookSide); // 保存sateantpos @@ -259,60 +259,60 @@ void SARSimulationImageL1Dataset::saveToXml() for (long i = 0; i < this->sateposes.count(); i++) { xmlWriter.writeStartElement("AntPosParam"); - xmlWriter.writeTextElement("time", QString::number(this->sateposes[i].time)); // time - xmlWriter.writeTextElement("Px", QString::number(this->sateposes[i].Px)); // Px - xmlWriter.writeTextElement("Py", QString::number(this->sateposes[i].Py)); // Py - xmlWriter.writeTextElement("Pz", QString::number(this->sateposes[i].Pz)); // Pz - xmlWriter.writeTextElement("Vx", QString::number(this->sateposes[i].Vx)); // Vx - xmlWriter.writeTextElement("Vy", QString::number(this->sateposes[i].Vy)); // Vy - xmlWriter.writeTextElement("Vz", QString::number(this->sateposes[i].Vz)); // Vz - xmlWriter.writeTextElement("AntDirectX", QString::number(this->sateposes[i].AntDirectX)); // AntDirectX - xmlWriter.writeTextElement("AntDirectY", QString::number(this->sateposes[i].AntDirectY)); // AntDirectY - xmlWriter.writeTextElement("AntDirectZ", QString::number(this->sateposes[i].AntDirectZ)); // AntDirectZ - xmlWriter.writeTextElement("AVx", QString::number(this->sateposes[i].AVx)); // AVx - xmlWriter.writeTextElement("AVy", QString::number(this->sateposes[i].AVy)); // AVy - xmlWriter.writeTextElement("AVz", QString::number(this->sateposes[i].AVz)); // AVz - xmlWriter.writeTextElement("lon", QString::number(this->sateposes[i].lon)); // lon - xmlWriter.writeTextElement("lat", QString::number(this->sateposes[i].lat)); // lat - xmlWriter.writeTextElement("ati", QString::number(this->sateposes[i].ati)); // ati + xmlWriter.writeTextElement("time", QString::number(this->sateposes[i].time, 'e', 18)); // time + xmlWriter.writeTextElement("Px", QString::number(this->sateposes[i].Px, 'e', 18)); // Px + xmlWriter.writeTextElement("Py", QString::number(this->sateposes[i].Py, 'e', 18)); // Py + xmlWriter.writeTextElement("Pz", QString::number(this->sateposes[i].Pz, 'e', 18)); // Pz + xmlWriter.writeTextElement("Vx", QString::number(this->sateposes[i].Vx, 'e', 18)); // Vx + xmlWriter.writeTextElement("Vy", QString::number(this->sateposes[i].Vy, 'e', 18)); // Vy + xmlWriter.writeTextElement("Vz", QString::number(this->sateposes[i].Vz, 'e', 18)); // Vz + xmlWriter.writeTextElement("AntDirectX", QString::number(this->sateposes[i].AntDirectX, 'e', 18)); // AntDirectX + xmlWriter.writeTextElement("AntDirectY", QString::number(this->sateposes[i].AntDirectY, 'e', 18)); // AntDirectY + xmlWriter.writeTextElement("AntDirectZ", QString::number(this->sateposes[i].AntDirectZ, 'e', 18)); // AntDirectZ + xmlWriter.writeTextElement("AVx", QString::number(this->sateposes[i].AVx, 'e', 18)); // AVx + xmlWriter.writeTextElement("AVy", QString::number(this->sateposes[i].AVy, 'e', 18)); // AVy + xmlWriter.writeTextElement("AVz", QString::number(this->sateposes[i].AVz, 'e', 18)); // AVz + xmlWriter.writeTextElement("lon", QString::number(this->sateposes[i].lon, 'e', 18)); // lon + xmlWriter.writeTextElement("lat", QString::number(this->sateposes[i].lat, 'e', 18)); // lat + xmlWriter.writeTextElement("ati", QString::number(this->sateposes[i].ati, 'e', 18)); // ati xmlWriter.writeEndElement(); // 结束 } - xmlWriter.writeTextElement("ImageStartTime", QString::number(this->startImageTime)); - xmlWriter.writeTextElement("ImageEndTime", QString::number(this->EndImageTime)); + xmlWriter.writeTextElement("ImageStartTime", QString::number(this->startImageTime, 'e', 18)); + xmlWriter.writeTextElement("ImageEndTime", QString::number(this->EndImageTime, 'e', 18)); - xmlWriter.writeTextElement("incidenceAngleNearRange", QString::number(this->incidenceAngleNearRange)); - xmlWriter.writeTextElement("incidenceAngleFarRange", QString::number(this->incidenceAngleFarRange)); - xmlWriter.writeTextElement("TotalProcessedAzimuthBandWidth", QString::number(this->TotalProcessedAzimuthBandWidth)); - xmlWriter.writeTextElement("DopplerParametersReferenceTime", QString::number(this->DopplerParametersReferenceTime)); + xmlWriter.writeTextElement("incidenceAngleNearRange", QString::number(this->incidenceAngleNearRange, 'e', 18)); + xmlWriter.writeTextElement("incidenceAngleFarRange", QString::number(this->incidenceAngleFarRange, 'e', 18)); + xmlWriter.writeTextElement("TotalProcessedAzimuthBandWidth", QString::number(this->TotalProcessedAzimuthBandWidth, 'e', 18)); + xmlWriter.writeTextElement("DopplerParametersReferenceTime", QString::number(this->DopplerParametersReferenceTime, 'e', 18)); xmlWriter.writeStartElement("DopplerCentroidCoefficients"); - xmlWriter.writeTextElement("d0", QString::number(this->d0)); - xmlWriter.writeTextElement("d1", QString::number(this->d1)); - xmlWriter.writeTextElement("d2", QString::number(this->d2)); - xmlWriter.writeTextElement("d3", QString::number(this->d3)); - xmlWriter.writeTextElement("d4", QString::number(this->d4)); + xmlWriter.writeTextElement("d0", QString::number(this->d0, 'e', 18)); + xmlWriter.writeTextElement("d1", QString::number(this->d1, 'e', 18)); + xmlWriter.writeTextElement("d2", QString::number(this->d2, 'e', 18)); + xmlWriter.writeTextElement("d3", QString::number(this->d3, 'e', 18)); + xmlWriter.writeTextElement("d4", QString::number(this->d4, 'e', 18)); xmlWriter.writeEndElement(); // DopplerCentroidCoefficients xmlWriter.writeStartElement("DopplerRateValuesCoefficients"); - xmlWriter.writeTextElement("r0", QString::number(this->r0)); - xmlWriter.writeTextElement("r1", QString::number(this->r1)); - xmlWriter.writeTextElement("r2", QString::number(this->r2)); - xmlWriter.writeTextElement("r3", QString::number(this->r3)); - xmlWriter.writeTextElement("r4", QString::number(this->r4)); + xmlWriter.writeTextElement("r0", QString::number(this->r0, 'e', 18)); + xmlWriter.writeTextElement("r1", QString::number(this->r1, 'e', 18)); + xmlWriter.writeTextElement("r2", QString::number(this->r2, 'e', 18)); + xmlWriter.writeTextElement("r3", QString::number(this->r3, 'e', 18)); + xmlWriter.writeTextElement("r4", QString::number(this->r4, 'e', 18)); xmlWriter.writeEndElement(); // DopplerRateValuesCoefficients - xmlWriter.writeTextElement("latitude_center", QString::number(this->latitude_center)); - xmlWriter.writeTextElement("longitude_center", QString::number(this->longitude_center)); - xmlWriter.writeTextElement("latitude_topLeft", QString::number(this->latitude_topLeft)); - xmlWriter.writeTextElement("longitude_topLeft", QString::number(this->longitude_topLeft)); - xmlWriter.writeTextElement("latitude_topRight", QString::number(this->latitude_topRight)); - xmlWriter.writeTextElement("longitude_topRight", QString::number(this->longitude_topRight)); - xmlWriter.writeTextElement("latitude_bottomLeft", QString::number(this->latitude_bottomLeft)); - xmlWriter.writeTextElement("longitude_bottomLeft", QString::number(this->longitude_bottomLeft)); - xmlWriter.writeTextElement("latitude_bottomRight", QString::number(this->latitude_bottomRight)); - xmlWriter.writeTextElement("longitude_bottomRight", QString::number(this->longitude_bottomRight)); + xmlWriter.writeTextElement("latitude_center", QString::number(this->latitude_center, 'e', 18)); + xmlWriter.writeTextElement("longitude_center", QString::number(this->longitude_center, 'e', 18)); + xmlWriter.writeTextElement("latitude_topLeft", QString::number(this->latitude_topLeft, 'e', 18)); + xmlWriter.writeTextElement("longitude_topLeft", QString::number(this->longitude_topLeft, 'e', 18)); + xmlWriter.writeTextElement("latitude_topRight", QString::number(this->latitude_topRight, 'e', 18)); + xmlWriter.writeTextElement("longitude_topRight", QString::number(this->longitude_topRight, 'e', 18)); + xmlWriter.writeTextElement("latitude_bottomLeft", QString::number(this->latitude_bottomLeft, 'e', 18)); + xmlWriter.writeTextElement("longitude_bottomLeft", QString::number(this->longitude_bottomLeft, 'e', 18)); + xmlWriter.writeTextElement("latitude_bottomRight", QString::number(this->latitude_bottomRight, 'e', 18)); + xmlWriter.writeTextElement("longitude_bottomRight", QString::number(this->longitude_bottomRight, 'e', 18)); xmlWriter.writeEndElement(); // Parameters xmlWriter.writeEndDocument(); diff --git a/BaseCommonLibrary/BaseTool/gdalImageOperator.cpp b/BaseCommonLibrary/BaseTool/gdalImageOperator.cpp index c695822..9fe8bfd 100644 --- a/BaseCommonLibrary/BaseTool/gdalImageOperator.cpp +++ b/BaseCommonLibrary/BaseTool/gdalImageOperator.cpp @@ -1401,6 +1401,15 @@ gdalImage CreategdalImage(const QString& img_path, int height, int width, int ba GDALDataset* poDstDS = poDriver->Create(img_path.toUtf8().constData(), width, height, band_num, datetype, NULL); // 锟斤拷锟斤拷锟斤拷 + + if (NULL == poDstDS) + { + qDebug() << "Create image failed!"; + throw "Create image failed!"; + exit(1); + } + + if (need_gt) { if (!projection.isEmpty()) { poDstDS->SetProjection(projection.toUtf8().constData()); diff --git a/BaseCommonLibrary/ImageOperatorFuntion.cpp b/BaseCommonLibrary/ImageOperatorFuntion.cpp index 5154807..ae75a14 100644 --- a/BaseCommonLibrary/ImageOperatorFuntion.cpp +++ b/BaseCommonLibrary/ImageOperatorFuntion.cpp @@ -209,6 +209,7 @@ int ENVI2TIFF(QString in_envi_path, QString out_tiff_path) void ConvertCoordinateSystem(QString inRasterPath, QString outRasterPath, long outepsgcode) { // 娉ㄥ唽鎵鏈塆DAL椹卞姩 GDALAllRegister(); + CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); // 鎵撳紑杈撳叆鏍呮牸鏂囦欢 GDALDataset* srcDataset = (GDALDataset*)GDALOpen(inRasterPath.toUtf8().constData(), GA_ReadOnly); @@ -294,7 +295,7 @@ void ConvertCoordinateSystem(QString inRasterPath, QString outRasterPath, long o void ResampleByReferenceRasterB(QString pszSrcFile, QString RefrasterBPath, QString pszOutFile, GDALResampleAlg eResample) { GDALAllRegister(); CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "NO"); + GDALDataset* pDSrc = (GDALDataset*)GDALOpen(pszSrcFile.toLocal8Bit().constData(), GA_ReadOnly); if (pDSrc == NULL) { qDebug() << u8"do not open In Raster file: " << pszSrcFile; @@ -565,6 +566,7 @@ void ResampleByReferenceRasterB(QString InrasterAPath, QString RefrasterBPath, Q void cropRasterByLatLon(const char* inputFile, const char* outputFile, double minLon, double maxLon, double minLat, double maxLat) { // 鍒濆鍖 GDAL 搴 GDALAllRegister(); + CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); // 鎵撳紑鏍呮牸鏁版嵁闆 GDALDataset* poDataset = (GDALDataset*)GDALOpen(inputFile, GA_ReadOnly); @@ -762,7 +764,7 @@ void resampleRaster(const char* inputRaster, const char* outputRaster, double ta // 璁$畻鐩爣鏍呮牸鐨勫昂瀵 double targetXSize = (adfGeoTransform[1] * nXSize) / targetPixelSizeX; - double targetYSize = (adfGeoTransform[5] * nYSize) / targetPixelSizeY; + double targetYSize = std::abs((adfGeoTransform[5] * nYSize) / targetPixelSizeY); // 鍒涘缓鐩爣鏁版嵁闆嗭紙杈撳嚭鏍呮牸锛 GDALDriver* poDriver = GetGDALDriverManager()->GetDriverByName("GTiff"); @@ -967,14 +969,16 @@ long GetEPSGFromRasterFile(QString filepath) -long getProjectEPSGCodeByLon_Lat(double long, double lat, ProjectStripDelta stripState) +long getProjectEPSGCodeByLon_Lat(double lon, double lat, ProjectStripDelta stripState) { long EPSGCode = 0; switch (stripState) { case ProjectStripDelta::Strip_3: { + EPSGCode = getProjectEPSGCodeByLon_Lat_inStrip3(lon, lat); break; }; case ProjectStripDelta::Strip_6: { + EPSGCode = getProjectEPSGCodeByLon_Lat_inStrip6(lon, lat); break; } default: { diff --git a/Toolbox/BaseToolbox/BaseToolbox/GF3CalibrationAndGeocodingClass.cpp b/Toolbox/BaseToolbox/BaseToolbox/GF3CalibrationAndGeocodingClass.cpp index 1e5fdcd..dc3c8f9 100644 --- a/Toolbox/BaseToolbox/BaseToolbox/GF3CalibrationAndGeocodingClass.cpp +++ b/Toolbox/BaseToolbox/BaseToolbox/GF3CalibrationAndGeocodingClass.cpp @@ -26,7 +26,7 @@ ErrorCode GF3CalibrationRaster(QString inRasterPath, QString outRasterPath, doub double quayCoff = Qualifyvalue * 1.0 / 32767; double caliCoff = std::pow(10.0, (calibrationConst * 1.0 / 20)); - qDebug() << "定标系数:\t" << quayCoff / caliCoff; + qDebug() << u8"定标系数:\t" << quayCoff / caliCoff; long startrow = 0; for (startrow = 0; startrow < imgraster.height; startrow = startrow + blocklines) { @@ -37,7 +37,7 @@ ErrorCode GF3CalibrationRaster(QString inRasterPath, QString outRasterPath, doub imgArr.imag() = imgArrb2.array() * quayCoff / caliCoff; outraster.saveImage(imgArr, startrow, 0, 1); } - qDebug() << "影像写入到:" << outRasterPath; + qDebug() << u8"影像写入到:" << outRasterPath; return ErrorCode::SUCCESS; } @@ -80,29 +80,29 @@ ErrorCode ImportGF3L1ARasterToWorkspace(QString inMetaxmlPath, QString inRasterP QString outRasterpath = l1dataset.getImageRasterPath(); ErrorCode errorcode = ErrorCode::SUCCESS; - qDebug() << "导入数据:\t" << inRasterPath; + qDebug() << u8"导入数据:\t" << inRasterPath; switch (polsartype) { case POLARHH: - qDebug() << "极化:HH"; + qDebug() << u8"极化:HH"; errorcode = GF3CalibrationRaster(inRasterPath, outRasterpath, gf3xml.HH_QualifyValue, gf3xml.HH_CalibrationConst); break; case POLARHV: - qDebug() << "极化:HH"; + qDebug() << u8"极化:HH"; errorcode = GF3CalibrationRaster(inRasterPath, outRasterpath, gf3xml.HV_QualifyValue, gf3xml.HV_CalibrationConst); break; case POLARVH: - qDebug() << "极化:VH"; + qDebug() << u8"极化:VH"; errorcode = GF3CalibrationRaster(inRasterPath, outRasterpath, gf3xml.VH_QualifyValue, gf3xml.VH_CalibrationConst); break; case POLARVV: - qDebug() << "极化:VV"; + qDebug() << u8"极化:VV"; errorcode = GF3CalibrationRaster(inRasterPath, outRasterpath, gf3xml.VV_QualifyValue, gf3xml.VV_CalibrationConst); break; default: break; } - qDebug() << "导入数据状态:\t" << QString::fromStdString(errorCode2errInfo(errorcode)); + qDebug() << u8"导入数据状态:\t" << QString::fromStdString(errorCode2errInfo(errorcode)); return errorcode; } @@ -115,7 +115,7 @@ QVector SearchGF3DataTiff(QString inMetaxmlPath) // 获取路径所在的目录 QDir directory(absPath); if (!directory.exists()) { - qDebug() << "Directory does not exist:" << directory.absolutePath(); + qDebug() << u8"Directory does not exist:" << directory.absolutePath(); return QVector(0); } @@ -124,7 +124,7 @@ QVector SearchGF3DataTiff(QString inMetaxmlPath) filters << "*.tif" << "*.TIF" << "*.tiff" << "*.TIFF"; QStringList files = directory.entryList(filters, QDir::Files); - qDebug() << "TIFF Files in the directory" << directory.absolutePath() << ":"; + qDebug() << u8"TIFF Files in the directory" << directory.absolutePath() << ":"; QVector filepath(0); for (long i = 0; i < files.count(); i++) { @@ -144,7 +144,7 @@ POLARTYPEENUM getDatasetGF3FilePolsarType(QString fileName) if (match.hasMatch()) { polarization = match.captured(1); polarization = polarization.toLower().replace("_", ""); - qDebug() << "Polarization extracted:" << polarization; + qDebug() << u8"Polarization extracted:" << polarization; if (polarization == "hh") { return POLARTYPEENUM::POLARHH; } @@ -162,7 +162,7 @@ POLARTYPEENUM getDatasetGF3FilePolsarType(QString fileName) } } else { - qDebug() << "No polarization found in the path."; + qDebug() << u8"No polarization found in the path."; return POLARTYPEENUM::POLARUNKOWN; } @@ -199,7 +199,7 @@ ErrorCode ImportGF3L1AProcess(QString inMetaxmlPath, QString outWorkDirPath) break; } if (errorcode == ErrorCode::SUCCESS) { - return errorcode; + continue; } else { QMessageBox::warning(nullptr, u8"错误", u8"数据导入错误"); @@ -305,18 +305,18 @@ ErrorCode GF3RDCreateLookTable(QString inxmlPath, QString indemPath, QString out polyfitmodel.polyFit(3, false); qDebug() << "-----------------------------------"; - qDebug() << "satellite polyfit model params:\n"; + qDebug() << u8"satellite polyfit model params:\n"; qDebug() << polyfitmodel.getSatelliteOribtModelParamsString(); qDebug() << "-----------------------------------"; // 开始计算查找表 //1.计算分块 long cpucore_num = std::thread::hardware_concurrency(); - long blockline = Memory1MB * 500 / 8 / cpucore_num / 4 / l1dataset.getcolCount(); - blockline = blockline < 50 ? 50 : blockline; + long blocklineinit = Memory1MB / 8 / cpucore_num / 4 / l1dataset.getcolCount() * 4000; + blocklineinit = blocklineinit < 50 ? 50 : blocklineinit; //2.迭代计算 - long colcount = l1dataset.getcolCount(); - long rowcount = l1dataset.getrowCount(); + long colcount = rasterRC.width;//l1dataset.getcolCount(); + long rowcount = rasterRC.height;//l1dataset.getrowCount(); long startRId = 0; long processNumber = 0; @@ -334,7 +334,11 @@ ErrorCode GF3RDCreateLookTable(QString inxmlPath, QString indemPath, QString out #pragma omp parallel for num_threads(cpucore_num-1) - for (startRId = 0; startRId < rowcount; startRId = startRId + blockline) { + for (startRId = 0; startRId < rowcount; startRId = startRId + blocklineinit) { + long blockline = blocklineinit; + if (startRId + blockline > rowcount) { + blockline = rowcount - startRId; + } Eigen::MatrixXd sar_r = rasterRC.getData(startRId, 0, blockline, colcount, 1); Eigen::MatrixXd sar_c = rasterRC.getData(startRId, 0, blockline, colcount, 2); Eigen::MatrixXd dem_x = demxyz.getData(startRId, 0, blockline, colcount, 1); @@ -409,7 +413,7 @@ ErrorCode GF3RDCreateLookTable(QString inxmlPath, QString indemPath, QString out } else {} processNumber = processNumber + blockrows; - qDebug() << "\rprocess bar:\t" << processNumber * 100.0 / rowcount << " % " << "\t\t\t"; + qDebug() << u8"\rprocess bar:\t" << processNumber * 100.0 / rowcount << " % " << "\t\t\t"; if (progressDialog.maximum() <= processNumber) { processNumber = progressDialog.maximum() - 1; } @@ -430,7 +434,7 @@ ErrorCode GF3OrthSLC( QString inRasterPath, QString inlooktablePath, QString out gdalImage outRaster(outRasterPath);// if (outRaster.height != looktableRaster.height || outRaster.width != looktableRaster.width) { - qDebug() << "look table size is not same as outRaster size"<< looktableRaster.height <<"!="<polyfitVz[i], 'e', 6) + "\n"; } result += "------------------------------------------------------\n"; - + printf("%s\n", result.toUtf8().constData()); return result; } diff --git a/Toolbox/BaseToolbox/BaseToolbox/QComplex2AmpPhase.cpp b/Toolbox/BaseToolbox/BaseToolbox/QComplex2AmpPhase.cpp index af2d5a6..ea9936f 100644 --- a/Toolbox/BaseToolbox/BaseToolbox/QComplex2AmpPhase.cpp +++ b/Toolbox/BaseToolbox/BaseToolbox/QComplex2AmpPhase.cpp @@ -16,7 +16,8 @@ QComplex2AmpPhase::QComplex2AmpPhase(QWidget *parent) QObject::connect(ui.radioButtonAmp,SIGNAL(toggled(bool)),this,SLOT(radioButtonAmptoggled(bool))); QObject::connect(ui.radioButtonPhase, SIGNAL(toggled(bool)), this, SLOT(radioButtonPhasetoggled(bool))); QObject::connect(ui.radioButtonSigma0, SIGNAL(toggled(bool)), this, SLOT(radioButtonSigma0toggled(bool))); - QObject::connect(ui.buttonBox, SIGNAL(accept()), this, SLOT(onaccept())); + QObject::connect(ui.pushButtonWorkSpace, SIGNAL(clicked(bool)), this, SLOT(onpushButtonWorkSpaceClicked(bool))); + QObject::connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(onaccept())); QObject::connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(onreject())); //toggled(bool ) } @@ -47,19 +48,19 @@ void QComplex2AmpPhase::onaccept() slcl1.Open(folderpath, filename); QString l2bfilename = filename + ui.lineEditHZ->text(); SARSimulationImageL1Dataset l1B(RasterLevel::RasterL1B); - slcl1.OpenOrNew(outworkdir, l2bfilename,slcl1.getrowCount(),slcl1.getcolCount()); + l1B.OpenOrNew(outworkdir, l2bfilename,slcl1.getrowCount(),slcl1.getcolCount()); QString srcxmlpath = slcl1.getxmlFilePath(); QString tarxmlpath = l1B.getxmlFilePath(); copyAndReplaceFile(srcxmlpath, tarxmlpath); l1B.loadFromXml(); if (ui.radioButtonAmp->isChecked()) { - Complex2AmpRaster(imgfilepath, slcl1.getImageRasterPath()); + Complex2AmpRaster(imgfilepath, l1B.getImageRasterPath()); } else if (ui.radioButtonPhase->isChecked()) { - Complex2PhaseRaster(imgfilepath, slcl1.getImageRasterPath()); + Complex2PhaseRaster(imgfilepath, l1B.getImageRasterPath()); } else if (ui.radioButtonSigma0->isChecked()) { - Complex2dBRaster(imgfilepath, slcl1.getImageRasterPath()); + Complex2dBRaster(imgfilepath, l1B.getImageRasterPath()); } progressDialog.setValue(i); } diff --git a/Toolbox/BaseToolbox/BaseToolbox/QImportGF3StripL1ADataset.cpp b/Toolbox/BaseToolbox/BaseToolbox/QImportGF3StripL1ADataset.cpp index 12793e3..e6146f0 100644 --- a/Toolbox/BaseToolbox/BaseToolbox/QImportGF3StripL1ADataset.cpp +++ b/Toolbox/BaseToolbox/BaseToolbox/QImportGF3StripL1ADataset.cpp @@ -7,10 +7,9 @@ QImportGF3StripL1ADataset::QImportGF3StripL1ADataset(QWidget *parent) { ui.setupUi(this); - QListWidget* listWidgetMetaxml; - QObject::connect(ui.pushButtonAdd,SIGNAL(clicked(clicked)),this,SLOT(onpushButtonAddClicked(bool))); - QObject::connect(ui.pushButtonRemove, SIGNAL(clicked(clicked)), this, SLOT(onpushButtonRemoveClicked(bool))); - QObject::connect(ui.pushButtonWorkSpace, SIGNAL(clicked(clicked)), this, SLOT(onpushButtonWorkSpaceClicked(bool))); + QObject::connect(ui.pushButtonAdd,SIGNAL(clicked(bool)),this,SLOT(onpushButtonAddClicked(bool))); + QObject::connect(ui.pushButtonRemove, SIGNAL(clicked(bool)), this, SLOT(onpushButtonRemoveClicked(bool))); + QObject::connect(ui.pushButtonWorkSpace, SIGNAL(clicked(bool)), this, SLOT(onpushButtonWorkSpaceClicked(bool))); QObject::connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(onreject())); QObject::connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(onaccept())); diff --git a/Toolbox/BaseToolbox/BaseToolbox/QRDOrthProcessClass.cpp b/Toolbox/BaseToolbox/BaseToolbox/QRDOrthProcessClass.cpp index 2ad3480..c9ec7cc 100644 --- a/Toolbox/BaseToolbox/BaseToolbox/QRDOrthProcessClass.cpp +++ b/Toolbox/BaseToolbox/BaseToolbox/QRDOrthProcessClass.cpp @@ -10,8 +10,8 @@ QRDOrthProcessClass::QRDOrthProcessClass(QWidget *parent) connect(ui.pushButtonAdd,SIGNAL(clicked(bool)),this,SLOT(onpushButtonAddClicked(bool))); connect(ui.pushButtonRemove,SIGNAL(clicked(bool)),this,SLOT(onpushButtonRemoveClicked(bool))); - connect(ui.pushButtonDEMSelect,SIGNAL(clicked(bool)),this,SLOT(onpushButtonWorkSpaceClicked(bool))); - connect(ui.pushButtonWorkSpace, SIGNAL(clicked(bool)), this, SLOT(pushButtonDEMSelectClicked(bool))); + connect(ui.pushButtonWorkSpace,SIGNAL(clicked(bool)),this,SLOT(onpushButtonWorkSpaceClicked(bool))); + connect(ui.pushButtonDEMSelect, SIGNAL(clicked(bool)), this, SLOT(pushButtonDEMSelectClicked(bool))); QObject::connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(onreject())); QObject::connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(onaccept())); // QDialogButtonBox* buttonBox; diff --git a/Toolbox/BaseToolbox/BaseToolbox/SatelliteGF3xmlParser.cpp b/Toolbox/BaseToolbox/BaseToolbox/SatelliteGF3xmlParser.cpp index 4cae6ee..5c8ae39 100644 --- a/Toolbox/BaseToolbox/BaseToolbox/SatelliteGF3xmlParser.cpp +++ b/Toolbox/BaseToolbox/BaseToolbox/SatelliteGF3xmlParser.cpp @@ -5,24 +5,41 @@ bool SatelliteGF3xmlParser::loadFile(const QString& filename) { QFile file(filename); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { - qWarning() << "Cannot open file:" << filename; + qWarning() << u8"Cannot open file:" << filename; return false; } QDomDocument doc; if (!doc.setContent(&file)) { file.close(); - qWarning() << "Failed to parse the file into a DOM tree."; + qWarning() << u8"Failed to parse the file into a DOM tree."; return false; } file.close(); xml = doc; + + this->parseAdditionalData(); + this->parseImageInfo(); + this->parsePlatform(); + this->parseGPS(); + + //处理时间 + double tempreftime = start + (end - start) / 2; + for (long i = 0;i < antposs.size();i++) + { + antposs[i].time = antposs[i].time - tempreftime; + } + + start = start- tempreftime; + end = end- tempreftime; + + return true; } void SatelliteGF3xmlParser::parsePlatform() { - QDomElement platform = xml.firstChildElement("root").firstChildElement("platform"); + QDomElement platform = xml.firstChildElement("product").firstChildElement("platform"); if (!platform.isNull()) { CenterTime = platform.firstChildElement("CenterTime").text(); Rs = platform.firstChildElement("Rs").text().toDouble(); @@ -37,24 +54,24 @@ void SatelliteGF3xmlParser::parsePlatform() { Vys = platform.firstChildElement("Vys").text().toDouble(); Vzs = platform.firstChildElement("Vzs").text().toDouble(); - qDebug() << "Platform Data:"; - qDebug() << "CenterTime:" << CenterTime; - qDebug() << "Rs:" << Rs; - qDebug() << "satVelocity:" << satVelocity; - qDebug() << "RollAngle:" << RollAngle; - qDebug() << "PitchAngle:" << PitchAngle; - qDebug() << "YawAngle:" << YawAngle; - qDebug() << "Xs:" << Xs; - qDebug() << "Ys:" << Ys; - qDebug() << "Zs:" << Zs; - qDebug() << "Vxs:" << Vxs; - qDebug() << "Vys:" << Vys; - qDebug() << "Vzs:" << Vzs; + qDebug() << u8"Platform Data:"; + qDebug() << u8"CenterTime:" << CenterTime; + qDebug() << u8"Rs:" << Rs; + qDebug() << u8"satVelocity:" << satVelocity; + qDebug() << u8"RollAngle:" << RollAngle; + qDebug() << u8"PitchAngle:" << PitchAngle; + qDebug() << u8"YawAngle:" << YawAngle; + qDebug() << u8"Xs:" << Xs; + qDebug() << u8"Ys:" << Ys; + qDebug() << u8"Zs:" << Zs; + qDebug() << u8"Vxs:" << Vxs; + qDebug() << u8"Vys:" << Vys; + qDebug() << u8"Vzs:" << Vzs; } } void SatelliteGF3xmlParser::parseGPS() { - QDomElement GPS = xml.firstChildElement("root").firstChildElement("GPS"); + QDomElement GPS = xml.firstChildElement("product").firstChildElement("GPS"); if (!GPS.isNull()) { QDomNodeList GPSParams = GPS.elementsByTagName("GPSParam"); for (int i = 0; i < GPSParams.count(); ++i) { @@ -69,37 +86,52 @@ void SatelliteGF3xmlParser::parseGPS() { QString yVelocity = GPSParam.firstChildElement("yVelocity").text(); QString zVelocity = GPSParam.firstChildElement("zVelocity").text(); - QDateTime dateTime = QDateTime::fromString(TimeStamp, "yyyy-MM-dd HH:mm:ss.zzzzzz"); - satepos.time = dateTime.toMSecsSinceEpoch() / 1000.0; - satepos.Px = xPosition.toDouble(); - satepos.Py = yPosition.toDouble(); - satepos.Pz = zPosition.toDouble(); - satepos.Vx = xVelocity.toDouble(); - satepos.Vy = yVelocity.toDouble(); - satepos.Vz = zVelocity.toDouble(); + + TimestampMicroseconds dateTime = parseAndConvert(TimeStamp.toStdString()); + satepos.time = dateTime.msecsSinceEpoch / 1000.0 + dateTime.microseconds / 100000.0; + satepos.Px = xPosition.toDouble(); + satepos.Py = yPosition.toDouble(); + satepos.Pz = zPosition.toDouble(); + satepos.Vx = xVelocity.toDouble(); + satepos.Vy = yVelocity.toDouble(); + satepos.Vz = zVelocity.toDouble(); this->antposs.append(satepos); - qDebug() << "\nGPS Param Data:"; - qDebug() << "TimeStamp:" << TimeStamp; - qDebug() << "xPosition:" << xPosition; - qDebug() << "yPosition:" << yPosition; - qDebug() << "zPosition:" << zPosition; - qDebug() << "xVelocity:" << xVelocity; - qDebug() << "yVelocity:" << yVelocity; - qDebug() << "zVelocity:" << zVelocity; + qDebug() << u8"\nGPS Param Data:"; + qDebug() << u8"TimeStamp:" << TimeStamp; + qDebug() << u8"xPosition:" << xPosition; + qDebug() << u8"yPosition:" << yPosition; + qDebug() << u8"zPosition:" << zPosition; + qDebug() << u8"xVelocity:" << xVelocity; + qDebug() << u8"yVelocity:" << yVelocity; + qDebug() << u8"zVelocity:" << zVelocity; } } } void SatelliteGF3xmlParser::parseImageInfo() { - QDomElement imageinfo = xml.firstChildElement("root").firstChildElement("imageinfo"); + QDomElement imageinfo = xml.firstChildElement("product").firstChildElement("imageinfo"); if (!imageinfo.isNull()) { QDomElement imagingTime = imageinfo.firstChildElement("imagingTime"); - ; - start = QDateTime::fromString(imagingTime.firstChildElement("start").text(), "yyyy-MM-dd HH:mm:ss.zzzzzz").toMSecsSinceEpoch()/1000.0; - end = QDateTime::fromString(imagingTime.firstChildElement("end").text(), "yyyy-MM-dd HH:mm:ss.zzzzzz").toMSecsSinceEpoch() / 1000.0; - + + QString starttimestr = imagingTime.firstChildElement("start").text().trimmed(); + QString endtimestr = imagingTime.firstChildElement("end").text().trimmed(); + + TimestampMicroseconds starttime = parseAndConvert(starttimestr.toStdString()); + TimestampMicroseconds endtime = parseAndConvert(endtimestr.toStdString()); + + start = starttime.msecsSinceEpoch / 1000.0 + starttime.microseconds / 100000.0; + end = endtime.msecsSinceEpoch / 1000.0 + endtime.microseconds / 100000.0; + + // 打印starttime,endtime + qDebug() << u8"成像开始时间(parse):" << starttime.msecsSinceEpoch << "\t" << starttime.microseconds; + qDebug() << u8"成像结束时间(parse):" << endtime.msecsSinceEpoch << "\t" << endtime.microseconds; + + qDebug() << u8"成像开始时间:" << start <<"\t"<< starttimestr; + qDebug() << u8"成像结束时间:" << end << "\t" << endtimestr; + + nearRange = imageinfo.firstChildElement("nearRange").text().toDouble(); refRange = imageinfo.firstChildElement("refRange").text().toDouble(); eqvFs = imageinfo.firstChildElement("eqvFs").text().toDouble(); @@ -154,35 +186,36 @@ void SatelliteGF3xmlParser::parseImageInfo() { incidenceAngleNearRange = imageinfo.firstChildElement("incidenceAngleNearRange").text().toDouble(); incidenceAngleFarRange = imageinfo.firstChildElement("incidenceAngleFarRange").text().toDouble(); - qDebug() << "\nImage Info Data:"; - qDebug() << "Start:" << start; - qDebug() << "End:" << end; - qDebug() << "Near Range:" << nearRange; - qDebug() << "Ref Range:" << refRange; - qDebug() << "Eqv Fs:" << eqvFs; - qDebug() << "Eqv PRF:" << eqvPRF; - qDebug() << "Center Latitude:" << latitude_center << ", Longitude:" << longitude_center; - qDebug() << "Top Left Corner Latitude:" << latitude_topLeft << ", Longitude:" << longitude_topLeft; - qDebug() << "Top Right Corner Latitude:" << latitude_topRight << ", Longitude:" << longitude_topRight; - qDebug() << "Bottom Left Corner Latitude:" << latitude_bottomLeft << ", Longitude:" << longitude_bottomLeft; - qDebug() << "Bottom Right Corner Latitude:" << latitude_bottomRight << ", Longitude:" << longitude_bottomRight; - qDebug() << "Width:" << width; - qDebug() << "Height:" << height; - qDebug() << "Width Space:" << widthspace; - qDebug() << "Height Space:" << heightspace; - qDebug() << "Scene Shift:" << sceneShift; - qDebug() << "Image Bit:" << imagebit; - qDebug() << "HH Qualify Value:" << HH_QualifyValue; - qDebug() << "HV Qualify Value:" << HV_QualifyValue; - qDebug() << "HH Echo Saturation:" << HH_echoSaturation; - qDebug() << "HV Echo Saturation:" << HV_echoSaturation; - qDebug() << "incidenceAngleNearRange:" << incidenceAngleNearRange; - qDebug() << "incidenceAngleFarRange:" << incidenceAngleFarRange; + qDebug() << u8"\nImage Info Data:"; + qDebug() << u8"Start:" << start; + qDebug() << u8"End:" << end; + qDebug() << u8"Near Range:" << nearRange; + qDebug() << u8"Ref Range:" << refRange; + qDebug() << u8"Eqv Fs:" << eqvFs; + qDebug() << u8"Eqv PRF:" << eqvPRF; + qDebug() << u8"Center Latitude:" << latitude_center << ", Longitude:" << longitude_center; + qDebug() << u8"Top Left Corner Latitude:" << latitude_topLeft << ", Longitude:" << longitude_topLeft; + qDebug() << u8"Top Right Corner Latitude:" << latitude_topRight << ", Longitude:" << longitude_topRight; + qDebug() << u8"Bottom Left Corner Latitude:" << latitude_bottomLeft << ", Longitude:" << longitude_bottomLeft; + qDebug() << u8"Bottom Right Corner Latitude:" << latitude_bottomRight << ", Longitude:" << longitude_bottomRight; + qDebug() << u8"Width:" << width; + qDebug() << u8"Height:" << height; + qDebug() << u8"Width Space:" << widthspace; + qDebug() << u8"Height Space:" << heightspace; + qDebug() << u8"Scene Shift:" << sceneShift; + qDebug() << u8"Image Bit:" << imagebit; + qDebug() << u8"HH Qualify Value:" << HH_QualifyValue; + qDebug() << u8"HV Qualify Value:" << HV_QualifyValue; + qDebug() << u8"HH Echo Saturation:" << HH_echoSaturation; + qDebug() << u8"HV Echo Saturation:" << HV_echoSaturation; + qDebug() << u8"incidenceAngleNearRange:" << incidenceAngleNearRange; + qDebug() << u8"incidenceAngleFarRange:" << incidenceAngleFarRange; } } void SatelliteGF3xmlParser::parseAdditionalData() { - QDomElement calibrationConst = xml.firstChildElement("root").firstChildElement("CalibrationConst"); + QDomElement processinfo = xml.firstChildElement("product").firstChildElement("processinfo"); + QDomElement calibrationConst = processinfo.firstChildElement("CalibrationConst"); if (!calibrationConst.isNull()) { bool HH_CalibrationConstISNULL=false; @@ -201,50 +234,50 @@ void SatelliteGF3xmlParser::parseAdditionalData() { - qDebug() << "\nCalibration Const Data:"; - qDebug() << "HH Calibration Const:" << HH_CalibrationConst; - qDebug() << "HV Calibration Const:" << HV_CalibrationConst; - qDebug() << "VH Calibration Const:" << VH_CalibrationConst; - qDebug() << "VV Calibration Const:" << VV_CalibrationConst; + qDebug() << u8"\nCalibration Const Data:"; + qDebug() << u8"HH Calibration Const:" << HH_CalibrationConst; + qDebug() << u8"HV Calibration Const:" << HV_CalibrationConst; + qDebug() << u8"VH Calibration Const:" << VH_CalibrationConst; + qDebug() << u8"VV Calibration Const:" << VV_CalibrationConst; } - AzFdc0 = xml.firstChildElement("root").firstChildElement("AzFdc0").text().toDouble(); - AzFdc1 = xml.firstChildElement("root").firstChildElement("AzFdc1").text().toDouble(); + AzFdc0 = processinfo.firstChildElement("AzFdc0").text().toDouble(); + AzFdc1 = processinfo.firstChildElement("AzFdc1").text().toDouble(); + QDomElement sensorNode = xml.firstChildElement("product").firstChildElement("sensor"); + sensorID = sensorNode.firstChildElement("sensorID").text(); + imagingMode = sensorNode.firstChildElement("imagingMode").text(); + lamda = sensorNode.firstChildElement("lamda").text().toDouble(); + RadarCenterFrequency = sensorNode.firstChildElement("RadarCenterFrequency").text().toDouble(); - sensorID = xml.firstChildElement("root").firstChildElement("sensorID").text(); - imagingMode = xml.firstChildElement("root").firstChildElement("imagingMode").text(); - lamda = xml.firstChildElement("root").firstChildElement("lamda").text().toDouble(); - RadarCenterFrequency = xml.firstChildElement("root").firstChildElement("RadarCenterFrequency").text().toDouble(); + TotalProcessedAzimuthBandWidth = processinfo.firstChildElement("TotalProcessedAzimuthBandWidth").text().toDouble(); + DopplerParametersReferenceTime = processinfo.firstChildElement("DopplerParametersReferenceTime").text().toDouble(); - TotalProcessedAzimuthBandWidth = xml.firstChildElement("root").firstChildElement("TotalProcessedAzimuthBandWidth").text().toDouble(); - DopplerParametersReferenceTime = xml.firstChildElement("root").firstChildElement("DopplerParametersReferenceTime").text().toDouble(); - - QDomElement dopplerCentroidCoefficients = xml.firstChildElement("root").firstChildElement("DopplerCentroidCoefficients"); + QDomElement dopplerCentroidCoefficients = processinfo.firstChildElement("DopplerCentroidCoefficients"); d0 = dopplerCentroidCoefficients.firstChildElement("d0").text().toDouble(); d1 = dopplerCentroidCoefficients.firstChildElement("d1").text().toDouble(); d2 = dopplerCentroidCoefficients.firstChildElement("d2").text().toDouble(); d3 = dopplerCentroidCoefficients.firstChildElement("d3").text().toDouble(); d4 = dopplerCentroidCoefficients.firstChildElement("d4").text().toDouble(); - QDomElement dopplerRateValuesCoefficients = xml.firstChildElement("root").firstChildElement("DopplerRateValuesCoefficients"); + QDomElement dopplerRateValuesCoefficients = processinfo.firstChildElement("DopplerRateValuesCoefficients"); r0 = dopplerRateValuesCoefficients.firstChildElement("r0").text().toDouble(); r1 = dopplerRateValuesCoefficients.firstChildElement("r1").text().toDouble(); r2 = dopplerRateValuesCoefficients.firstChildElement("r2").text().toDouble(); r3 = dopplerRateValuesCoefficients.firstChildElement("r3").text().toDouble(); r4 = dopplerRateValuesCoefficients.firstChildElement("r4").text().toDouble(); - DEM = xml.firstChildElement("root").firstChildElement("DEM").text().toDouble(); + DEM = processinfo.firstChildElement("DEM").text().toDouble(); - qDebug() << "\nAdditional Data:"; - qDebug() << "AzFdc0:" << AzFdc0; - qDebug() << "AzFdc1:" << AzFdc1; - qDebug() << "Sensor ID:" << sensorID; - qDebug() << "Imaging Mode:" << imagingMode; - qDebug() << "Lambda:" << lamda; - qDebug() << "Radar Center Frequency:" << RadarCenterFrequency; - qDebug() << "Total Processed Azimuth Band Width:" << TotalProcessedAzimuthBandWidth; - qDebug() << "Doppler Parameters Reference Time:" << DopplerParametersReferenceTime; - qDebug() << "Doppler Centroid Coefficients: d0=" << d0 << ", d1=" << d1 << ", d2=" << d2 << ", d3=" << d3 << ", d4=" << d4; - qDebug() << "Doppler Rate Values Coefficients: r0=" << r0 << ", r1=" << r1 << ", r2=" << r2 << ", r3=" << r3 << ", r4=" << r4; - qDebug() << "DEM:" << DEM; + qDebug() << u8"\nAdditional Data:"; + qDebug() << u8"AzFdc0:" << AzFdc0; + qDebug() << u8"AzFdc1:" << AzFdc1; + qDebug() << u8"Sensor ID:" << sensorID; + qDebug() << u8"Imaging Mode:" << imagingMode; + qDebug() << u8"Lambda:" << lamda; + qDebug() << u8"Radar Center Frequency:" << RadarCenterFrequency; + qDebug() << u8"Total Processed Azimuth Band Width:" << TotalProcessedAzimuthBandWidth; + qDebug() << u8"Doppler Parameters Reference Time:" << DopplerParametersReferenceTime; + qDebug() << u8"Doppler Centroid Coefficients: d0=" << d0 << ", d1=" << d1 << ", d2=" << d2 << ", d3=" << d3 << ", d4=" << d4; + qDebug() << u8"Doppler Rate Values Coefficients: r0=" << r0 << ", r1=" << r1 << ", r2=" << r2 << ", r3=" << r3 << ", r4=" << r4; + qDebug() << u8"DEM:" << DEM; } From d45b3975608e479fb07cc387fc8d4784779777b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=A2=9E=E8=BE=89?= <3045316072@qq.com> Date: Fri, 18 Apr 2025 16:38:06 +0800 Subject: [PATCH 40/44] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E5=A4=9A=E6=99=AE?= =?UTF-8?q?=E5=8B=92=E8=AE=A1=E7=AE=97=E5=85=AC=E5=BC=8F=EF=BC=88=E5=8E=BB?= =?UTF-8?q?=E6=8E=89=E5=9C=B0=E9=80=9F=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BaseTool/SARSimulationImageL1.cpp | 17 +- .../BaseTool/SARSimulationImageL1.h | 2 + BaseCommonLibrary/ImageOperatorFuntion.cpp | 89 +++++------ Toolbox/BaseToolbox/BaseToolbox.vcxproj | 1 + .../GF3CalibrationAndGeocodingClass.cpp | 147 ++++++++++++------ .../BaseToolbox/QOrthSlrRaster.cpp | 8 +- 6 files changed, 163 insertions(+), 101 deletions(-) diff --git a/BaseCommonLibrary/BaseTool/SARSimulationImageL1.cpp b/BaseCommonLibrary/BaseTool/SARSimulationImageL1.cpp index 8bc4245..2fbfbb8 100644 --- a/BaseCommonLibrary/BaseTool/SARSimulationImageL1.cpp +++ b/BaseCommonLibrary/BaseTool/SARSimulationImageL1.cpp @@ -251,6 +251,7 @@ void SARSimulationImageL1Dataset::saveToXml() xmlWriter.writeTextElement("Rref", QString::number(this->Rref, 'e', 18)); xmlWriter.writeTextElement("CenterFreq", QString::number(this->centerFreq, 'e', 18)); xmlWriter.writeTextElement("Fs", QString::number(this->Fs, 'e', 18)); + xmlWriter.writeTextElement("PRF", QString::number(this->prf, 'e', 18)); xmlWriter.writeTextElement("CenterAngle", QString::number(this->CenterAngle, 'e', 18)); xmlWriter.writeTextElement("LookSide", this->LookSide); @@ -371,6 +372,9 @@ ErrorCode SARSimulationImageL1Dataset::loadFromXml() else if (xmlReader.name() == "Fs") { this->Fs = xmlReader.readElementText().toDouble(); } + else if (xmlReader.name() == "PRF") { + this->prf = xmlReader.readElementText().toDouble(); + } else if(xmlReader.name() == "ImageStartTime"){ this->startImageTime = xmlReader.readElementText().toDouble(); } @@ -873,6 +877,7 @@ QVector SARSimulationImageL1Dataset::getDopplerParams() result[2] = d2; result[3] = d3; result[4] = d4; + return result; } @@ -888,11 +893,13 @@ void SARSimulationImageL1Dataset::setDopplerParams(double id0, double id1, doubl QVector SARSimulationImageL1Dataset::getDopplerCenterCoff() { QVector result(5); - result[0]=r0; - result[1]=r1; - result[2]=r2; - result[3]=r3; - result[4]=r4; + result[0] = r0; + result[1] = r1; + result[2] = r2; + result[3] = r3; + result[4] = r4; + + return result; } diff --git a/BaseCommonLibrary/BaseTool/SARSimulationImageL1.h b/BaseCommonLibrary/BaseTool/SARSimulationImageL1.h index 3d85682..6d8325a 100644 --- a/BaseCommonLibrary/BaseTool/SARSimulationImageL1.h +++ b/BaseCommonLibrary/BaseTool/SARSimulationImageL1.h @@ -143,9 +143,11 @@ public: double getDopplerParametersReferenceTime(); void setDopplerParametersReferenceTime(double v); + // 多普勒参数 QVector getDopplerParams(); void setDopplerParams(double d0, double d1, double d2, double d3, double d4); + // 多普勒中心系数 QVector getDopplerCenterCoff(); void setDopplerCenterCoff(double r0, double r1, double r2, double r3, double r4); diff --git a/BaseCommonLibrary/ImageOperatorFuntion.cpp b/BaseCommonLibrary/ImageOperatorFuntion.cpp index ae75a14..a7ec078 100644 --- a/BaseCommonLibrary/ImageOperatorFuntion.cpp +++ b/BaseCommonLibrary/ImageOperatorFuntion.cpp @@ -633,8 +633,10 @@ void cropRasterByLatLon(const char* inputFile, const char* outputFile, double mi qDebug() << "Raster cropped and saved to: " << outputFile; // 娓呯悊 - GDALClose(poDataset); - GDALClose(poOutDataset); + + GDALClose((GDALDatasetH)(GDALDatasetH)poDataset); + GDALClose((GDALDatasetH)(GDALDatasetH)poOutDataset); + GDALDestroy(); // or, DllMain at DLL_PROCESS_DETACH } ErrorCode transformCoordinate(double x, double y, int sourceEPSG, int targetEPSG, Point2& p) { @@ -763,8 +765,8 @@ void resampleRaster(const char* inputRaster, const char* outputRaster, double ta int nYSize = poDataset->GetRasterYSize(); // 璁$畻鐩爣鏍呮牸鐨勫昂瀵 - double targetXSize = (adfGeoTransform[1] * nXSize) / targetPixelSizeX; - double targetYSize = std::abs((adfGeoTransform[5] * nYSize) / targetPixelSizeY); + double targetXSize = ceil((adfGeoTransform[1] * nXSize) / targetPixelSizeX); + double targetYSize = ceil(std::abs((adfGeoTransform[5] * nYSize) / targetPixelSizeY)); // 鍒涘缓鐩爣鏁版嵁闆嗭紙杈撳嚭鏍呮牸锛 GDALDriver* poDriver = GetGDALDriverManager()->GetDriverByName("GTiff"); @@ -774,38 +776,13 @@ void resampleRaster(const char* inputRaster, const char* outputRaster, double ta return; } - // 鍒涘缓杈撳嚭鏁版嵁闆 - GDALDataset* poOutDataset = poDriver->Create(outputRaster, (int)targetXSize, (int)targetYSize, poDataset->GetRasterCount(), GDT_Float32, nullptr); - if (poOutDataset == nullptr) { - qDebug() << "Failed to create output raster." ; - GDALClose(poDataset); - return; - } - // 璁剧疆杈撳嚭鏁版嵁闆嗙殑鍦扮悊鍙樻崲锛堝潗鏍囩郴锛 double targetGeoTransform[6] = { adfGeoTransform[0], targetPixelSizeX, 0, adfGeoTransform[3], 0, -targetPixelSizeY }; - poOutDataset->SetGeoTransform(targetGeoTransform); - - // 璁剧疆杈撳嚭鏁版嵁闆嗙殑鎶曞奖淇℃伅 - poOutDataset->SetProjection(poDataset->GetProjectionRef()); - - // 杩涜閲嶉噰鏍 - for (int i = 0; i < poDataset->GetRasterCount(); i++) { - GDALRasterBand* poBand = poDataset->GetRasterBand(i + 1); - GDALRasterBand* poOutBand = poOutDataset->GetRasterBand(i + 1); - - // 浣跨敤GDAL鐨勯噸閲囨牱鏂规硶锛岄夋嫨涓涓傚綋鐨勯噸閲囨牱鏂瑰紡 - poOutBand->RasterIO(GF_Write, 0, 0, (int)targetXSize, (int)targetYSize, - nullptr, (int)targetXSize, (int)targetYSize, - poBand->GetRasterDataType(), 0, 0, nullptr); - } - - // 鍏抽棴鏁版嵁闆 - GDALClose(poDataset); - GDALClose(poOutDataset); - + GDALClose((GDALDatasetH)(GDALDatasetH)poDataset); + GDALDestroy(); // or, DllMain at DLL_PROCESS_DETACH + ResampleGDAL(inputRaster, outputRaster, targetGeoTransform, targetXSize, targetYSize,GRA_Bilinear); qDebug() << "Resampling completed."; } @@ -1438,23 +1415,30 @@ void clipRaster(QString inRasterPath, QString outRasterPath, long minRow, long m ErrorCode DEM2XYZRasterAndSlopRaster(QString dempath, QString demxyzpath, QString demsloperPath) { - gdalImage demds(dempath); - gdalImage demxyz = CreategdalImage(demxyzpath, demds.height, demds.width, 3, demds.gt, demds.projection, true, true);// X,Y,Z + QString DEMPath = dempath; + QString XYZPath = demxyzpath; + QString SLOPERPath = demsloperPath; + + + + gdalImage demds(DEMPath); + gdalImage demxyz = CreategdalImageDouble(XYZPath, demds.height, demds.width, 3, demds.gt, demds.projection, true, true, false);// X,Y,Z // 鍒嗗潡璁$畻骞惰浆鎹负XYZ - Eigen::MatrixXd demArr = demds.getData(0, 0, demds.height, demds.width, 1); - Eigen::MatrixXd demR = demArr; - Landpoint LandP{ 0,0,0 }; - Point3 GERpoint{ 0,0,0 }; + //Eigen::MatrixXd demArr = demds.getData(0, 0, demds.height, demds.width, 1); + //Eigen::MatrixXd demR = demArr; + double R = 0; double dem_row = 0, dem_col = 0, dem_alt = 0; - long line_invert = 1000; + long line_invert = Memory1MB / 8.0 / demds.width * 1000; + + - double rowidx = 0; - double colidx = 0; for (int max_rows_ids = 0; max_rows_ids < demds.height; max_rows_ids = max_rows_ids + line_invert) { + + Eigen::MatrixXd demdata = demds.getData(max_rows_ids, 0, line_invert, demds.width, 1); Eigen::MatrixXd xyzdata_x = demdata.array() * 0; Eigen::MatrixXd xyzdata_y = demdata.array() * 0; @@ -1463,7 +1447,12 @@ ErrorCode DEM2XYZRasterAndSlopRaster(QString dempath, QString demxyzpath, QStri int datarows = demdata.rows(); int datacols = demdata.cols(); +#pragma omp parallel for for (int i = 0; i < datarows; i++) { + Landpoint LandP{ 0,0,0 }; + Point3 GERpoint{ 0,0,0 }; + double rowidx = 0; + double colidx = 0; for (int j = 0; j < datacols; j++) { rowidx = i + max_rows_ids; colidx = j; @@ -1477,19 +1466,23 @@ ErrorCode DEM2XYZRasterAndSlopRaster(QString dempath, QString demxyzpath, QStri demxyz.saveImage(xyzdata_x, max_rows_ids, 0, 1); demxyz.saveImage(xyzdata_y, max_rows_ids, 0, 2); demxyz.saveImage(xyzdata_z, max_rows_ids, 0, 3); + } // 璁$畻鍧″悜瑙 - gdalImage demsloperxyz = CreategdalImage(demsloperPath, demds.height, demds.width, 4, demds.gt, demds.projection, true, true);// X,Y,Z,cosangle + + + + gdalImage demsloperxyz = CreategdalImageDouble(SLOPERPath, demds.height, demds.width, 4, demds.gt, demds.projection, true, true, false);// X,Y,Z,cosangle line_invert = 1000; long start_ids = 0; long dem_rows = 0, dem_cols = 0; - for (start_ids = 1; start_ids < demds.height; start_ids = start_ids + line_invert) { Eigen::MatrixXd demdata = demds.getData(start_ids - 1, 0, line_invert + 2, demxyz.width, 1); long startlineid = start_ids; + Eigen::MatrixXd demsloper_x = demsloperxyz.getData(start_ids - 1, 0, line_invert + 2, demxyz.width, 1); Eigen::MatrixXd demsloper_y = demsloperxyz.getData(start_ids - 1, 0, line_invert + 2, demxyz.width, 2); Eigen::MatrixXd demsloper_z = demsloperxyz.getData(start_ids - 1, 0, line_invert + 2, demxyz.width, 3); @@ -1498,13 +1491,13 @@ ErrorCode DEM2XYZRasterAndSlopRaster(QString dempath, QString demxyzpath, QStri Landpoint p0, p1, p2, p3, p4, pslopeVector, pp; Vector3D slopeVector; - dem_rows = demsloper_y.rows(); - dem_cols = demsloper_y.cols(); + 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 for (long i = 1; i < dem_rows - 1; i++) { for (long j = 1; j < dem_cols - 1; j++) { rowidx = i + startlineid; @@ -1527,15 +1520,19 @@ ErrorCode DEM2XYZRasterAndSlopRaster(QString dempath, QString demxyzpath, QStri demsloper_y(i, j) = slopeVector.y; demsloper_z(i, j) = slopeVector.z; demsloper_angle(i, j) = sloperAngle; + } } + demsloperxyz.saveImage(demsloper_x, start_ids - 1, 0, 1); demsloperxyz.saveImage(demsloper_y, start_ids - 1, 0, 2); demsloperxyz.saveImage(demsloper_z, start_ids - 1, 0, 3); demsloperxyz.saveImage(demsloper_angle, start_ids - 1, 0, 4); + } + return ErrorCode::SUCCESS; } diff --git a/Toolbox/BaseToolbox/BaseToolbox.vcxproj b/Toolbox/BaseToolbox/BaseToolbox.vcxproj index 699771e..7fe5c9a 100644 --- a/Toolbox/BaseToolbox/BaseToolbox.vcxproj +++ b/Toolbox/BaseToolbox/BaseToolbox.vcxproj @@ -122,6 +122,7 @@ true stdcpp14 stdc11 + Disabled diff --git a/Toolbox/BaseToolbox/BaseToolbox/GF3CalibrationAndGeocodingClass.cpp b/Toolbox/BaseToolbox/BaseToolbox/GF3CalibrationAndGeocodingClass.cpp index dc3c8f9..a78cae3 100644 --- a/Toolbox/BaseToolbox/BaseToolbox/GF3CalibrationAndGeocodingClass.cpp +++ b/Toolbox/BaseToolbox/BaseToolbox/GF3CalibrationAndGeocodingClass.cpp @@ -212,7 +212,7 @@ ErrorCode ImportGF3L1AProcess(QString inMetaxmlPath, QString outWorkDirPath) ErrorCode RD_PSTN(double& refrange, double& lamda, double& timeR, double& R, double& tx, double& ty, double& tz, double& slopex, double& slopey, double& slopez, GF3PolyfitSatelliteOribtModel& polyfitmodel, SatelliteOribtNode& node, double& d0, double& d1, double& d2, double& d3, double& d4) { - double dt = 1e-6; + double dt = 1e-4; double inct = 0; bool antfalg = false; double timeR2 = 0; @@ -231,21 +231,21 @@ 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) * (((node.Px - tx) * (node.Vx + EARTHWE * ty) + (node.Py - ty) * (node.Vy - EARTHWE * tz) + (node.Pz - tz) * (node.Vz - 0)) / R1); - dplerR = (R1 - refrange) * 1e6 / LIGHTSPEED; + dplerTheory1 = (-2 / lamda / R1) * ((node.Px - tx) * (node.Vx /*+ EARTHWE * ty*/) + (node.Py - ty) * (node.Vy /*- EARTHWE * tz*/) + (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) * (((node.Px - tx) * (node.Vx + EARTHWE * ty) + (node.Py - ty) * (node.Vy - EARTHWE * tz) + (node.Pz - tz) * (node.Vz - 0)) / R2); - dplerR = (R2 - refrange) * 1e6 / LIGHTSPEED; - dplerNumber2 = d0 + dplerR * d1 + std::pow(dplerR, 2) * d2 + std::pow(dplerR, 3) * d3 + std::pow(dplerR, 4) * d4; - - inct = dt * (dplerTheory2 - dplerNumber1) / (dplerTheory1 - dplerTheory2); - if (std::abs(dplerTheory1 - dplerTheory2) < 1e-9 || std::abs(inct) < dt) { + dplerTheory2 = (-2 / lamda/R2) * ((node.Px - tx) * (node.Vx/* + EARTHWE * ty*/) + (node.Py - ty) * (node.Vy /*- EARTHWE * tz*/) + (node.Pz - tz) * (node.Vz - 0)); + + + inct = (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; timeR = timeR - inct; } R = R1; // 斜距 @@ -265,7 +265,7 @@ ErrorCode GF3RDCreateLookTable(QString inxmlPath, QString indemPath, QString out gdalImage rasterRC = CreategdalImage(outlooktablePath, demxyz.height, demxyz.width, 2, demxyz.gt, demxyz.projection, true, true);// X,Y,Z gdalImage localincangleRaster; if (localincAngleFlag) { - localincangleRaster = CreategdalImage(outLocalIncidenceAnglePath, demxyz.height, demxyz.width, 2, demxyz.gt, demxyz.projection, true, true);// X,Y,Z + localincangleRaster = CreategdalImage(outLocalIncidenceAnglePath, demxyz.height, demxyz.width, 1, demxyz.gt, demxyz.projection, true, true);// X,Y,Z } @@ -279,28 +279,48 @@ ErrorCode GF3RDCreateLookTable(QString inxmlPath, QString indemPath, QString out double d3 = dopplers[3]; double d4 = dopplers[4]; - double fs = l1dataset.getFs();// Fs采样 - double prf = (l1dataset.getEndImageTime() - l1dataset.getStartImageTime()) / (l1dataset.getrowCount() - 1);// PRF 采样 + double fs = l1dataset.getFs()*1e6;// Fs采样 + double prf = l1dataset.getPRF();// PRF 采样 double nearRange = l1dataset.getNearRange(); double imagestarttime = l1dataset.getStartImageTime(); + double imageendtime = l1dataset.getEndImageTime(); double refrange = l1dataset.getRefRange(); - double lamda = (LIGHTSPEED*1e-6)/ l1dataset.getCenterFreq(); + double lamda = (LIGHTSPEED*1.0e-9)/ l1dataset.getCenterFreq(); + // 打印参数 + qDebug() << "Fs:\t" << fs; + qDebug() << "prf:\t" << prf; + qDebug() << "nearRange:\t" << nearRange; + qDebug() << "imagestarttime:\t" << imagestarttime; + qDebug() << "imageendtime:\t" << imageendtime; + qDebug() << "refrange:\t" << refrange; + qDebug() << "lamda:\t" << lamda; + //打印多普累参数 + qDebug() << u8"-----------------------------------"; + qDebug() << u8"多普勒参数:\n"; + qDebug() << u8"d0:\t" << d0; + qDebug() << u8"d1:\t" << d1; + qDebug() << u8"d2:\t" << d2; + qDebug() << u8"d3:\t" << d3; + qDebug() << u8"d4:\t" << d4; + qDebug() << u8"-----------------------------------"; // 构建轨道模型 GF3PolyfitSatelliteOribtModel polyfitmodel; QVector < SatelliteAntPos > antposes = l1dataset.getXmlSateAntPos(); - polyfitmodel.setSatelliteOribtStartTime(imagestarttime); + polyfitmodel.setSatelliteOribtStartTime((imagestarttime+imageendtime)/2); for (long i = 0; i < antposes.size(); i++) { - SatelliteOribtNode node; - node.time = antposes[i].time; - node.Px = antposes[i].Px; - node.Py = antposes[i].Py; - node.Pz = antposes[i].Pz; - node.Vx = antposes[i].Vx; - node.Vy = antposes[i].Vy; - node.Vz = antposes[i].Vz; - polyfitmodel.addOribtNode(node); + if (antposes[i].time > imagestarttime - 5 && antposes[i].time < imageendtime + 5) { + SatelliteOribtNode node; + node.time = antposes[i].time; + node.Px = antposes[i].Px; + node.Py = antposes[i].Py; + node.Pz = antposes[i].Pz; + node.Vx = antposes[i].Vx; + node.Vy = antposes[i].Vy; + node.Vz = antposes[i].Vz; + polyfitmodel.addOribtNode(node); + } } polyfitmodel.polyFit(3, false); @@ -312,7 +332,7 @@ ErrorCode GF3RDCreateLookTable(QString inxmlPath, QString indemPath, QString out // 开始计算查找表 //1.计算分块 long cpucore_num = std::thread::hardware_concurrency(); - long blocklineinit = Memory1MB / 8 / cpucore_num / 4 / l1dataset.getcolCount() * 4000; + long blocklineinit = Memory1MB / 8 / cpucore_num / 4 / l1dataset.getcolCount() * 8000; blocklineinit = blocklineinit < 50 ? 50 : blocklineinit; //2.迭代计算 long colcount = rasterRC.width;//l1dataset.getcolCount(); @@ -333,7 +353,7 @@ ErrorCode GF3RDCreateLookTable(QString inxmlPath, QString indemPath, QString out -#pragma omp parallel for num_threads(cpucore_num-1) + for (startRId = 0; startRId < rowcount; startRId = startRId + blocklineinit) { long blockline = blocklineinit; if (startRId + blockline > rowcount) { @@ -345,25 +365,29 @@ ErrorCode GF3RDCreateLookTable(QString inxmlPath, QString indemPath, QString out Eigen::MatrixXd dem_y = demxyz.getData(startRId, 0, blockline, colcount, 2); Eigen::MatrixXd dem_z = demxyz.getData(startRId, 0, blockline, colcount, 3); - // 逐像素迭代计算 - double timeR = 0; + long blockrows = sar_r.rows(); long blockcols = sar_r.cols(); - double tx = 0; - double ty = 0; - double tz = 0; - double R = 0; - double slopex=0, slopey=0, slopez=0; - SatelliteOribtNode node{0,0,0,0,0,0,0,0}; - bool antflag = false; + +#pragma omp parallel for for (long i = 0; i < blockrows; i++) { + // 逐像素迭代计算 + double timeR = 0; + double tx = 0; + double ty = 0; + double tz = 0; + double R = 0; + double slopex = 0, slopey = 0, slopez = 0; + SatelliteOribtNode node{ 0,0,0,0,0,0,0,0 }; + bool antflag = false; for (long j = 0; j < blockcols; j++) { + tx = dem_x(i, j); ty = dem_y(i, j); tz = dem_z(i, j); if (RD_PSTN(refrange,lamda, timeR,R,tx,ty,tz,slopex,slopey,slopez,polyfitmodel,node,d0,d1,d2,d3,d4) == ErrorCode::SUCCESS) { - sar_r(i, j) = timeR * prf; - sar_c(i, j) = ((R - nearRange) / 2 / LIGHTSPEED) * fs; + sar_r(i, j) =( timeR+ (imagestarttime + imageendtime) / 2 -imagestarttime) * prf; + sar_c(i, j) = ((R - nearRange) * 2 / LIGHTSPEED) * fs; } else { sar_r(i, j) = -1; @@ -372,6 +396,14 @@ ErrorCode GF3RDCreateLookTable(QString inxmlPath, QString indemPath, QString out } } + // 保存结果 + omp_set_lock(&lock); + rasterRC.saveImage(sar_r, startRId, 0, 1); + rasterRC.saveImage(sar_c, startRId, 0, 2); + + omp_unset_lock(&lock); + + Eigen::MatrixXd Angle_Arr = Eigen::MatrixXd::Zero(dem_x.rows(),dem_x.cols()).array()+181; if (localincAngleFlag) { Eigen::MatrixXd demslope_x = demslope.getData(startRId, 0, blockline, colcount, 1); @@ -381,7 +413,20 @@ ErrorCode GF3RDCreateLookTable(QString inxmlPath, QString indemPath, QString out double Rst_x = 0, Rst_y = 0, Rst_z = 0, localangle = 0; double slopeR = 0; +#pragma omp parallel for for (long i = 0; i < blockrows; i++) { + // 逐像素迭代计算 + double timeR = 0; + double tx = 0; + double ty = 0; + double tz = 0; + double R = 0; + double slopex = 0, slopey = 0, slopez = 0; + SatelliteOribtNode node{ 0,0,0,0,0,0,0,0 }; + bool antflag = false; + + + for (long j = 0; j < blockcols; j++) { timeR = sar_r(i, j) / prf; slopex = demslope_x(i, j); @@ -402,16 +447,23 @@ ErrorCode GF3RDCreateLookTable(QString inxmlPath, QString indemPath, QString out Angle_Arr(i, j) = localangle; } } + + // 保存结果 + omp_set_lock(&lock); + + if (localincAngleFlag) { + localincangleRaster.saveImage(Angle_Arr, startRId, 0, 1); + } + else {} + + omp_unset_lock(&lock); + } + // 保存结果 omp_set_lock(&lock); - rasterRC.saveImage(sar_r, startRId, 0, 1); - rasterRC.saveImage(sar_c, startRId, 0, 2); - if (localincAngleFlag) { - localincangleRaster.saveImage(Angle_Arr, startRId, 0, 1); - } - else {} + processNumber = processNumber + blockrows; qDebug() << u8"\rprocess bar:\t" << processNumber * 100.0 / rowcount << " % " << "\t\t\t"; if (progressDialog.maximum() <= processNumber) { @@ -431,7 +483,8 @@ ErrorCode GF3OrthSLC( QString inRasterPath, QString inlooktablePath, QString out gdalImage slcRaster(inRasterPath);// gdalImage looktableRaster(inlooktablePath);// - gdalImage outRaster(outRasterPath);// + gdalImage outRaster = CreategdalImage(outRasterPath, looktableRaster.height, looktableRaster.width, 1, looktableRaster.gt, looktableRaster.projection, true, true);// X,Y,Z + //gdalImage outRaster(outRasterPath);// if (outRaster.height != looktableRaster.height || outRaster.width != looktableRaster.width) { qDebug() << u8"look table size is not same as outRaster size"<< looktableRaster.height <<"!="< Date: Mon, 21 Apr 2025 09:56:53 +0800 Subject: [PATCH 41/44] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=86=20amp=20?= =?UTF-8?q?=E8=BD=ACdB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BaseTool/ImageOperatorBase.h | 3 ++ BaseCommonLibrary/ImageOperatorFuntion.cpp | 42 ++++++++++++++----- .../GF3CalibrationAndGeocodingClass.cpp | 15 ++++--- 3 files changed, 44 insertions(+), 16 deletions(-) diff --git a/BaseCommonLibrary/BaseTool/ImageOperatorBase.h b/BaseCommonLibrary/BaseTool/ImageOperatorBase.h index 9b52766..b16127d 100644 --- a/BaseCommonLibrary/BaseTool/ImageOperatorBase.h +++ b/BaseCommonLibrary/BaseTool/ImageOperatorBase.h @@ -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); diff --git a/BaseCommonLibrary/ImageOperatorFuntion.cpp b/BaseCommonLibrary/ImageOperatorFuntion.cpp index a7ec078..ee94390 100644 --- a/BaseCommonLibrary/ImageOperatorFuntion.cpp +++ b/BaseCommonLibrary/ImageOperatorFuntion.cpp @@ -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) diff --git a/Toolbox/BaseToolbox/BaseToolbox/GF3CalibrationAndGeocodingClass.cpp b/Toolbox/BaseToolbox/BaseToolbox/GF3CalibrationAndGeocodingClass.cpp index a78cae3..aadbd71 100644 --- a/Toolbox/BaseToolbox/BaseToolbox/GF3CalibrationAndGeocodingClass.cpp +++ b/Toolbox/BaseToolbox/BaseToolbox/GF3CalibrationAndGeocodingClass.cpp @@ -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; } From e7849cbdeb34c0fef58f72ed3f7f5c0f62b53a50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=A2=9E=E8=BE=89?= <3045316072@qq.com> Date: Mon, 21 Apr 2025 13:26:35 +0800 Subject: [PATCH 42/44] =?UTF-8?q?=E6=8B=86=E5=88=86=E4=BA=A7=E5=93=81?= =?UTF-8?q?=E4=BB=BF=E7=9C=9F=E7=BA=A7=E5=88=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- RasterProcessToolWidget/ToolBoxWidget.cpp | 32 ++ RasterProcessToolWidget/ToolBoxWidget.h | 2 + Toolbox/BaseToolbox/BaseToolbox.cpp | 14 + Toolbox/BaseToolbox/BaseToolbox.vcxproj | 2 + .../BaseToolbox/BaseToolbox.vcxproj.filters | 6 + .../SARSatalliteSimulationWorkflow.cpp | 90 ++++++ .../SARSatalliteSimulationWorkflow.h | 64 ++++ .../SimulationSARTool/SimulationSARTool.cpp | 8 + .../SimulationSARTool.vcxproj | 2 + .../SimulationSARTool.vcxproj.filters | 6 + ...nSARToolSARSatalliteSimulationWorkflow.cpp | 273 ++++++++++++++++++ ...ionSARToolSARSatalliteSimulationWorkflow.h | 109 +++++++ 12 files changed, 608 insertions(+) create mode 100644 Toolbox/BaseToolbox/SARSatalliteSimulationWorkflow.cpp create mode 100644 Toolbox/BaseToolbox/SARSatalliteSimulationWorkflow.h create mode 100644 Toolbox/SimulationSARTool/SimulationSARToolSARSatalliteSimulationWorkflow.cpp create mode 100644 Toolbox/SimulationSARTool/SimulationSARToolSARSatalliteSimulationWorkflow.h diff --git a/RasterProcessToolWidget/ToolBoxWidget.cpp b/RasterProcessToolWidget/ToolBoxWidget.cpp index 5bb44ae..86a5234 100644 --- a/RasterProcessToolWidget/ToolBoxWidget.cpp +++ b/RasterProcessToolWidget/ToolBoxWidget.cpp @@ -25,6 +25,7 @@ ToolBoxWidget::ToolBoxWidget(LAMPMainWidget::RasterMainWidget* mainWindows, QWid ui->setupUi(this); setContextMenuPolicy(Qt::CustomContextMenu); // 设置右键快捷菜单 QObject::connect(this, SIGNAL(addBoxToolItemSIGNAL(QToolAbstract*)), this, SLOT(addBoxToolItemSLOT(QToolAbstract*))); + QObject::connect(this, SIGNAL(addBoxToolItemInPathSIGNAL(QVector , QToolAbstract* )), this, SLOT(addBoxToolItemInPathSLOT(QVector, QToolAbstract * ))); } @@ -122,6 +123,37 @@ void ToolBoxWidget::addBoxToolItemSLOT(QToolAbstract* item) } +void ToolBoxWidget::addBoxToolItemInPathSLOT(QVector xnodepath, QToolAbstract* item) +{ + QString toolName = item->getToolName(); + + QTreeWidgetItem* parentItem = findOrCreateParentItem(xnodepath); + + // 检查该父项是否已经绑定了 toolButton + if (parentItem && ui->treeWidgetToolBox->itemWidget(parentItem, 0) == nullptr) { + + toollist.append(QToolboxTreeWidgetItem(ui->treeWidgetToolBox, parentItem, item)); + + + //QTreeWidgetItem* actionItem = new QTreeWidgetItem(parentItem); + //parentItem->addChild(actionItem); + //actionItem->setText(0,toolName); + //QIcon icon(QString::fromUtf8(":/ToolBoxWidget/toolicon")); + //QPushButton* button = new QPushButton(ui->treeWidgetToolBox); + //button->setIcon(icon); + //button->setText(toolName); + //button->setLayoutDirection(Qt::LeftToRight); + //button->setStyleSheet("QPushButton { text-align: left; }"); + //ui->treeWidgetToolBox->setItemWidget(actionItem, 0, button); + //connect(button, SIGNAL(clicked()), item, SLOT(excute())); + //item->setParent(ui->treeWidgetToolBox); + //qDebug() << "ToolButton bound to parent:" << actionItem->text(0); + } + else { + qDebug() << "ToolButton already bound to parent:" << parentItem->text(0); + } +} + // 根据路径查找或创建父项 QTreeWidgetItem* ToolBoxWidget::findOrCreateParentItem( QVector& path) { QTreeWidgetItem* currentItem = nullptr; diff --git a/RasterProcessToolWidget/ToolBoxWidget.h b/RasterProcessToolWidget/ToolBoxWidget.h index 39f7c48..fc84b7b 100644 --- a/RasterProcessToolWidget/ToolBoxWidget.h +++ b/RasterProcessToolWidget/ToolBoxWidget.h @@ -49,9 +49,11 @@ private: signals: void addBoxToolItemSIGNAL(QToolAbstract* item); + void addBoxToolItemInPathSIGNAL(QVector xnodepath, QToolAbstract* item); public slots: void addBoxToolItemSLOT(QToolAbstract* item); + void addBoxToolItemInPathSLOT(QVector xnodepath, QToolAbstract* item); QTreeWidgetItem* findOrCreateParentItem( QVector& path); QTreeWidgetItem* findOrCreateTopLevelItem( QString& name); QTreeWidgetItem* findChildItemByName(QTreeWidgetItem* parentItem, QString& name); diff --git a/Toolbox/BaseToolbox/BaseToolbox.cpp b/Toolbox/BaseToolbox/BaseToolbox.cpp index 8d35a95..22ed9c8 100644 --- a/Toolbox/BaseToolbox/BaseToolbox.cpp +++ b/Toolbox/BaseToolbox/BaseToolbox.cpp @@ -15,6 +15,8 @@ #include "QtCreateGPSPointsDialog.h" #include "RasterVRT2ENVIdataDialog.h" +#include "SARSatalliteSimulationWorkflow.h" // 大场景仿真 + GF3ImportDataToolButton::GF3ImportDataToolButton(QWidget* parent) :QToolAbstract(parent) { this->toolPath = QVector(0); @@ -117,6 +119,18 @@ void RegisterPreToolBox(LAMPMainWidget::RasterMainWidget* mainwindows, ToolBoxWi emit toolbox->addBoxToolItemSIGNAL(new QLookTableCorrectOffsetToolButton(toolbox)); emit toolbox->addBoxToolItemSIGNAL(new QCreateGPSPointsToolButton(toolbox)); emit toolbox->addBoxToolItemSIGNAL(new RasterVRT2ENVIdataDialogToolButton(toolbox)); + + + // 大场景仿真流程 +#ifdef __BASETOOLBOX__SARSATALLITESIMULATIONWORKFLOW__H__ + initBaseToolSARSateSimulationWorkflow(toolbox); +#endif // __BASETOOLBOX__SARSATALLITESIMULATIONWORKFLOW__H__ + + + + + + } QDEMResampleDialogToolButton::QDEMResampleDialogToolButton(QWidget* parent) diff --git a/Toolbox/BaseToolbox/BaseToolbox.vcxproj b/Toolbox/BaseToolbox/BaseToolbox.vcxproj index 7fe5c9a..1ace8fc 100644 --- a/Toolbox/BaseToolbox/BaseToolbox.vcxproj +++ b/Toolbox/BaseToolbox/BaseToolbox.vcxproj @@ -213,6 +213,8 @@ + + diff --git a/Toolbox/BaseToolbox/BaseToolbox.vcxproj.filters b/Toolbox/BaseToolbox/BaseToolbox.vcxproj.filters index 0eb5ad3..dbe0ff5 100644 --- a/Toolbox/BaseToolbox/BaseToolbox.vcxproj.filters +++ b/Toolbox/BaseToolbox/BaseToolbox.vcxproj.filters @@ -109,6 +109,9 @@ BaseToolbox + + Source Files + @@ -153,6 +156,9 @@ BaseToolbox + + Header Files + diff --git a/Toolbox/BaseToolbox/SARSatalliteSimulationWorkflow.cpp b/Toolbox/BaseToolbox/SARSatalliteSimulationWorkflow.cpp new file mode 100644 index 0000000..4abfdf5 --- /dev/null +++ b/Toolbox/BaseToolbox/SARSatalliteSimulationWorkflow.cpp @@ -0,0 +1,90 @@ +#include "SARSatalliteSimulationWorkflow.h" +#include "QtCreateGPSPointsDialog.h" +#include "QResampleRefrenceRaster.h" +#include "DEMLLA2XYZTool.h" + + +void initBaseToolSARSateSimulationWorkflow(ToolBoxWidget* toolbox) +{ + // 1. 两行根数生成轨道节点 + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"GF3B仿真流程"}, new TLE2SatePositionVelocityToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"GF3C仿真流程"}, new TLE2SatePositionVelocityToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"LT1A仿真流程"}, new TLE2SatePositionVelocityToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"LT1B仿真流程"}, new TLE2SatePositionVelocityToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"HJ2E仿真流程"}, new TLE2SatePositionVelocityToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"HJ2F仿真流程"}, new TLE2SatePositionVelocityToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"LT04仿真流程"}, new TLE2SatePositionVelocityToolButton(toolbox)); + + // 3. 对齐地类与地形影像 + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"GF3B仿真流程"}, new QAligendLandClsAndDEMToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"GF3C仿真流程"}, new QAligendLandClsAndDEMToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"LT1A仿真流程"}, new QAligendLandClsAndDEMToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"LT1B仿真流程"}, new QAligendLandClsAndDEMToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"HJ2E仿真流程"}, new QAligendLandClsAndDEMToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"HJ2F仿真流程"}, new QAligendLandClsAndDEMToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"LT04仿真流程"}, new QAligendLandClsAndDEMToolButton(toolbox)); + + + // 4. 计算地固坐标与坡面矢量影像 + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"GF3B仿真流程"}, new QDEMLLA2XYZSloperVectorToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"GF3C仿真流程"}, new QDEMLLA2XYZSloperVectorToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"LT1A仿真流程"}, new QDEMLLA2XYZSloperVectorToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"LT1B仿真流程"}, new QDEMLLA2XYZSloperVectorToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"HJ2E仿真流程"}, new QDEMLLA2XYZSloperVectorToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"HJ2F仿真流程"}, new QDEMLLA2XYZSloperVectorToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"LT04仿真流程"}, new QDEMLLA2XYZSloperVectorToolButton(toolbox)); + + + + + + +} + +TLE2SatePositionVelocityToolButton::TLE2SatePositionVelocityToolButton(QWidget* parent) +{ + this->toolname = QString(u8"1.两行根数生成轨道节点"); +} + +TLE2SatePositionVelocityToolButton::~TLE2SatePositionVelocityToolButton() +{ +} + +void TLE2SatePositionVelocityToolButton::run() +{ + QtCreateGPSPointsDialog* dialog = new QtCreateGPSPointsDialog; + dialog->setWindowTitle(u8"两行根数生成轨道节点"); + dialog->show(); +} + +QAligendLandClsAndDEMToolButton::QAligendLandClsAndDEMToolButton(QWidget* parent) +{ + this->toolname = QString(u8"3.对齐地类与地形影像"); +} + +QAligendLandClsAndDEMToolButton::~QAligendLandClsAndDEMToolButton() +{ +} + +void QAligendLandClsAndDEMToolButton::run() +{ + QResampleRefrenceRaster* dialog = new QResampleRefrenceRaster; + dialog->setWindowTitle(u8"对齐地类与地形(根据地形栅格重采样地类影像)"); + dialog->show(); +} + +QDEMLLA2XYZSloperVectorToolButton::QDEMLLA2XYZSloperVectorToolButton(QWidget* parent) +{ + this->toolname = QString(u8"4.地形生成地面目标坐标与坡面矢量"); +} + +QDEMLLA2XYZSloperVectorToolButton::~QDEMLLA2XYZSloperVectorToolButton() +{ +} + +void QDEMLLA2XYZSloperVectorToolButton::run() +{ + DEMLLA2XYZTool* dialog = new DEMLLA2XYZTool(); + dialog->setWindowTitle(u8"根据地形栅格生成地面目标坐标点与坡面矢量"); + dialog->show(); +} diff --git a/Toolbox/BaseToolbox/SARSatalliteSimulationWorkflow.h b/Toolbox/BaseToolbox/SARSatalliteSimulationWorkflow.h new file mode 100644 index 0000000..9f447b9 --- /dev/null +++ b/Toolbox/BaseToolbox/SARSatalliteSimulationWorkflow.h @@ -0,0 +1,64 @@ +#pragma once + + +#ifndef __BASETOOLBOX__SARSATALLITESIMULATIONWORKFLOW__H__ +#define __BASETOOLBOX__SARSATALLITESIMULATIONWORKFLOW__H__ + + +/** + * \file SARSatalliteSimulationWorkflow.h + * \brief 大场景仿真处理菜单处理 + * + * \author 30453 + * \date April 2025 + * + **/ +#include "basetoolbox_global.h" +#include "ToolBoxWidget.h" + + +extern "C" BASETOOLBOX_EXPORT void initBaseToolSARSateSimulationWorkflow(ToolBoxWidget* toolbox); + + + + +class BASETOOLBOX_EXPORT TLE2SatePositionVelocityToolButton : public QToolAbstract { + Q_OBJECT +public: + TLE2SatePositionVelocityToolButton(QWidget* parent = nullptr); + ~TLE2SatePositionVelocityToolButton(); +public: + virtual void run() override; + +}; + + + +class BASETOOLBOX_EXPORT QAligendLandClsAndDEMToolButton : public QToolAbstract { + Q_OBJECT +public: + QAligendLandClsAndDEMToolButton(QWidget* parent = nullptr); + ~QAligendLandClsAndDEMToolButton(); +public : + virtual void run() override; + +}; + +class BASETOOLBOX_EXPORT QDEMLLA2XYZSloperVectorToolButton : public QToolAbstract { + Q_OBJECT +public: + QDEMLLA2XYZSloperVectorToolButton(QWidget* parent = nullptr); + ~QDEMLLA2XYZSloperVectorToolButton(); +public: + virtual void run() override; + +}; + + + + + +#endif + + + diff --git a/Toolbox/SimulationSARTool/SimulationSARTool.cpp b/Toolbox/SimulationSARTool/SimulationSARTool.cpp index 438dd61..0065394 100644 --- a/Toolbox/SimulationSARTool/SimulationSARTool.cpp +++ b/Toolbox/SimulationSARTool/SimulationSARTool.cpp @@ -16,6 +16,7 @@ #include "QLonLatInterpAtiFromDEM.h" #include "QL1ASARProcessDialog.h" +#include "SimulationSARToolSARSatalliteSimulationWorkflow.h" void RegisterPreToolBox(LAMPMainWidget::RasterMainWidget* mainwindows, ToolBoxWidget* toolbox) { @@ -36,6 +37,13 @@ void RegisterPreToolBox(LAMPMainWidget::RasterMainWidget* mainwindows, ToolBoxWi emit toolbox->addBoxToolItemSIGNAL(new QLonLatInterpAtiFromDEMToolButton(toolbox)); emit toolbox->addBoxToolItemSIGNAL(new QL1ASARProcessDialogToolButton(toolbox)); +#ifdef __SIMULATIONSARTOOL__SARSATALLITESIMULATIONWORKFLOW__H__ + + initSimulationSARToolSARSateSimulationWorkflow(toolbox); +#endif + + + } diff --git a/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj b/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj index e4bdf9f..6c19a14 100644 --- a/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj +++ b/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj @@ -225,6 +225,7 @@ + @@ -260,6 +261,7 @@ + diff --git a/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj.filters b/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj.filters index e32b42e..20c001f 100644 --- a/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj.filters +++ b/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj.filters @@ -163,6 +163,9 @@ SARImage + + Source Files + @@ -278,6 +281,9 @@ SARImage + + Header Files + diff --git a/Toolbox/SimulationSARTool/SimulationSARToolSARSatalliteSimulationWorkflow.cpp b/Toolbox/SimulationSARTool/SimulationSARToolSARSatalliteSimulationWorkflow.cpp new file mode 100644 index 0000000..46cab17 --- /dev/null +++ b/Toolbox/SimulationSARTool/SimulationSARToolSARSatalliteSimulationWorkflow.cpp @@ -0,0 +1,273 @@ +#include "SimulationSARToolSARSatalliteSimulationWorkflow.h" +#include "QSimulationSARPolynomialOrbitModel.h" +#include "QtSimulationGeoSARSigma0Dialog.h" +#include +#include +#include +#include +#include +#include +#include + +SIMULATIONSARTOOL_EXPORT void initSimulationSARToolSARSateSimulationWorkflow(ToolBoxWidget* toolbox) +{ + // 2. 轨道节点模型拟合 + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"GF3B仿真流程"}, new QPolyfitSatelliteGPSModelToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"GF3C仿真流程"}, new QPolyfitSatelliteGPSModelToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"LT1A仿真流程"}, new QPolyfitSatelliteGPSModelToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"LT1B仿真流程"}, new QPolyfitSatelliteGPSModelToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"HJ2E仿真流程"}, new QPolyfitSatelliteGPSModelToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"HJ2F仿真流程"}, new QPolyfitSatelliteGPSModelToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"LT04仿真流程"}, new QPolyfitSatelliteGPSModelToolButton(toolbox)); + + + // 5. 基于DEM和分类信息的SAR图像模拟 + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"GF3B仿真流程",u8"基于DEM和分类信息的SAR图像模拟"}, new QGeneratorGeoSimulationRsaterToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"GF3C仿真流程",u8"基于DEM和分类信息的SAR图像模拟"}, new QGeneratorGeoSimulationRsaterToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"LT1A仿真流程",u8"基于DEM和分类信息的SAR图像模拟"}, new QGeneratorGeoSimulationRsaterToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"LT1B仿真流程",u8"基于DEM和分类信息的SAR图像模拟"}, new QGeneratorGeoSimulationRsaterToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"HJ2E仿真流程",u8"基于DEM和分类信息的SAR图像模拟"}, new QGeneratorGeoSimulationRsaterToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"HJ2F仿真流程",u8"基于DEM和分类信息的SAR图像模拟"}, new QGeneratorGeoSimulationRsaterToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"LT04仿真流程",u8"基于DEM和分类信息的SAR图像模拟"}, new QGeneratorGeoSimulationRsaterToolButton(toolbox)); + + + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"GF3B仿真流程", u8"基于DEM和分类信息的SAR图像模拟"}, new QGeneratorMapGeoAndSltLookTableToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"GF3C仿真流程", u8"基于DEM和分类信息的SAR图像模拟"}, new QGeneratorMapGeoAndSltLookTableToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"LT1A仿真流程", u8"基于DEM和分类信息的SAR图像模拟"}, new QGeneratorMapGeoAndSltLookTableToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"LT1B仿真流程", u8"基于DEM和分类信息的SAR图像模拟"}, new QGeneratorMapGeoAndSltLookTableToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"HJ2E仿真流程", u8"基于DEM和分类信息的SAR图像模拟"}, new QGeneratorMapGeoAndSltLookTableToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"HJ2F仿真流程", u8"基于DEM和分类信息的SAR图像模拟"}, new QGeneratorMapGeoAndSltLookTableToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"LT04仿真流程", u8"基于DEM和分类信息的SAR图像模拟"}, new QGeneratorMapGeoAndSltLookTableToolButton(toolbox)); + + + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"GF3B仿真流程", u8"基于DEM和分类信息的SAR图像模拟"}, new QSimulationSlrSARRasterToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"GF3C仿真流程", u8"基于DEM和分类信息的SAR图像模拟"}, new QSimulationSlrSARRasterToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"LT1A仿真流程", u8"基于DEM和分类信息的SAR图像模拟"}, new QSimulationSlrSARRasterToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"LT1B仿真流程", u8"基于DEM和分类信息的SAR图像模拟"}, new QSimulationSlrSARRasterToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"HJ2E仿真流程", u8"基于DEM和分类信息的SAR图像模拟"}, new QSimulationSlrSARRasterToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"HJ2F仿真流程", u8"基于DEM和分类信息的SAR图像模拟"}, new QSimulationSlrSARRasterToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"LT04仿真流程", u8"基于DEM和分类信息的SAR图像模拟"}, new QSimulationSlrSARRasterToolButton(toolbox)); + + + + + //6. 基于回波仿真成像 + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"GF3B仿真流程", u8"基于回波仿真成像"}, new QEchoDataSimulationSARRFPCToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"GF3C仿真流程", u8"基于回波仿真成像"}, new QEchoDataSimulationSARRFPCToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"LT1A仿真流程", u8"基于回波仿真成像"}, new QEchoDataSimulationSARRFPCToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"LT1B仿真流程", u8"基于回波仿真成像"}, new QEchoDataSimulationSARRFPCToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"HJ2E仿真流程", u8"基于回波仿真成像"}, new QEchoDataSimulationSARRFPCToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"HJ2F仿真流程", u8"基于回波仿真成像"}, new QEchoDataSimulationSARRFPCToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"LT04仿真流程", u8"基于回波仿真成像"}, new QEchoDataSimulationSARRFPCToolButton(toolbox)); + + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"GF3B仿真流程", u8"1~3级回波仿真"}, new QInSARImageNetGeneratorToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"GF3C仿真流程", u8"1~3级回波仿真"}, new QInSARImageNetGeneratorToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"LT1A仿真流程", u8"1~3级回波仿真"}, new QInSARImageNetGeneratorToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"LT1B仿真流程", u8"1~3级回波仿真"}, new QInSARImageNetGeneratorToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"HJ2E仿真流程", u8"1~3级回波仿真"}, new QInSARImageNetGeneratorToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"HJ2F仿真流程", u8"1~3级回波仿真"}, new QInSARImageNetGeneratorToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"LT04仿真流程", u8"1~3级回波仿真"}, new QInSARImageNetGeneratorToolButton(toolbox)); + + + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"GF3B仿真流程", u8"1~3级回波仿真"}, new QGeneratorMapGeoAndSltLookTableToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"GF3C仿真流程", u8"1~3级回波仿真"}, new QGeneratorMapGeoAndSltLookTableToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"LT1A仿真流程", u8"1~3级回波仿真"}, new QGeneratorMapGeoAndSltLookTableToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"LT1B仿真流程", u8"1~3级回波仿真"}, new QGeneratorMapGeoAndSltLookTableToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"HJ2E仿真流程", u8"1~3级回波仿真"}, new QGeneratorMapGeoAndSltLookTableToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"HJ2F仿真流程", u8"1~3级回波仿真"}, new QGeneratorMapGeoAndSltLookTableToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"LT04仿真流程", u8"1~3级回波仿真"}, new QGeneratorMapGeoAndSltLookTableToolButton(toolbox)); + + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"GF3B仿真流程", u8"1~3级回波仿真"}, new QMapLooktableToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"GF3C仿真流程", u8"1~3级回波仿真"}, new QMapLooktableToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"LT1A仿真流程", u8"1~3级回波仿真"}, new QMapLooktableToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"LT1B仿真流程", u8"1~3级回波仿真"}, new QMapLooktableToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"HJ2E仿真流程", u8"1~3级回波仿真"}, new QMapLooktableToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"HJ2F仿真流程", u8"1~3级回波仿真"}, new QMapLooktableToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"LT04仿真流程", u8"1~3级回波仿真"}, new QMapLooktableToolButton(toolbox)); + + + + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"GF3B仿真流程", u8"1~3级回波仿真"}, new QSimulationBPImageMultiProductionLevel1_2ToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"GF3C仿真流程", u8"1~3级回波仿真"}, new QSimulationBPImageMultiProductionLevel1_2ToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"LT1A仿真流程", u8"1~3级回波仿真"}, new QSimulationBPImageMultiProductionLevel1_2ToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"LT1B仿真流程", u8"1~3级回波仿真"}, new QSimulationBPImageMultiProductionLevel1_2ToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"HJ2E仿真流程", u8"1~3级回波仿真"}, new QSimulationBPImageMultiProductionLevel1_2ToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"HJ2F仿真流程", u8"1~3级回波仿真"}, new QSimulationBPImageMultiProductionLevel1_2ToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"LT04仿真流程", u8"1~3级回波仿真"}, new QSimulationBPImageMultiProductionLevel1_2ToolButton(toolbox)); + + + + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"GF3B仿真流程", u8"1~3级回波仿真"}, new QSimulationBPImageL1BToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"GF3C仿真流程", u8"1~3级回波仿真"}, new QSimulationBPImageL1BToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"LT1A仿真流程", u8"1~3级回波仿真"}, new QSimulationBPImageL1BToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"LT1B仿真流程", u8"1~3级回波仿真"}, new QSimulationBPImageL1BToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"HJ2E仿真流程", u8"1~3级回波仿真"}, new QSimulationBPImageL1BToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"HJ2F仿真流程", u8"1~3级回波仿真"}, new QSimulationBPImageL1BToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"LT04仿真流程", u8"1~3级回波仿真"}, new QSimulationBPImageL1BToolButton(toolbox)); + + + + + + + + + + + + + + + + + + + + + return ; +} + +QPolyfitSatelliteGPSModelToolButton::QPolyfitSatelliteGPSModelToolButton(QWidget* parent) +{ + this->toolname = QString(u8"2.根据轨道节点拟合轨道模型"); +} + +QPolyfitSatelliteGPSModelToolButton::~QPolyfitSatelliteGPSModelToolButton() +{ +} + +void QPolyfitSatelliteGPSModelToolButton::run() +{ + QSimulationPolynomialSAROrbitModel* dialog = new QSimulationPolynomialSAROrbitModel; + dialog->setWindowTitle(u8"根据轨道节点拟合轨道模型"); + dialog->show(); +} + +QGeneratorGeoSimulationRsaterToolButton::QGeneratorGeoSimulationRsaterToolButton(QWidget* parent) +{ + this->toolname = QString(u8"1.生成地距模拟影像"); +} + +QGeneratorGeoSimulationRsaterToolButton::~QGeneratorGeoSimulationRsaterToolButton() +{ +} + +void QGeneratorGeoSimulationRsaterToolButton::run() +{ + QtSimulationGeoSARSigma0Dialog* dialog = new QtSimulationGeoSARSigma0Dialog; + dialog->setWindowTitle(u8"生成地距模拟影像"); + dialog->show(); +} + +QGeneratorMapGeoAndSltLookTableToolButton::QGeneratorMapGeoAndSltLookTableToolButton(QWidget* parent) +{ + this->toolname = QString(u8"2.计算坐标映射表"); +} + +QGeneratorMapGeoAndSltLookTableToolButton::~QGeneratorMapGeoAndSltLookTableToolButton() +{ +} + +void QGeneratorMapGeoAndSltLookTableToolButton::run() +{ + QSimulationLookTableDialog* dialog = new QSimulationLookTableDialog; + dialog->setWindowTitle(u8"创建地距-斜距映射表"); + dialog->show(); +} + +QSimulationSlrSARRasterToolButton::QSimulationSlrSARRasterToolButton(QWidget* parent) +{ + this->toolname = QString(u8"3.生成斜距模拟影像"); +} + +QSimulationSlrSARRasterToolButton::~QSimulationSlrSARRasterToolButton() +{ +} + +void QSimulationSlrSARRasterToolButton::run() +{ + QCreateSARIntensityByLookTableDialog* dialog = new QCreateSARIntensityByLookTableDialog; + dialog->setWindowTitle(u8"生成斜距模拟影像"); + dialog->show(); +} + +QEchoDataSimulationSARRFPCToolButton::QEchoDataSimulationSARRFPCToolButton(QWidget* parent) +{ + this->toolname = QString(u8"1.距离频域脉冲相干法"); +} + +QEchoDataSimulationSARRFPCToolButton::~QEchoDataSimulationSARRFPCToolButton() +{ +} + +void QEchoDataSimulationSARRFPCToolButton::run() +{ + QImageSARRFPC* dialog = new QImageSARRFPC(); + dialog->setWindowTitle(u8"生成回波-距离频域脉冲相干法"); + dialog->show(); +} + +QInSARImageNetGeneratorToolButton::QInSARImageNetGeneratorToolButton(QWidget* parent) +{ + this->toolname = QString(u8"1.成像网格生成"); +} + +QInSARImageNetGeneratorToolButton::~QInSARImageNetGeneratorToolButton() +{ +} + +void QInSARImageNetGeneratorToolButton::run() +{ + QCreateInSARImagePlaneXYZRDialog* dialog = new QCreateInSARImagePlaneXYZRDialog; + dialog->setWindowTitle(u8"成像平面网格划分"); + dialog->show(); +} + +QMapLooktableToolButton::QMapLooktableToolButton(QWidget* parent) +{ + this->toolname = QString(u8"3.创建地理编码查找表"); +} + +QMapLooktableToolButton::~QMapLooktableToolButton() +{ +} + +void QMapLooktableToolButton::run() +{ + QLookTableResampleFromWGS84ToRange* dialog = new QLookTableResampleFromWGS84ToRange; + dialog->setWindowTitle(u8"创建地理编码双向查找表"); + dialog->show(); +} + +QSimulationBPImageMultiProductionLevel1_2ToolButton::QSimulationBPImageMultiProductionLevel1_2ToolButton(QWidget* parent) +{ + this->toolname = QString(u8"4. 生成1~2级产品"); +} + +QSimulationBPImageMultiProductionLevel1_2ToolButton::~QSimulationBPImageMultiProductionLevel1_2ToolButton() +{ +} + +void QSimulationBPImageMultiProductionLevel1_2ToolButton::run() +{ + QSimulationBPImageMultiProduction* dialog = new QSimulationBPImageMultiProduction; + dialog->setWindowTitle(u8"生成1~2级产品"); + dialog->show(); +} + +QSimulationBPImageL1BToolButton::QSimulationBPImageL1BToolButton(QWidget* parent) +{ + this->toolname = QString(u8"4. 生成L1B级产品"); + +} + +QSimulationBPImageL1BToolButton::~QSimulationBPImageL1BToolButton() +{ +} + +void QSimulationBPImageL1BToolButton::run() +{ + QL1ASARProcessDialog* dialog = new QL1ASARProcessDialog; + dialog->setWindowTitle(u8"生成L1B级产品"); + dialog->show(); +} diff --git a/Toolbox/SimulationSARTool/SimulationSARToolSARSatalliteSimulationWorkflow.h b/Toolbox/SimulationSARTool/SimulationSARToolSARSatalliteSimulationWorkflow.h new file mode 100644 index 0000000..c5893d9 --- /dev/null +++ b/Toolbox/SimulationSARTool/SimulationSARToolSARSatalliteSimulationWorkflow.h @@ -0,0 +1,109 @@ +#pragma once +#ifndef __SIMULATIONSARTOOL__SARSATALLITESIMULATIONWORKFLOW__H__ +#define __SIMULATIONSARTOOL__SARSATALLITESIMULATIONWORKFLOW__H__ +#include "simulationsartool_global.h" +#include +#include "ToolBoxWidget.h" +#include "QToolAbstract.h" + + +extern "C" SIMULATIONSARTOOL_EXPORT void initSimulationSARToolSARSateSimulationWorkflow(ToolBoxWidget* toolbox); + + + +class SIMULATIONSARTOOL_EXPORT QPolyfitSatelliteGPSModelToolButton : public QToolAbstract { + Q_OBJECT +public: + QPolyfitSatelliteGPSModelToolButton(QWidget* parent = nullptr); + ~QPolyfitSatelliteGPSModelToolButton(); +public: + virtual void run() override; + +}; + +class SIMULATIONSARTOOL_EXPORT QGeneratorGeoSimulationRsaterToolButton : public QToolAbstract { + Q_OBJECT +public: + QGeneratorGeoSimulationRsaterToolButton(QWidget* parent = nullptr); + ~QGeneratorGeoSimulationRsaterToolButton(); +public: + virtual void run() override; + +}; + +class SIMULATIONSARTOOL_EXPORT QGeneratorMapGeoAndSltLookTableToolButton : public QToolAbstract { + Q_OBJECT +public: + QGeneratorMapGeoAndSltLookTableToolButton(QWidget* parent = nullptr); + ~QGeneratorMapGeoAndSltLookTableToolButton(); +public: + virtual void run() override; + +}; + +class SIMULATIONSARTOOL_EXPORT QSimulationSlrSARRasterToolButton : public QToolAbstract { + Q_OBJECT +public: + QSimulationSlrSARRasterToolButton(QWidget* parent = nullptr); + ~QSimulationSlrSARRasterToolButton(); +public: + virtual void run() override; + +}; + + + + +class SIMULATIONSARTOOL_EXPORT QEchoDataSimulationSARRFPCToolButton : public QToolAbstract { + Q_OBJECT +public: + QEchoDataSimulationSARRFPCToolButton(QWidget* parent = nullptr); + ~QEchoDataSimulationSARRFPCToolButton(); +public: + virtual void run() override; + +}; + + +class SIMULATIONSARTOOL_EXPORT QInSARImageNetGeneratorToolButton : public QToolAbstract { + Q_OBJECT +public: + QInSARImageNetGeneratorToolButton(QWidget* parent = nullptr); + ~QInSARImageNetGeneratorToolButton(); +public: + virtual void run() override; + +}; + +class SIMULATIONSARTOOL_EXPORT QMapLooktableToolButton : public QToolAbstract { + Q_OBJECT +public: + QMapLooktableToolButton(QWidget* parent = nullptr); + ~QMapLooktableToolButton(); +public: + virtual void run() override; + +}; + +class SIMULATIONSARTOOL_EXPORT QSimulationBPImageMultiProductionLevel1_2ToolButton : public QToolAbstract { + Q_OBJECT +public: + QSimulationBPImageMultiProductionLevel1_2ToolButton(QWidget* parent = nullptr); + ~QSimulationBPImageMultiProductionLevel1_2ToolButton(); +public: + virtual void run() override; + +}; + +class SIMULATIONSARTOOL_EXPORT QSimulationBPImageL1BToolButton : public QToolAbstract { + Q_OBJECT +public: + QSimulationBPImageL1BToolButton(QWidget* parent = nullptr); + ~QSimulationBPImageL1BToolButton(); +public: + virtual void run() override; + +}; + + +#endif From 1bb5b168c1d3ba368f0904ffeae8dcd942beee0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=A2=9E=E8=BE=89?= <3045316072@qq.com> Date: Mon, 21 Apr 2025 14:51:40 +0800 Subject: [PATCH 43/44] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E5=B7=A5?= =?UTF-8?q?=E5=85=B7=E7=AE=B1=E5=8A=A0=E8=BD=BD=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LAMPDataProcess.sln | 28 +++--- RasterProcessToolWidget/ToolBoxWidget.cpp | 12 ++- .../SARSatalliteSimulationWorkflow.cpp | 6 +- ...nSARToolSARSatalliteSimulationWorkflow.cpp | 90 ++++++++----------- 4 files changed, 64 insertions(+), 72 deletions(-) diff --git a/LAMPDataProcess.sln b/LAMPDataProcess.sln index 1f54f80..0559e59 100644 --- a/LAMPDataProcess.sln +++ b/LAMPDataProcess.sln @@ -38,10 +38,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RasterMainWidgetGUI", "Rast EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ImageshowTool", "ImageshowTool\ImageshowTool.vcxproj", "{8C8CA066-A93A-4098-9A46-B855EFEAADF2}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SPG4Tool", "SPG4Tool\SPG4Tool.vcxproj", "{80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pluginToolboxLibrary", "pluginToolboxLibrary\pluginToolboxLibrary.vcxproj", "{667625A5-8DE2-4373-99F0-8BAD2CCED011}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SPG4Tool", "SPG4Tool\SPG4Tool.vcxproj", "{80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|ARM = Debug|ARM @@ -172,18 +172,6 @@ Global {8C8CA066-A93A-4098-9A46-B855EFEAADF2}.Release|x64.Build.0 = Release|x64 {8C8CA066-A93A-4098-9A46-B855EFEAADF2}.Release|x86.ActiveCfg = Release|x64 {8C8CA066-A93A-4098-9A46-B855EFEAADF2}.Release|x86.Build.0 = Release|x64 - {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Debug|ARM.ActiveCfg = Debug|x64 - {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Debug|ARM.Build.0 = Debug|x64 - {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Debug|x64.ActiveCfg = Debug|x64 - {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Debug|x64.Build.0 = Debug|x64 - {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Debug|x86.ActiveCfg = Debug|x64 - {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Debug|x86.Build.0 = Debug|x64 - {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Release|ARM.ActiveCfg = Release|x64 - {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Release|ARM.Build.0 = Release|x64 - {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Release|x64.ActiveCfg = Release|x64 - {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Release|x64.Build.0 = Release|x64 - {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Release|x86.ActiveCfg = Release|x64 - {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Release|x86.Build.0 = Release|x64 {667625A5-8DE2-4373-99F0-8BAD2CCED011}.Debug|ARM.ActiveCfg = Debug|x64 {667625A5-8DE2-4373-99F0-8BAD2CCED011}.Debug|ARM.Build.0 = Debug|x64 {667625A5-8DE2-4373-99F0-8BAD2CCED011}.Debug|x64.ActiveCfg = Debug|x64 @@ -196,6 +184,18 @@ Global {667625A5-8DE2-4373-99F0-8BAD2CCED011}.Release|x64.Build.0 = Release|x64 {667625A5-8DE2-4373-99F0-8BAD2CCED011}.Release|x86.ActiveCfg = Release|Win32 {667625A5-8DE2-4373-99F0-8BAD2CCED011}.Release|x86.Build.0 = Release|Win32 + {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Debug|ARM.ActiveCfg = Debug|x64 + {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Debug|ARM.Build.0 = Debug|x64 + {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Debug|x64.ActiveCfg = Debug|x64 + {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Debug|x64.Build.0 = Debug|x64 + {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Debug|x86.ActiveCfg = Debug|x64 + {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Debug|x86.Build.0 = Debug|x64 + {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Release|ARM.ActiveCfg = Release|x64 + {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Release|ARM.Build.0 = Release|x64 + {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Release|x64.ActiveCfg = Release|x64 + {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Release|x64.Build.0 = Release|x64 + {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Release|x86.ActiveCfg = Release|x64 + {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Release|x86.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/RasterProcessToolWidget/ToolBoxWidget.cpp b/RasterProcessToolWidget/ToolBoxWidget.cpp index 86a5234..d0a9ae4 100644 --- a/RasterProcessToolWidget/ToolBoxWidget.cpp +++ b/RasterProcessToolWidget/ToolBoxWidget.cpp @@ -203,7 +203,17 @@ QTreeWidgetItem* ToolBoxWidget::findChildItemByName(QTreeWidgetItem* parentItem, return childItem; } } - return nullptr; + + + // 如果没有找到,创建新的顶级节点 + QTreeWidgetItem* newItem = new QTreeWidgetItem(parentItem); + QIcon icon(QString::fromUtf8(":/RasterProcessTool/toolboxIcon")); + newItem->setIcon(0, icon); + newItem->setTextAlignment(0, Qt::AlignLeft); + newItem->setText(0, name); + parentItem->addChild(newItem); + return newItem; + // return nullptr; } void ToolBoxWidget::OpenToolboxManagerWidget() diff --git a/Toolbox/BaseToolbox/SARSatalliteSimulationWorkflow.cpp b/Toolbox/BaseToolbox/SARSatalliteSimulationWorkflow.cpp index 4abfdf5..a7d7db9 100644 --- a/Toolbox/BaseToolbox/SARSatalliteSimulationWorkflow.cpp +++ b/Toolbox/BaseToolbox/SARSatalliteSimulationWorkflow.cpp @@ -43,7 +43,7 @@ void initBaseToolSARSateSimulationWorkflow(ToolBoxWidget* toolbox) TLE2SatePositionVelocityToolButton::TLE2SatePositionVelocityToolButton(QWidget* parent) { - this->toolname = QString(u8"1.两行根数生成轨道节点"); + this->toolname = QString(u8" 两行根数生成轨道节点"); } TLE2SatePositionVelocityToolButton::~TLE2SatePositionVelocityToolButton() @@ -59,7 +59,7 @@ void TLE2SatePositionVelocityToolButton::run() QAligendLandClsAndDEMToolButton::QAligendLandClsAndDEMToolButton(QWidget* parent) { - this->toolname = QString(u8"3.对齐地类与地形影像"); + this->toolname = QString(u8" 对齐地类与地形影像"); } QAligendLandClsAndDEMToolButton::~QAligendLandClsAndDEMToolButton() @@ -75,7 +75,7 @@ void QAligendLandClsAndDEMToolButton::run() QDEMLLA2XYZSloperVectorToolButton::QDEMLLA2XYZSloperVectorToolButton(QWidget* parent) { - this->toolname = QString(u8"4.地形生成地面目标坐标与坡面矢量"); + this->toolname = QString(u8" 地形生成地面目标坐标与坡面矢量"); } QDEMLLA2XYZSloperVectorToolButton::~QDEMLLA2XYZSloperVectorToolButton() diff --git a/Toolbox/SimulationSARTool/SimulationSARToolSARSatalliteSimulationWorkflow.cpp b/Toolbox/SimulationSARTool/SimulationSARToolSARSatalliteSimulationWorkflow.cpp index 46cab17..b926a8a 100644 --- a/Toolbox/SimulationSARTool/SimulationSARToolSARSatalliteSimulationWorkflow.cpp +++ b/Toolbox/SimulationSARTool/SimulationSARToolSARSatalliteSimulationWorkflow.cpp @@ -60,76 +60,58 @@ SIMULATIONSARTOOL_EXPORT void initSimulationSARToolSARSateSimulationWorkflow(Too emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"HJ2F仿真流程", u8"基于回波仿真成像"}, new QEchoDataSimulationSARRFPCToolButton(toolbox)); emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"LT04仿真流程", u8"基于回波仿真成像"}, new QEchoDataSimulationSARRFPCToolButton(toolbox)); - emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"GF3B仿真流程", u8"1~3级回波仿真"}, new QInSARImageNetGeneratorToolButton(toolbox)); - emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"GF3C仿真流程", u8"1~3级回波仿真"}, new QInSARImageNetGeneratorToolButton(toolbox)); - emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"LT1A仿真流程", u8"1~3级回波仿真"}, new QInSARImageNetGeneratorToolButton(toolbox)); - emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"LT1B仿真流程", u8"1~3级回波仿真"}, new QInSARImageNetGeneratorToolButton(toolbox)); - emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"HJ2E仿真流程", u8"1~3级回波仿真"}, new QInSARImageNetGeneratorToolButton(toolbox)); - emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"HJ2F仿真流程", u8"1~3级回波仿真"}, new QInSARImageNetGeneratorToolButton(toolbox)); - emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"LT04仿真流程", u8"1~3级回波仿真"}, new QInSARImageNetGeneratorToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"GF3B仿真流程", u8"基于回波仿真成像"}, new QInSARImageNetGeneratorToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"GF3C仿真流程", u8"基于回波仿真成像"}, new QInSARImageNetGeneratorToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"LT1A仿真流程", u8"基于回波仿真成像"}, new QInSARImageNetGeneratorToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"LT1B仿真流程", u8"基于回波仿真成像"}, new QInSARImageNetGeneratorToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"HJ2E仿真流程", u8"基于回波仿真成像"}, new QInSARImageNetGeneratorToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"HJ2F仿真流程", u8"基于回波仿真成像"}, new QInSARImageNetGeneratorToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"LT04仿真流程", u8"基于回波仿真成像"}, new QInSARImageNetGeneratorToolButton(toolbox)); - emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"GF3B仿真流程", u8"1~3级回波仿真"}, new QGeneratorMapGeoAndSltLookTableToolButton(toolbox)); - emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"GF3C仿真流程", u8"1~3级回波仿真"}, new QGeneratorMapGeoAndSltLookTableToolButton(toolbox)); - emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"LT1A仿真流程", u8"1~3级回波仿真"}, new QGeneratorMapGeoAndSltLookTableToolButton(toolbox)); - emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"LT1B仿真流程", u8"1~3级回波仿真"}, new QGeneratorMapGeoAndSltLookTableToolButton(toolbox)); - emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"HJ2E仿真流程", u8"1~3级回波仿真"}, new QGeneratorMapGeoAndSltLookTableToolButton(toolbox)); - emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"HJ2F仿真流程", u8"1~3级回波仿真"}, new QGeneratorMapGeoAndSltLookTableToolButton(toolbox)); - emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"LT04仿真流程", u8"1~3级回波仿真"}, new QGeneratorMapGeoAndSltLookTableToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"GF3B仿真流程",u8"基于回波仿真成像"}, new QGeneratorMapGeoAndSltLookTableToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"GF3C仿真流程",u8"基于回波仿真成像"}, new QGeneratorMapGeoAndSltLookTableToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"LT1A仿真流程",u8"基于回波仿真成像"}, new QGeneratorMapGeoAndSltLookTableToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"LT1B仿真流程",u8"基于回波仿真成像"}, new QGeneratorMapGeoAndSltLookTableToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"HJ2E仿真流程",u8"基于回波仿真成像"}, new QGeneratorMapGeoAndSltLookTableToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"HJ2F仿真流程",u8"基于回波仿真成像"}, new QGeneratorMapGeoAndSltLookTableToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"LT04仿真流程",u8"基于回波仿真成像"}, new QGeneratorMapGeoAndSltLookTableToolButton(toolbox)); - emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"GF3B仿真流程", u8"1~3级回波仿真"}, new QMapLooktableToolButton(toolbox)); - emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"GF3C仿真流程", u8"1~3级回波仿真"}, new QMapLooktableToolButton(toolbox)); - emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"LT1A仿真流程", u8"1~3级回波仿真"}, new QMapLooktableToolButton(toolbox)); - emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"LT1B仿真流程", u8"1~3级回波仿真"}, new QMapLooktableToolButton(toolbox)); - emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"HJ2E仿真流程", u8"1~3级回波仿真"}, new QMapLooktableToolButton(toolbox)); - emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"HJ2F仿真流程", u8"1~3级回波仿真"}, new QMapLooktableToolButton(toolbox)); - emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"LT04仿真流程", u8"1~3级回波仿真"}, new QMapLooktableToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"GF3B仿真流程", u8"基于回波仿真成像"}, new QMapLooktableToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"GF3C仿真流程", u8"基于回波仿真成像"}, new QMapLooktableToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"LT1A仿真流程", u8"基于回波仿真成像"}, new QMapLooktableToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"LT1B仿真流程", u8"基于回波仿真成像"}, new QMapLooktableToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"HJ2E仿真流程", u8"基于回波仿真成像"}, new QMapLooktableToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"HJ2F仿真流程", u8"基于回波仿真成像"}, new QMapLooktableToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"LT04仿真流程", u8"基于回波仿真成像"}, new QMapLooktableToolButton(toolbox)); - emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"GF3B仿真流程", u8"1~3级回波仿真"}, new QSimulationBPImageMultiProductionLevel1_2ToolButton(toolbox)); - emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"GF3C仿真流程", u8"1~3级回波仿真"}, new QSimulationBPImageMultiProductionLevel1_2ToolButton(toolbox)); - emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"LT1A仿真流程", u8"1~3级回波仿真"}, new QSimulationBPImageMultiProductionLevel1_2ToolButton(toolbox)); - emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"LT1B仿真流程", u8"1~3级回波仿真"}, new QSimulationBPImageMultiProductionLevel1_2ToolButton(toolbox)); - emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"HJ2E仿真流程", u8"1~3级回波仿真"}, new QSimulationBPImageMultiProductionLevel1_2ToolButton(toolbox)); - emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"HJ2F仿真流程", u8"1~3级回波仿真"}, new QSimulationBPImageMultiProductionLevel1_2ToolButton(toolbox)); - emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"LT04仿真流程", u8"1~3级回波仿真"}, new QSimulationBPImageMultiProductionLevel1_2ToolButton(toolbox)); - - - - emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"GF3B仿真流程", u8"1~3级回波仿真"}, new QSimulationBPImageL1BToolButton(toolbox)); - emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"GF3C仿真流程", u8"1~3级回波仿真"}, new QSimulationBPImageL1BToolButton(toolbox)); - emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"LT1A仿真流程", u8"1~3级回波仿真"}, new QSimulationBPImageL1BToolButton(toolbox)); - emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"LT1B仿真流程", u8"1~3级回波仿真"}, new QSimulationBPImageL1BToolButton(toolbox)); - emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"HJ2E仿真流程", u8"1~3级回波仿真"}, new QSimulationBPImageL1BToolButton(toolbox)); - emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"HJ2F仿真流程", u8"1~3级回波仿真"}, new QSimulationBPImageL1BToolButton(toolbox)); - emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"LT04仿真流程", u8"1~3级回波仿真"}, new QSimulationBPImageL1BToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"GF3B仿真流程", u8"基于回波仿真成像"}, new QSimulationBPImageMultiProductionLevel1_2ToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"GF3C仿真流程", u8"基于回波仿真成像"}, new QSimulationBPImageMultiProductionLevel1_2ToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"LT1A仿真流程", u8"基于回波仿真成像"}, new QSimulationBPImageMultiProductionLevel1_2ToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"LT1B仿真流程", u8"基于回波仿真成像"}, new QSimulationBPImageMultiProductionLevel1_2ToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"HJ2E仿真流程", u8"基于回波仿真成像"}, new QSimulationBPImageMultiProductionLevel1_2ToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"HJ2F仿真流程", u8"基于回波仿真成像"}, new QSimulationBPImageMultiProductionLevel1_2ToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"LT04仿真流程", u8"基于回波仿真成像"}, new QSimulationBPImageMultiProductionLevel1_2ToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"GF3B仿真流程", u8"基于回波仿真成像"}, new QSimulationBPImageL1BToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"GF3C仿真流程", u8"基于回波仿真成像"}, new QSimulationBPImageL1BToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"LT1A仿真流程", u8"基于回波仿真成像"}, new QSimulationBPImageL1BToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"LT1B仿真流程", u8"基于回波仿真成像"}, new QSimulationBPImageL1BToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"HJ2E仿真流程", u8"基于回波仿真成像"}, new QSimulationBPImageL1BToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"HJ2F仿真流程", u8"基于回波仿真成像"}, new QSimulationBPImageL1BToolButton(toolbox)); + emit toolbox->addBoxToolItemInPathSIGNAL(QVector{u8"大场景仿真流程", u8"LT04仿真流程", u8"基于回波仿真成像"}, new QSimulationBPImageL1BToolButton(toolbox)); - - - - - - - - - - - - - - - return ; } QPolyfitSatelliteGPSModelToolButton::QPolyfitSatelliteGPSModelToolButton(QWidget* parent) { - this->toolname = QString(u8"2.根据轨道节点拟合轨道模型"); + this->toolname = QString(u8"根据轨道节点拟合轨道模型"); } QPolyfitSatelliteGPSModelToolButton::~QPolyfitSatelliteGPSModelToolButton() From 104cb24f486b996eb52150955d20861fc32c0fe9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=A2=9E=E8=BE=89?= <3045316072@qq.com> Date: Mon, 21 Apr 2025 15:03:58 +0800 Subject: [PATCH 44/44] =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=BA=86=E7=95=8C?= =?UTF-8?q?=E9=9D=A2=E8=AE=BE=E8=AE=A1=EF=BC=8C=E4=B8=BA=E5=A4=A7=E5=9C=BA?= =?UTF-8?q?=E6=99=AF=E5=B7=A5=E5=85=B7=E7=AE=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../RasterMainWidget/RasterMainWidget.cpp | 10 +- .../RasterMainWidget/RasterMainWidget.ui | 184 ++++++++---------- 2 files changed, 92 insertions(+), 102 deletions(-) diff --git a/RasterMainWidgetGUI/RasterMainWidget/RasterMainWidget.cpp b/RasterMainWidgetGUI/RasterMainWidget/RasterMainWidget.cpp index d985f06..2cebd5e 100644 --- a/RasterMainWidgetGUI/RasterMainWidget/RasterMainWidget.cpp +++ b/RasterMainWidgetGUI/RasterMainWidget/RasterMainWidget.cpp @@ -46,7 +46,7 @@ RasterMainWidget::RasterMainWidget(QWidget *parent) mLayerList(), mLeftTop(), mRightBottom() { - this->setWindowTitle(tr(u8"LAMP褰卞儚澶勭悊杞欢")); + this->setWindowTitle(tr(u8"澶у満鏅豢鐪熺粍浠")); mUi->setupUi(dynamic_cast(this)); setupWindow(); setupTaskWindow(); @@ -61,6 +61,14 @@ RasterMainWidget::RasterMainWidget(QWidget *parent) connect(mUi->actioncloseAllRasterFile, SIGNAL(triggered()), this, SLOT(onactioncloseAllRasterFile_triggered())); + this->mUi->toolBar->hide(); + this->mUi->dockWidget_Map->hide(); + this->mUi->dockWidget->hide(); + this->mUi->statusbar->hide(); + this->mUi->dockWidget_2->hide(); + this->mUi->dockWidget_3->hide(); + + } RasterMainWidget::~RasterMainWidget() { diff --git a/RasterMainWidgetGUI/RasterMainWidget/RasterMainWidget.ui b/RasterMainWidgetGUI/RasterMainWidget/RasterMainWidget.ui index 2a2bc0c..e317cec 100644 --- a/RasterMainWidgetGUI/RasterMainWidget/RasterMainWidget.ui +++ b/RasterMainWidgetGUI/RasterMainWidget/RasterMainWidget.ui @@ -31,112 +31,15 @@ - - - - - - 0 - 0 - - - - 0 - - - - 鍦板浘 - - - - - - - - - - 浠诲姟 - - - - - 0 - 0 - 1431 - 871 - - - - - - - - - - - - + - - - - 0 - 0 - 906 - 22 - - - - - 椤圭洰 - - - - - 缂栬緫 - - - - - 瑙嗗浘 - - - - - 鍥惧眰 - - - - - 璁剧疆 - - - - - 宸ュ叿 - - - - - - 甯姪 - - - - - - - - - - - - - + + false + toolBar @@ -378,6 +281,85 @@ p, li { white-space: pre-wrap; } + + + Qt::LeftToRight + + + 鍦板浘绐楀彛 + + + 1 + + + + + + 10 + 0 + 502 + 274 + + + + + 0 + 0 + + + + 0 + + + + 鍦板浘 + + + + + + + + + + 浠诲姟 + + + + + 0 + 0 + 1431 + 871 + + + + + + + + + + + + + + + + 0 + 0 + 906 + 23 + + + + + 宸ュ叿 + + + + + 浣跨敤鏁欑▼