增加了 TBP相关的代码
parent
7635f3ceef
commit
4ac2ca27e6
|
@ -51,7 +51,9 @@
|
|||
<Target Name="QtMsBuildNotFound" BeforeTargets="CustomBuild;ClCompile" Condition="!Exists('$(QtMsBuild)\qt.targets') or !Exists('$(QtMsBuild)\qt.props')">
|
||||
<Message Importance="High" Text="QtMsBuild: could not locate qt.targets, qt.props; project may not build correctly." />
|
||||
</Target>
|
||||
<ImportGroup Label="ExtensionSettings" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
<Import Project="$(VCTargetsPath)\BuildCustomizations\CUDA 12.6.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared" />
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
|
@ -116,6 +118,7 @@
|
|||
<ClCompile Include="SimulationSAR\SARSimulationTaskSetting.cpp" />
|
||||
<ClCompile Include="SimulationSAR\SatelliteOribtModel.cpp" />
|
||||
<ClCompile Include="SimulationSAR\SigmaDatabase.cpp" />
|
||||
<ClCompile Include="SimulationSAR\TBPImageAlgCls.cpp" />
|
||||
<QtRcc Include="Imageshow\qcustomplot.qrc" />
|
||||
<QtRcc Include="RasterProcessTool.qrc" />
|
||||
<QtUic Include="BaseLibraryCPP\QToolProcessBarDialog.ui" />
|
||||
|
@ -161,6 +164,7 @@
|
|||
<ClInclude Include="BaseLibraryCPP\EchoDataFormat.h" />
|
||||
<ClInclude Include="BaseLibraryCPP\FileOperator.h" />
|
||||
<ClInclude Include="BaseLibraryCPP\GeoOperator.h" />
|
||||
<ClInclude Include="SimulationSAR\TBPImageAlgCls.h" />
|
||||
<QtMoc Include="QSimulationRTPCGUI.h" />
|
||||
<QtMoc Include="GF3ProcessToolbox\QOrthSlrRaster.h" />
|
||||
<QtMoc Include="BaseLibraryCPP\QToolProcessBarDialog.h" />
|
||||
|
@ -186,10 +190,16 @@
|
|||
<QtMoc Include="Imageshow\ImageShowDialogClass.h" />
|
||||
<QtMoc Include="QMergeRasterProcessDialog.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CudaCompile Include="SimulationSAR\TBPGPU.cu">
|
||||
<FileType>Document</FileType>
|
||||
</CudaCompile>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Condition="Exists('$(QtMsBuild)\qt.targets')">
|
||||
<Import Project="$(QtMsBuild)\qt.targets" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<Import Project="$(VCTargetsPath)\BuildCustomizations\CUDA 12.6.targets" />
|
||||
</ImportGroup>
|
||||
</Project>
|
|
@ -139,6 +139,9 @@
|
|||
<ClCompile Include="BaseLibraryCPP\QToolProcessBarDialog.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SimulationSAR\TBPImageAlgCls.cpp">
|
||||
<Filter>SimulationSAR</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="BaseLibraryCPP\BaseConstVariable.h">
|
||||
|
@ -201,6 +204,9 @@
|
|||
<ClInclude Include="BaseLibraryCPP\ImageOperatorBase.h">
|
||||
<Filter>BaseLibraryCPP</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="SimulationSAR\TBPImageAlgCls.h">
|
||||
<Filter>SimulationSAR</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<QtMoc Include="QMergeRasterProcessDialog.h">
|
||||
|
@ -260,4 +266,9 @@
|
|||
<Filter>Form Files</Filter>
|
||||
</QtUic>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CudaCompile Include="SimulationSAR\TBPGPU.cu">
|
||||
<Filter>SimulationSAR</Filter>
|
||||
</CudaCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -0,0 +1,26 @@
|
|||
#include <iostream>
|
||||
#include <memory>
|
||||
#include <cmath>
|
||||
#include <complex>
|
||||
#include <cuda_runtime.h>
|
||||
#include <cublas_v2.h>
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// TBP GPU´úÂë
|
||||
/// </summary>
|
||||
/// <param name="antpos_ptr">ÎÀÐǹìµÀ×ø±ê</param>
|
||||
/// <param name="echoArr">»Ø²¨¾ØÕó</param>
|
||||
/// <param name="img_arr">ͼÏñ¾ØÕó</param>
|
||||
void TBPImageGPUAlg(std::shared_ptr<float> antpos_ptr,std::shared_ptr<std::complex<float>> echoArr,std::shared_ptr<std::complex<float>> img_arr) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,235 @@
|
|||
#include "stdafx.h"
|
||||
#include "TBPImageAlgCls.h"
|
||||
#include <QDateTime>
|
||||
#include <QDebug>
|
||||
#include <QString>
|
||||
#include "ImageShowDialogClass.h"
|
||||
#include <cmath>
|
||||
|
||||
void TBPImageProcess(QString echofile, QString outImageFolder, QString imagePlanePath,long num_thread)
|
||||
{
|
||||
std::shared_ptr<EchoL0Dataset> echoL0ds(new EchoL0Dataset);
|
||||
echoL0ds->Open(echofile);
|
||||
|
||||
std::shared_ptr< SARSimulationImageL1Dataset> imagL1(new SARSimulationImageL1Dataset);
|
||||
imagL1->setCenterAngle(echoL0ds->getCenterAngle());
|
||||
imagL1->setCenterFreq(echoL0ds->getCenterFreq());
|
||||
imagL1->setNearRange(echoL0ds->getNearRange());
|
||||
imagL1->setRefRange((echoL0ds->getNearRange() + echoL0ds->getFarRange()) / 2);
|
||||
imagL1->setFarRange(echoL0ds->getFarRange());
|
||||
imagL1->setFs(echoL0ds->getFs());
|
||||
imagL1->setLookSide(echoL0ds->getLookSide());
|
||||
imagL1->OpenOrNew(outImageFolder, echoL0ds->getSimulationTaskName(), echoL0ds->getPluseCount(), echoL0ds->getPlusePoints());
|
||||
|
||||
|
||||
TBPImageAlgCls TBPimag;
|
||||
TBPimag.setEchoL0(echoL0ds);
|
||||
TBPimag.setImageL1(imagL1);
|
||||
TBPimag.setImagePlanePath(imagePlanePath);
|
||||
|
||||
TBPimag.Process(num_thread);
|
||||
}
|
||||
|
||||
void TBPImageAlgCls::setImagePlanePath(QString INimagePlanePath)
|
||||
{
|
||||
this->imagePlanePath = INimagePlanePath;
|
||||
}
|
||||
|
||||
QString TBPImageAlgCls::getImagePlanePath()
|
||||
{
|
||||
return this->imagePlanePath;
|
||||
}
|
||||
|
||||
void TBPImageAlgCls::setEchoL0(std::shared_ptr<EchoL0Dataset> inL0ds)
|
||||
{
|
||||
this->L0ds = inL0ds;
|
||||
}
|
||||
|
||||
void TBPImageAlgCls::setImageL1(std::shared_ptr<SARSimulationImageL1Dataset> inL1ds)
|
||||
{
|
||||
this->L1ds = inL1ds;
|
||||
}
|
||||
|
||||
std::shared_ptr<EchoL0Dataset> TBPImageAlgCls::getEchoL1()
|
||||
{
|
||||
return this->L0ds;
|
||||
}
|
||||
|
||||
std::shared_ptr<SARSimulationImageL1Dataset> TBPImageAlgCls::getImageL0()
|
||||
{
|
||||
return this->L1ds;
|
||||
}
|
||||
|
||||
ErrorCode TBPImageAlgCls::Process(long num_thread)
|
||||
{
|
||||
return this->ProcessNoImagePlane(num_thread);
|
||||
}
|
||||
|
||||
|
||||
ErrorCode TBPImageAlgCls::ProcessNoImagePlane(long num_thread)
|
||||
{
|
||||
omp_set_num_threads(num_thread);
|
||||
// 常用参数
|
||||
long rowCount = this->L1ds->getrowCount();
|
||||
long colCount = this->L1ds->getcolCount();
|
||||
long pixelCount = rowCount * colCount;
|
||||
long PRFCount = this->L0ds->getPluseCount();
|
||||
long PlusePoints = this->L0ds->getPlusePoints();
|
||||
|
||||
|
||||
double Rnear = this->L1ds->getNearRange();
|
||||
double Rfar = this->L1ds->getFarRange();
|
||||
double fs = this->L1ds->getFs();
|
||||
double dx = LIGHTSPEED / 2 / fs;
|
||||
double factorj = this->L1ds->getCenterFreq() * 4 * M_PI / LIGHTSPEED * 1e9;
|
||||
|
||||
|
||||
Eigen::MatrixXcd echo = Eigen::MatrixXcd::Zero(PRFCount, PlusePoints);
|
||||
{
|
||||
std::shared_ptr<std::complex<double>> echodata = this->L0ds->getEchoArr();
|
||||
for (long i = 0; i < PRFCount; i++) {
|
||||
for (long j = 0; j < PlusePoints; j++) {
|
||||
echo(i, j) = echodata.get()[i * PlusePoints + j];
|
||||
}
|
||||
}
|
||||
echodata.reset();
|
||||
}
|
||||
|
||||
|
||||
Eigen::MatrixXd pixelX = Eigen::MatrixXd::Zero(rowCount, colCount);
|
||||
Eigen::MatrixXd pixelY = Eigen::MatrixXd::Zero(rowCount, colCount);
|
||||
Eigen::MatrixXd pixelZ = Eigen::MatrixXd::Zero(rowCount, colCount);
|
||||
|
||||
Eigen::MatrixXd Pxs = Eigen::MatrixXd::Zero(this->L0ds->getPluseCount(), 1);
|
||||
Eigen::MatrixXd Pys = Eigen::MatrixXd::Zero(this->L0ds->getPluseCount(), 1);
|
||||
Eigen::MatrixXd Pzs = Eigen::MatrixXd::Zero(this->L0ds->getPluseCount(), 1);
|
||||
|
||||
// 图像网格坐标
|
||||
{
|
||||
std::shared_ptr<double> antpos = this->L0ds->getAntPos();
|
||||
double time = 0;
|
||||
double Px = 0;
|
||||
double Py = 0;
|
||||
double Pz = 0;
|
||||
double Vx = 0;
|
||||
double Vy = 0;
|
||||
double Vz = 0;
|
||||
double AntDirectX = 0;
|
||||
double AntDirectY = 0;
|
||||
double AntDirectZ = 0;
|
||||
double AVx = 0;
|
||||
double AVy = 0;
|
||||
double AVz = 0;
|
||||
|
||||
double R = 0;
|
||||
double NormAnt = 0;
|
||||
|
||||
for (long i = 0; i < rowCount; i++) {
|
||||
time = antpos.get()[i * 16 + 0];
|
||||
Px = antpos.get()[i * 16 + 1];
|
||||
Py = antpos.get()[i * 16 + 2];
|
||||
Pz = antpos.get()[i * 16 + 3];
|
||||
Vx = antpos.get()[i * 16 + 4];
|
||||
Vy = antpos.get()[i * 16 + 5];
|
||||
Vz = antpos.get()[i * 16 + 6];
|
||||
AntDirectX = antpos.get()[i * 16 + 7];
|
||||
AntDirectY = antpos.get()[i * 16 + 8];
|
||||
AntDirectZ = antpos.get()[i * 16 + 9];
|
||||
AVx = antpos.get()[i * 16 + 10];
|
||||
AVy = antpos.get()[i * 16 + 11];
|
||||
AVz = antpos.get()[i * 16 + 12];
|
||||
|
||||
NormAnt = std::sqrt(AntDirectX * AntDirectX + AntDirectY * AntDirectY + AntDirectZ * AntDirectZ);
|
||||
AntDirectX = AntDirectX / NormAnt;
|
||||
AntDirectY = AntDirectY / NormAnt;
|
||||
AntDirectZ = AntDirectZ / NormAnt;// 归一化
|
||||
|
||||
antpos.get()[i * 16 + 7] = AntDirectX;
|
||||
antpos.get()[i * 16 + 8] = AntDirectY;
|
||||
antpos.get()[i * 16 + 9] = AntDirectZ;
|
||||
Pxs(i, 0) = Px;
|
||||
Pys(i, 0) = Py;
|
||||
Pzs(i, 0) = Pz;
|
||||
|
||||
for (long j = 0; j < colCount; j++) {
|
||||
R = j * dx + Rnear;
|
||||
pixelX(i, j) = Px + AntDirectX * R;
|
||||
pixelY(i, j) = Py + AntDirectY * R;
|
||||
pixelZ(i, j) = Pz + AntDirectZ * R;
|
||||
}
|
||||
}
|
||||
|
||||
this->L1ds->saveAntPos(antpos);
|
||||
antpos.reset();
|
||||
}
|
||||
|
||||
// BP成像
|
||||
long BlockLine = Memory1MB * 10 / 16 / rowCount;
|
||||
if (rowCount / BlockLine / num_thread < 3) {
|
||||
BlockLine = rowCount / num_thread / 3;
|
||||
}
|
||||
BlockLine = BlockLine > 10 ? BlockLine : 10;
|
||||
|
||||
std::shared_ptr<std::complex<double>> imagarr = this->L1ds->getImageRaster();
|
||||
{
|
||||
for (long i = 0; i < pixelCount; i++) {
|
||||
imagarr.get()[i] = imagarr.get()[i];
|
||||
}
|
||||
}
|
||||
omp_lock_t lock; // 定义锁
|
||||
omp_init_lock(&lock); // 初始化锁
|
||||
|
||||
long writeImageCount = 0;
|
||||
qDebug() << "block line:\t" << BlockLine;
|
||||
|
||||
|
||||
long startLine = 0;
|
||||
long processValue = 0;
|
||||
|
||||
#pragma omp parallel for
|
||||
for (startLine = 0; startLine < rowCount; startLine = startLine + BlockLine) { // 图像大小
|
||||
long stepLine = startLine + BlockLine < rowCount ? BlockLine : rowCount - startLine;
|
||||
long imageRowID = startLine; //
|
||||
|
||||
//Eigen::MatrixXd R = Eigen::MatrixXd::Zero(rowCount, 1);
|
||||
long pluseId = 0;
|
||||
std::complex<double> factPhas(0, 0);
|
||||
std::complex < double> sign(0, 0);
|
||||
Eigen::MatrixXd R = Eigen::MatrixXd::Zero(rowCount, 1);
|
||||
Eigen::MatrixXcd Rphi = Eigen::MatrixXd::Zero(rowCount, 1);
|
||||
|
||||
long PluseIDs = 0;
|
||||
double mask = 0;
|
||||
|
||||
for (long i = 0; i < stepLine; i++) { // 图像行
|
||||
imageRowID = startLine + i;
|
||||
for (long j = 0; j < colCount; j++) { //图像列
|
||||
R = ((pixelX(i, j) - Pxs.array()).array().pow(2) + (pixelY(i, j) - Pys.array()).array().pow(2) + (pixelZ(i, j) - Pzs.array()).array().pow(2)).array().sqrt();
|
||||
Rphi = Rphi.array() * 0;
|
||||
Rphi.imag() = R.array() * factorj;
|
||||
Rphi = Rphi.array().exp();
|
||||
|
||||
for (long prfid = 0; prfid < rowCount; prfid++) { // 脉冲行
|
||||
PluseIDs = std::floor((R(prfid, 0) - Rnear) / dx);
|
||||
mask = (PluseIDs < 0 || PluseIDs >= PlusePoints) ? 0 : 1;
|
||||
PluseIDs = (PluseIDs < 0 || PluseIDs >= PlusePoints) ? 0 : PluseIDs;
|
||||
imagarr.get()[imageRowID * colCount + j] =
|
||||
imagarr.get()[imageRowID * colCount + j] +
|
||||
mask * echo(prfid, PluseIDs) * Rphi(prfid, 0);// 信号* 相位校正
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
omp_set_lock(&lock); // 保存文件
|
||||
processValue = processValue + BlockLine;
|
||||
this->L1ds->saveImageRaster(imagarr, 0, rowCount);
|
||||
qDebug() << QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss.zzz").toUtf8().constData() << "\t" << processValue * 100.0 / rowCount << "%\t" << startLine << "\t-\t" << startLine + BlockLine << "\tend\t\t";
|
||||
omp_unset_lock(&lock); // 解锁
|
||||
}
|
||||
omp_destroy_lock(&lock); // 销毁锁
|
||||
|
||||
this->L1ds->saveImageRaster(imagarr, 0, rowCount);
|
||||
this->L1ds->saveToXml();
|
||||
return ErrorCode::SUCCESS;
|
||||
}
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
#pragma once
|
||||
/*****************************************************************//**
|
||||
* \file TBPImageAlgCls.h
|
||||
* \brief BP成像算法
|
||||
*
|
||||
* 参考资料
|
||||
* 雷达成像技术, 邢孟道
|
||||
*
|
||||
* 成像平面定义为 数据录取平面(P94, 雷达成像技术)
|
||||
* 数据录取平面定义为视线方向。
|
||||
*
|
||||
*
|
||||
* \author 陈增辉
|
||||
* \date October 2024
|
||||
*********************************************************************/
|
||||
#define EIGEN_USE_BLAS
|
||||
#define EIGEN_USE_LAPACK
|
||||
#define EIGEN_ENABLE_AVX512
|
||||
#define EIGEN_VECTORIZE_SSE
|
||||
#define EIGEN_VECTORIZE_SSE2
|
||||
#define EIGEN_VECTORIZE_SSSE3
|
||||
#define EIGEN_VECTORIZE_SSE4_1
|
||||
#define EIGEN_VECTORIZE_SSE4_2
|
||||
#include "BaseConstVariable.h"
|
||||
|
||||
#include "SARSatelliteSimulationAbstractCls.h"
|
||||
#include "SARSimulationTaskSetting.h"
|
||||
#include "SatelliteOribtModel.h"
|
||||
#include "EchoDataFormat.h"
|
||||
#include "SARSimulationImageL1.h"
|
||||
#include "LogInfoCls.h"
|
||||
|
||||
class TBPImageAlgCls
|
||||
{
|
||||
private:
|
||||
std::shared_ptr<SARSimulationImageL1Dataset> L1ds;
|
||||
std::shared_ptr < EchoL0Dataset> L0ds;
|
||||
QString imagePlanePath;
|
||||
public:
|
||||
|
||||
void setImagePlanePath(QString imagePlanePath);
|
||||
QString getImagePlanePath();
|
||||
|
||||
void setEchoL0(std::shared_ptr < EchoL0Dataset> L0ds);
|
||||
void setImageL1(std::shared_ptr<SARSimulationImageL1Dataset> L1ds);
|
||||
|
||||
std::shared_ptr < EchoL0Dataset> getEchoL1();
|
||||
std::shared_ptr<SARSimulationImageL1Dataset> getImageL0();
|
||||
|
||||
public:
|
||||
ErrorCode Process(long num_thread);
|
||||
|
||||
private:
|
||||
ErrorCode ProcessImagePlane(long num_thread);
|
||||
ErrorCode ProcessNoImagePlane(long num_thread);
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
void TBPImageProcess(QString echofile,QString outImageFolder,QString imagePlanePath,long num_thread);
|
Loading…
Reference in New Issue