同步修改
parent
47c56eab3c
commit
6463cd4ccd
|
|
@ -32,29 +32,31 @@ __global__ void kernel_TimeBPImageGridNet(double* antPx, double* antPy, double*
|
||||||
long Rid = idx % freqpoints;
|
long Rid = idx % freqpoints;
|
||||||
if (idx < pixelcount) {
|
if (idx < pixelcount) {
|
||||||
// 计算坐标
|
// 计算坐标
|
||||||
|
|
||||||
Vector3 S = { antPx[prfid], antPy[prfid], antPz[prfid] }; // 卫星位置 (m)
|
Vector3 S = { antPx[prfid], antPy[prfid], antPz[prfid] }; // 卫星位置 (m)
|
||||||
Vector3 ray = { antDirx[prfid], antDiry[prfid], antDirz[prfid] }; // 视线方向
|
Vector3 ray = { antDirx[prfid], antDiry[prfid], antDirz[prfid] }; // 视线方向
|
||||||
double H = meanH; // 平均高程
|
double H = meanH; // 平均高程
|
||||||
double R = Rnear+ dx*Rid; // 目标距离
|
double R = Rnear + dx * Rid; // Ä¿±ê¾àÀë
|
||||||
|
|
||||||
// 参数校验
|
// 参数校验
|
||||||
if (R <= 0 || H < -WGS84_A * 0.1 || H > WGS84_A * 0.1) {
|
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);
|
//printf("参数错误:\n H范围:±%.1f km\n R必须>0\n", WGS84_A * 0.1 / 1000);
|
||||||
imgx[idx] = 1.0/0;
|
imgx[idx] = 1.0 / 0;
|
||||||
imgy[idx] = 1.0/0;
|
imgy[idx] = 1.0 / 0;
|
||||||
imgz[idx] = 1.0/0;
|
imgz[idx] = 1.0 / 0;
|
||||||
|
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",
|
||||||
return ;
|
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
|
// Step 1: 计算交点T
|
||||||
Vector3 T = compute_T(S, ray, H);
|
Vector3 T = compute_T(S, ray, H);
|
||||||
if (isnan(T.x)) {
|
if (isnan(T.x)) {
|
||||||
imgx[idx] = 1.0/0;
|
imgx[idx] = 1.0 / 0;
|
||||||
imgy[idx] = 1.0/0;
|
imgy[idx] = 1.0 / 0;
|
||||||
imgz[idx] = 1.0/0;
|
imgz[idx] = 1.0 / 0;
|
||||||
return ;
|
printf("idx=%d;prfid=%d;Rid=%d;S=[%f , %f ,%f ];ray=[%f ,%f ,%f ];H=%f;R=%f;imgT=[%f ,%f ,%f ];imgP=[%f ,%f , %f ];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
|
// Step 2: 计算目标点P
|
||||||
|
|
@ -65,12 +67,15 @@ __global__ void kernel_TimeBPImageGridNet(double* antPx, double* antPy, double*
|
||||||
imgx[idx] = P.x;
|
imgx[idx] = P.x;
|
||||||
imgy[idx] = P.y;
|
imgy[idx] = P.y;
|
||||||
imgz[idx] = P.z;
|
imgz[idx] = P.z;
|
||||||
|
printf("idx=%d;prfid=%d;Rid=%d;S=[%f , %f ,%f ];ray=[%f ,%f ,%f ];H=%f;R=%f;imgT=[%f ,%f ,%f ];imgP=[%f ,%f , %f ]; \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]);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
imgx[idx] = 1.0/0;
|
imgx[idx] = 1.0 / 0;
|
||||||
imgy[idx] = 1.0/0;
|
imgy[idx] = 1.0 / 0;
|
||||||
imgz[idx] = 1.0/0;
|
imgz[idx] = 1.0 / 0;
|
||||||
|
printf("idx=%d;prfid=%d;Rid=%d;S=[%f , %f ,%f ];ray=[%f ,%f ,%f ];H=%f;R=%f;imgT=[%f ,%f ,%f ];imgP=[%f ,%f , %f ];Pnan\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]);
|
||||||
//printf("未找到有效解\n");
|
//printf("未找到有效解\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -82,9 +82,9 @@ void CreatePixelXYZ(std::shared_ptr<EchoL0Dataset> echoL0ds, QString outPixelXYZ
|
||||||
HostToDevice(Pxs.get(), d_Pxs.get(), sizeof(double) * prfcount);
|
HostToDevice(Pxs.get(), d_Pxs.get(), sizeof(double) * prfcount);
|
||||||
HostToDevice(Pys.get(), d_Pys.get(), sizeof(double) * prfcount);
|
HostToDevice(Pys.get(), d_Pys.get(), sizeof(double) * prfcount);
|
||||||
HostToDevice(Pzs.get(), d_Pzs.get(), sizeof(double) * prfcount);
|
HostToDevice(Pzs.get(), d_Pzs.get(), sizeof(double) * prfcount);
|
||||||
HostToDevice(d_AntDirectX.get(), d_AntDirectX.get(), sizeof(double) * prfcount);
|
HostToDevice(AntDirectX.get(), d_AntDirectX.get(), sizeof(double) * prfcount);
|
||||||
HostToDevice(d_AntDirectY.get(), d_AntDirectY.get(), sizeof(double) * prfcount);
|
HostToDevice(AntDirectY.get(), d_AntDirectY.get(), sizeof(double) * prfcount);
|
||||||
HostToDevice(d_AntDirectZ.get(), d_AntDirectZ.get(), sizeof(double) * prfcount);
|
HostToDevice(AntDirectZ.get(), d_AntDirectZ.get(), sizeof(double) * prfcount);
|
||||||
|
|
||||||
|
|
||||||
for (long startcolidx = 0; startcolidx < freqcount; startcolidx = startcolidx + echocol) {
|
for (long startcolidx = 0; startcolidx < freqcount; startcolidx = startcolidx + echocol) {
|
||||||
|
|
@ -162,6 +162,7 @@ void TBPImageProcess(QString echofile, QString outImageFolder, QString imagePlan
|
||||||
imagL1->setFarRange(echoL0ds->getFarRange());
|
imagL1->setFarRange(echoL0ds->getFarRange());
|
||||||
imagL1->setFs(echoL0ds->getFs());
|
imagL1->setFs(echoL0ds->getFs());
|
||||||
imagL1->setLookSide(echoL0ds->getLookSide());
|
imagL1->setLookSide(echoL0ds->getLookSide());
|
||||||
|
|
||||||
imagL1->OpenOrNew(outImageFolder, echoL0ds->getSimulationTaskName(), echoL0ds->getPluseCount(), echoL0ds->getPlusePoints());
|
imagL1->OpenOrNew(outImageFolder, echoL0ds->getSimulationTaskName(), echoL0ds->getPluseCount(), echoL0ds->getPlusePoints());
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -249,13 +250,14 @@ ErrorCode TBPImageAlgCls::Process(long num_thread)
|
||||||
|
|
||||||
qDebug() << u8"频域回波-> 时域回波 结束";
|
qDebug() << u8"频域回波-> 时域回波 结束";
|
||||||
|
|
||||||
if (GPURUN) {
|
//if (GPURUN) {
|
||||||
return this->ProcessGPU();
|
// return this->ProcessGPU();
|
||||||
}
|
//}
|
||||||
else {
|
//else {
|
||||||
QMessageBox::information(nullptr,u8"Ìáʾ",u8"Ŀǰֻ֧³ÖÏÔ¿¨");
|
// QMessageBox::information(nullptr,u8"Ìáʾ",u8"Ŀǰֻ֧³ÖÏÔ¿¨");
|
||||||
return ErrorCode::FAIL;
|
// return ErrorCode::FAIL;
|
||||||
}
|
//}
|
||||||
|
return ErrorCode::SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorCode TBPImageAlgCls::ProcessGPU()
|
ErrorCode TBPImageAlgCls::ProcessGPU()
|
||||||
|
|
@ -353,6 +355,7 @@ ErrorCode TBPImageAlgCls::ProcessGPU()
|
||||||
imageBlockline = imageBlockline < 1 ? 1 : imageBlockline;
|
imageBlockline = imageBlockline < 1 ? 1 : imageBlockline;
|
||||||
|
|
||||||
gdalImage imageXYZ(this->outRasterXYZPath);
|
gdalImage imageXYZ(this->outRasterXYZPath);
|
||||||
|
gdalImageComplex imagetimeimg(this->TimeEchoDataPath);
|
||||||
|
|
||||||
long startimgrowid = 0;
|
long startimgrowid = 0;
|
||||||
for (startimgrowid = 0; startimgrowid < rowCount; startimgrowid = startimgrowid + imageBlockline) {
|
for (startimgrowid = 0; startimgrowid < rowCount; startimgrowid = startimgrowid + imageBlockline) {
|
||||||
|
|
@ -370,13 +373,15 @@ ErrorCode TBPImageAlgCls::ProcessGPU()
|
||||||
std::shared_ptr<std::complex<double>> imgArr = this->L1ds->getImageRaster(startimgrowid, tempimgBlockline);
|
std::shared_ptr<std::complex<double>> imgArr = this->L1ds->getImageRaster(startimgrowid, tempimgBlockline);
|
||||||
// 获取回波
|
// 获取回波
|
||||||
long startechoid = 0;
|
long startechoid = 0;
|
||||||
|
long iffeechoLen = PlusePoints;
|
||||||
for (long startechoid = 0; startechoid < PRFCount; startechoid = startechoid + echoBlockline) {
|
for (long startechoid = 0; startechoid < PRFCount; startechoid = startechoid + echoBlockline) {
|
||||||
|
|
||||||
long tempechoBlockline = echoBlockline;
|
long tempechoBlockline = echoBlockline;
|
||||||
if (startechoid + tempechoBlockline >= PRFCount) {
|
if (startechoid + tempechoBlockline >= PRFCount) {
|
||||||
tempechoBlockline = PRFCount - startechoid;
|
tempechoBlockline = PRFCount - startechoid;
|
||||||
}
|
}
|
||||||
std::shared_ptr<std::complex<double>> echoArr = this->L0ds->getEchoArr(startechoid, tempechoBlockline);
|
std::shared_ptr<std::complex<double>> echoArr =
|
||||||
|
readDataArrComplex < std::complex<double>>(imagetimeimg,startechoid,long(0), tempechoBlockline, iffeechoLen, 1, GDALREADARRCOPYMETHOD::VARIABLEMETHOD);//; this->L0ds->getEchoArr(startechoid, tempechoBlockline);
|
||||||
std::shared_ptr<double> antpx(new double[tempechoBlockline],delArrPtr);
|
std::shared_ptr<double> antpx(new double[tempechoBlockline],delArrPtr);
|
||||||
std::shared_ptr<double> antpy(new double[tempechoBlockline], delArrPtr);
|
std::shared_ptr<double> antpy(new double[tempechoBlockline], delArrPtr);
|
||||||
std::shared_ptr<double> antpz(new double[tempechoBlockline], delArrPtr);
|
std::shared_ptr<double> antpz(new double[tempechoBlockline], delArrPtr);
|
||||||
|
|
@ -413,7 +418,7 @@ void TBPImageAlgCls::EchoFreqToTime( )
|
||||||
|
|
||||||
long PRFCount = this->L0ds->getPluseCount();
|
long PRFCount = this->L0ds->getPluseCount();
|
||||||
long inColCount = this->L0ds->getPlusePoints();
|
long inColCount = this->L0ds->getPlusePoints();
|
||||||
long outColCount = nextpow2(inColCount);
|
long outColCount = inColCount;// nextpow2(inColCount);
|
||||||
this->TimeEchoRowCount = PRFCount;
|
this->TimeEchoRowCount = PRFCount;
|
||||||
this->TimeEchoColCount = outColCount;
|
this->TimeEchoColCount = outColCount;
|
||||||
qDebug() << "IFFT : " << this->TimeEchoDataPath;
|
qDebug() << "IFFT : " << this->TimeEchoDataPath;
|
||||||
|
|
@ -483,10 +488,6 @@ void TBPImageAlgCls::EchoFreqToTime( )
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void TBPImageGPUAlg2(std::shared_ptr<double> antPx, std::shared_ptr<double> antPy, std::shared_ptr<double> antPz,
|
void TBPImageGPUAlg2(std::shared_ptr<double> antPx, std::shared_ptr<double> antPy, std::shared_ptr<double> antPz,
|
||||||
std::shared_ptr<double> img_x, std::shared_ptr<double> img_y, std::shared_ptr<double> img_z,
|
std::shared_ptr<double> img_x, std::shared_ptr<double> img_y, std::shared_ptr<double> img_z,
|
||||||
std::shared_ptr<std::complex<double>> echoArr,
|
std::shared_ptr<std::complex<double>> echoArr,
|
||||||
|
|
@ -500,8 +501,8 @@ void TBPImageGPUAlg2(std::shared_ptr<double> antPx, std::shared_ptr<double> antP
|
||||||
long IFFTPadNum = nextpow2(freqcount);
|
long IFFTPadNum = nextpow2(freqcount);
|
||||||
// 先处理脉冲傅里叶变换
|
// 先处理脉冲傅里叶变换
|
||||||
cuComplex* h_echoArr = (cuComplex*)mallocCUDAHost(sizeof(cuComplex) * prfcount * freqcount);
|
cuComplex* h_echoArr = (cuComplex*)mallocCUDAHost(sizeof(cuComplex) * prfcount * freqcount);
|
||||||
cuComplex* d_echoArr = (cuComplex*)mallocCUDADevice(sizeof(cuComplex) * prfcount * freqcount);
|
//cuComplex* d_echoArr = (cuComplex*)mallocCUDADevice(sizeof(cuComplex) * prfcount * freqcount);
|
||||||
std::shared_ptr<cuComplex> d_echoArrIFFT((cuComplex*)mallocCUDADevice(sizeof(cuComplex) * prfcount * IFFTPadNum), FreeCUDADevice);
|
std::shared_ptr<cuComplex> d_echoArrIFFT((cuComplex*)mallocCUDADevice(sizeof(cuComplex) * prfcount * freqcount), FreeCUDADevice);
|
||||||
|
|
||||||
// 回波赋值
|
// 回波赋值
|
||||||
for (long i = 0; i < prfcount; i++) {
|
for (long i = 0; i < prfcount; i++) {
|
||||||
|
|
@ -510,11 +511,10 @@ void TBPImageGPUAlg2(std::shared_ptr<double> antPx, std::shared_ptr<double> antP
|
||||||
echoArr.get()[i * freqcount + j].imag());
|
echoArr.get()[i * freqcount + j].imag());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
HostToDevice(h_echoArr, d_echoArr, sizeof(cuComplex) * prfcount * freqcount);
|
HostToDevice(h_echoArr, d_echoArrIFFT.get(), sizeof(cuComplex) * prfcount * freqcount);
|
||||||
CUDAIFFT(d_echoArr, d_echoArrIFFT.get(), prfcount, freqcount, IFFTPadNum);
|
|
||||||
// 结束傅里叶变换
|
// 结束傅里叶变换
|
||||||
FreeCUDAHost(h_echoArr);
|
FreeCUDAHost(h_echoArr);
|
||||||
FreeCUDADevice(d_echoArr);
|
//FreeCUDADevice(d_echoArr);
|
||||||
|
|
||||||
qDebug() << "IFFT finished!!!";
|
qDebug() << "IFFT finished!!!";
|
||||||
// 初始化
|
// 初始化
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue