2024-11-25 01:30:14 +00:00
# pragma once
///
/// <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> 㷨
///
//#define EIGEN_USE_MKL_ALL
//#define EIGEN_VECTORIZE_SSE4_2
//#include <mkl.h>
// <20> <> <EFBFBD> ط<EFBFBD> <D8B7> <EFBFBD>
2024-11-25 06:26:46 +00:00
# include "BaseTool.h"
2024-11-25 01:30:14 +00:00
# include <iostream>
# include <Eigen/Core>
# include <Eigen/Dense>
# include <time.h>
//#include <mkl.h>
# include <omp.h>
# include "SateOrbit.h"
using namespace std ;
using namespace Eigen ;
////////////// <20> <> <EFBFBD> ú<EFBFBD> <C3BA> <EFBFBD> ////////////////////////
double getRangeColumn ( long double R , long double NearRange , long double Fs , long double lamda ) ;
Eigen : : MatrixXd getRangeColumn ( Eigen : : MatrixXd R , long double NearRange , long double Fs , long double lamda ) ;
double getRangebyColumn ( double j , long double NearRange , long double Fs , long double lamda ) ;
Eigen : : MatrixXd getRangebyColumn ( Eigen : : MatrixXd j , long double NearRange , long double Fs , long double lamda ) ;
///////////// ptsn <20> 㷨 /////////////////////
class PSTNAlgorithm {
public :
// <20> <> ʼ <EFBFBD> <CABC> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
PSTNAlgorithm ( ) ;
PSTNAlgorithm ( QString parameterPath ) ;
~ PSTNAlgorithm ( ) ;
int dem2lat_lon ( QString dem_path , QString lon_path , QString lat_path ) ;
int dem2SAR_RC ( QString dem_path , QString sim_rc_path ) ;
// ģ<> <C4A3> <EFBFBD> 㷨<EFBFBD> <E3B7A8> <EFBFBD> <EFBFBD>
Eigen : : MatrixX < double > calNumericalDopplerValue ( Eigen : : MatrixX < double > R ) ; // <20> <> ֵģ<D6B5> ⷨ<EFBFBD> <E2B7A8> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ƶ<EFBFBD> <C6B5> ֵ
double calNumericalDopplerValue ( double R ) ; // <20> <> ֵģ<D6B5> ⷨ<EFBFBD> <E2B7A8> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ƶ<EFBFBD> <C6B5> ֵ
Eigen : : MatrixX < double > calTheoryDopplerValue ( Eigen : : MatrixX < double > R , Eigen : : MatrixX < double > R_s1 , Eigen : : MatrixX < double > V_s1 ) ; //<2F> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ģ<EFBFBD> ͼ<EFBFBD> <CDBC> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ƶ<EFBFBD> <C6B5> ֵ
double calTheoryDopplerValue ( double R , Eigen : : MatrixX < double > R_s1 , Eigen : : MatrixX < double > V_s1 ) ;
Eigen : : MatrixX < double > PSTN ( Eigen : : MatrixX < double > TargetPostion , double ave_dem , double dt , bool isCol ) ; // <20> <> <EFBFBD> <EFBFBD> DEM
//Eigen::MatrixXd WGS842J2000(Eigen::MatrixXd blh);
//Landpoint WGS842J2000(Landpoint p);
public : // WGS84 <20> <> J2000 ֮<> <D6AE> <EFBFBD> ı 任<C4B1> <E4BBBB> <EFBFBD> <EFBFBD>
Eigen : : MatrixXd UTC ;
double Xp = 0.204071 ;
double Yp = 0.318663 ;
double Dut1 = 0.0366742 ;
double Dat = 37 ;
public :
int height ; // Ӱ<> <D3B0> <EFBFBD> ĸ<EFBFBD>
int width ;
2024-11-25 06:26:46 +00:00
int widthspace ;
2024-11-25 01:30:14 +00:00
// <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
double near_in_angle ; // <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
double far_in_angle ; // Զ<> <D4B6> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
// SAR<41> ij<EFBFBD> <C4B3> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
double fs ; // <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
double R0 ; //<2F> <> б <EFBFBD> <D0B1>
double LightSpeed ; // <20> <> <EFBFBD> <EFBFBD>
double lamda ; // <20> <> <EFBFBD> <EFBFBD>
double refrange ; // <20> ο <EFBFBD> б <EFBFBD> <D0B1>
double imgStartTime ; // <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ʼ ʱ<CABC> <CAB1>
double PRF ; // <20> <> <EFBFBD> <EFBFBD> <EFBFBD> ظ<EFBFBD> <D8B8> <EFBFBD>
int doppler_paramenter_number ; //<2F> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ϵ<EFBFBD> <CFB5> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
MatrixX < double > doppler_paras ; // <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ϵ<EFBFBD> <CFB5>
OrbitPoly orbit ; // <20> <> <EFBFBD> <EFBFBD> ģ<EFBFBD> <C4A3>
} ;
/// <summary>
/// <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ,<2C> Ƕ<EFBFBD> ֵ
/// </summary>
/// <param name="satepoint"></param>
/// <param name="landpoint"></param>
/// <returns></returns>
double getIncAngle ( Landpoint & satepoint , Landpoint & landpoint ) ;
/// <summary>
/// ASF<53> <46> <EFBFBD> 㷽<EFBFBD> <E3B7BD>
/// </summary>
class ASFOrthClass {
public :
Eigen : : MatrixXd Satellite2ECR ( Eigen : : Vector3d Rsc , Eigen : : Vector3d Vsc ) ; // <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> 任<EFBFBD> <E4BBBB> <EFBFBD> <EFBFBD> M
Eigen : : Vector3d UnitVectorOfSatelliteAndTarget ( double alpha , double beta , Eigen : : MatrixXd M ) ;
double GetLookFromRangeYaw ( double R , double alpha , double beta , Eigen : : Vector3d SatellitePosition , Eigen : : Vector3d SatelliteVelocity , double R_threshold , double H = 0 ) ;
Eigen : : Vector3d GetXYZByBetaAlpha ( double alpha , double beta , Eigen : : Vector3d SatellitePosition , double R , Eigen : : MatrixXd M ) ;
double FD ( double alpha , double beta , Eigen : : Vector3d SatelliteVelocity , Eigen : : Vector3d TargetVelocity , double R , double lamda , Eigen : : MatrixXd M ) ;
double FR ( double alpha , double beta , Eigen : : Vector3d SatellitePosition , Eigen : : MatrixXd M , double R_threshold , double H = 0 ) ;
Eigen : : Vector3d ASF ( double R , Eigen : : Vector3d SatellitePosition , Eigen : : Vector3d SatelliteVelocity , Eigen : : Vector3d TargetPosition , PSTNAlgorithm PSTN , double R_threshold , double H = 0 , double alpha0 = 0 , double beta0 = 0 ) ;
} ;
/// <summary>
/// <20> <> <EFBFBD> 洦<EFBFBD> <E6B4A6> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
/// </summary>
class simProcess {
public :
simProcess ( ) ;
~ simProcess ( ) ;
int parameters ( int argc , char * argv [ ] ) ;
int InitSimulationSAR ( QString paras_path , QString workspace_path , QString out_dir_path , QString in_dem_path , QString in_sar_path ) ; // <20> <> <EFBFBD> Ӷ<EFBFBD> λ<EFBFBD> <CEBB>
int CreateSARDEM ( ) ;
int dem2SAR ( ) ; // <20> л<EFBFBD> <D0BB> к<EFBFBD>
int SARIncidentAngle ( ) ;
int SARSimulationWGS ( ) ;
int SARSimulation ( ) ;
int in_sar_power ( ) ;
int ReflectTable_WGS2Range ( ) ;
int InitRPCIncAngle ( QString paras_path , QString workspace_path , QString out_dir_path , QString in_dem_path , QString in_rpc_lon_lat_path , QString out_inc_angle_path , QString out_local_inc_angle_path , QString out_inc_angle_geo_path , QString out_local_inc_angle_geo_path ) ;
int dem2SAR_row ( ) ; // <20> л<EFBFBD> <D0BB> к<EFBFBD>
int SARIncidentAngle_RPC ( ) ;
int createRPCDEM ( ) ;
// <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ɢ<EFBFBD> <C9A2> ֵ
int Scatter2Grid ( QString lon_lat_path , QString data_tiff , QString grid_path , double space ) ;
// ASF ģ<> <C4A3> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
int InitASFSAR ( QString paras_path , QString workspace_path , QString out_dir_path , QString in_dem_path ) ;
int ASF ( QString in_dem_path , QString out_latlon_path , ASFOrthClass asfclass , PSTNAlgorithm PSTN ) ;
//int dem2simSAR(QString dem_path, QString out_sim_path, PSTNAlgorithm PSTN); // <20> <> <EFBFBD> <EFBFBD> DEM<45> <4D> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ͼ<EFBFBD> <CDBC>
int sim_SAR ( QString dem_path , QString sim_rc_path , QString sim_sar_path , PSTNAlgorithm PSTN ) ;
int dem2aspect_slope ( QString dem_path , QString aspect_path , QString slope_path ) ;
int sim_sum_SAR ( QString sim_dem_path , QString sim_rc_path , QString sim_orth_path , QString sim_sum_path , PSTNAlgorithm pstn ) ;
void interpolation_GTC_sar_sigma ( QString in_rc_wgs84_path , QString in_ori_sar_path , QString out_orth_sar_path , PSTNAlgorithm pstn ) ;
// ԭʼ Ӱ<CABC> <D3B0> ǿ<EFBFBD> <C7BF> ͼ
int ori_sar_power ( QString ori_sar_path , QString out_sar_power_path ) ;
// ƥ<> <C6A5> ƫ<EFBFBD> <C6AB> ģ<EFBFBD> <EFBFBD> <CDB9> <EFBFBD>
int createImageMatchModel ( QString ori_sar_rsc_path , QString ori_sar_rsc_jpg_path , QString sim_sar_path , QString sim_sar_jpg_path , QString matchmodel_path ) ;
int correct_ati ( QString orth_rc_path , QString dem_path , QString out_inclocal_path , QString out_dem_path , QString out_count_path , PSTNAlgorithm PSTN ) ;
void calcalIncident_localIncident_angle ( QString in_dem_path , QString in_rc_wgs84_path , QString out_incident_angle_path , QString out_local_incident_angle_path , PSTNAlgorithm PSTN ) ;
void calGEC_Incident_localIncident_angle ( QString in_dem_path , QString in_gec_lon_lat_path , QString out_incident_angle_path , QString out_local_incident_angle_path , PSTNAlgorithm PSTN ) ;
void interpolation_GTC_sar ( QString in_rc_wgs84_path , QString in_ori_sar_path , QString out_orth_sar_path , PSTNAlgorithm pstn ) ;
// RPC
void CreateRPC_DEM ( QString in_rpc_rc_path , QString in_dem_path , QString out_rpc_dem_path ) ;
void CreateRPC_refrenceTable ( QString in_rpc_tiff_path , QString in_merge_dem , QString out_rpc_lon_lat_tiff_path ) ;
void CorrectionFromSLC2Geo ( QString in_lon_lat_path , QString in_radar_path , QString out_radar_path , int in_band_ids ) ;
// <20> ڲ<EFBFBD> <DAB2> <EFBFBD> <EFBFBD> <EFBFBD>
public :
bool isMatchModel ;
QString workSpace_path ; // <20> <> <EFBFBD> <EFBFBD> <EFBFBD> ռ <EFBFBD> ·<EFBFBD> <C2B7>
QString outSpace_path ; // <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ռ <EFBFBD> ·<EFBFBD> <C2B7>
PSTNAlgorithm pstn ; // <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
///// RPC <20> ֵ<EFBFBD> <D6B5> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ///////////////////////////////////
QString in_rpc_lon_lat_path ;
QString out_dir_path ;
QString workspace_path ;
// <20> <> ʱ<EFBFBD> ļ<EFBFBD>
QString rpc_wgs_path ;
QString ori_sim_count_tiff ; // ӳ<> <D3B3> <EFBFBD> <EFBFBD> <EFBFBD> ļ<EFBFBD>
// <20> <> <EFBFBD> <EFBFBD> <EFBFBD> ļ<EFBFBD>
QString out_inc_angle_rpc_path ;
QString out_local_inc_angle_rpc_path ;
// <20> <> <EFBFBD> <EFBFBD> <EFBFBD> ļ<EFBFBD>
QString out_inc_angle_geo_path ;
QString out_local_inc_angle_geo_path ;
///// <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> 淽<EFBFBD> <E6B7BD> /////////
// <20> <> ʱ<EFBFBD> <CAB1> Ʒ <EFBFBD> ļ<EFBFBD>
QString in_dem_path ; // <20> <> <EFBFBD> <EFBFBD> DEM
QString dem_path ; // <20> ز<EFBFBD> <D8B2> <EFBFBD> ֮<EFBFBD> <D6AE> DEM
QString dem_r_path ; // <20> к<EFBFBD> Ӱ<EFBFBD> <D3B0>
QString dem_rc_path ; // <20> <> <EFBFBD> к<EFBFBD>
QString sar_sim_wgs_path ;
QString sar_sim_path ;
QString in_sar_path ;
QString sar_jpg_path ;
QString sar_power_path ;
// <20> <> <EFBFBD> ղ<EFBFBD> Ʒ
QString out_dem_rc_path ; // <20> <> γ <EFBFBD> <CEB3> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> кű任<C5B1> ļ<EFBFBD>
QString out_dem_slantRange_path ; // б <> <D0B1> <EFBFBD> ļ<EFBFBD>
QString out_plant_slantRange_path ; // ƽ <> <C6BD> б <EFBFBD> <D0B1> <EFBFBD> ļ<EFBFBD>
//// ASF <20> <> <EFBFBD> <EFBFBD> /////////////
QString out_lon_path ; // <20> <> <EFBFBD> <EFBFBD>
QString out_lat_path ; // γ <> <CEB3>
QString out_slantRange_path ; // б <> <D0B1> <EFBFBD> ļ<EFBFBD>
/// <20> <> ͬ<EFBFBD> ļ<EFBFBD> ///
QString out_localIncidenct_path ; // <20> <> <EFBFBD> <EFBFBD> <EFBFBD> ֵ<EFBFBD> <D6B5> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
QString out_incidence_path ; // <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ļ<EFBFBD>
QString out_ori_sim_tiff ; // ӳ<> <D3B3> <EFBFBD> <EFBFBD> <EFBFBD> ļ<EFBFBD> '
QString out_sim_ori_tiff ;
} ;
bool PtInRect ( Point3 pCur , Point3 pLeftTop , Point3 pRightTop , Point3 pRightBelow , Point3 pLeftBelow ) ;