ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
pba::SparseBundleCU Class Reference

#include <SparseBundleCU.h>

Inheritance diagram for pba::SparseBundleCU:
Collaboration diagram for pba::SparseBundleCU:

Public Member Functions

virtual float GetMeanSquaredError ()
 
virtual void SetCameraData (size_t ncam, CameraT *cams)
 
virtual void SetPointData (size_t npoint, Point3D *pts)
 
virtual void SetProjection (size_t nproj, const Point2D *imgpts, const int *point_idx, const int *cam_idx)
 
virtual void SetFocalMask (const int *fmask, float weight)
 
virtual int RunBundleAdjustment ()
 
virtual void AbortBundleAdjustment ()
 
virtual int GetCurrentIteration ()
 
virtual void SetNextTimeBudget (int seconds)
 
virtual void SetNextBundleMode (BundleModeT mode)
 
virtual void SetFixedIntrinsics (bool fixed)
 
virtual void EnableRadialDistortion (DistortionT type)
 
virtual void ParseParam (int narg, char **argv)
 
 SparseBundleCU (int device)
 
size_t GetMemCapacity ()
 
- Public Member Functions inherited from pba::ParallelBA
void SetFocalLengthFixed (bool fixed)
 
void ResetBundleStorage ()
 
 ParallelBA (DeviceT device=PBA_CUDA_DEVICE_DEFAULT, const int num_threads=-1)
 
void * operator new (size_t size)
 
virtual ~ParallelBA ()
 
- Public Member Functions inherited from pba::ConfigBA
void ParseParam (int argc, char **argv)
 
const char * GetOutputParam ()
 
float GetInitialMSE ()
 
float GetFinalMSE ()
 
double GetBundleTiming (int timer=TIMER_OVERALL)
 
int GetIterationsLM ()
 
int GetIterationsCG ()
 
int GetCurrentDevice ()
 
int GetBundleReturnCode ()
 
int GetActiveDevice ()
 

Protected Member Functions

bool ProcessIndexCameraQ (std::vector< int > &qmap, std::vector< int > &qlist)
 
void ProcessWeightCameraQ (std::vector< int > &cpnum, std::vector< int > &qmap, std::vector< float > &qmapw, std::vector< float > &qlistw)
 
int GetParameterLength ()
 
int InitializeBundle ()
 
int ValidateInputData ()
 
void ReleaseAllocatedData ()
 
bool InitializeStorageForCG ()
 
bool InitializeBundleGPU ()
 
bool TransferDataToGPU ()
 
void TransferDataToHost ()
 
void DenormalizeData ()
 
void NormalizeData ()
 
void NormalizeDataF ()
 
void NormalizeDataD ()
 
void DebugProjections ()
 
void RunDebugSteps ()
 
bool CheckRequiredMem (int fresh=1)
 
bool CheckRequiredMemX ()
 
void ReserveStorage (size_t ncam, size_t npt, size_t nproj)
 
void ReserveStorageAuto ()
 
float EvaluateProjection (CuTexImage &cam, CuTexImage &point, CuTexImage &proj)
 
float EvaluateProjectionX (CuTexImage &cam, CuTexImage &point, CuTexImage &proj)
 
float UpdateCameraPoint (CuTexImage &dx, CuTexImage &cuImageTempProj)
 
float SaveUpdatedSystem (float residual_reduction, float dx_sqnorm, float damping)
 
float EvaluateDeltaNorm ()
 
void EvaluateJacobians (bool shuffle=true)
 
void PrepareJacobianNormalization ()
 
void ComputeJtE (CuTexImage &E, CuTexImage &JtE, int mode=0)
 
void ComputeJX (CuTexImage &X, CuTexImage &JX, int mode=0)
 
void ComputeDiagonal (CuTexImage &JJ, CuTexImage &JJI)
 
void ComputeBlockPC (float lambda, bool dampd=true)
 
void ApplyBlockPC (CuTexImage &v, CuTexImage &pv, int mode=0)
 
int SolveNormalEquationPCGB (float lambda)
 
int SolveNormalEquationPCGX (float lambda)
 
int SolveNormalEquation (float lambda)
 
void AdjustBundleAdjsutmentMode ()
 
void NonlinearOptimizeLM ()
 
void BundleAdjustment ()
 
void RunTestIterationLM (bool reduced)
 
void SaveBundleRecord (int iter, float res, float damping, float &g_norm, float &g_inf)
 
void SaveNormalEquation (float lambda)
 
void RunProfileSteps ()
 
void WarmupDevice ()
 
- Protected Member Functions inherited from pba::ConfigBA
 ConfigBA ()
 
void ResetTemporarySetting ()
 
void ResetBundleStatistics ()
 
void PrintBundleStatistics ()
 
void SaveBundleStatistics (int ncam, int npt, int nproj)
 
void BundleTimerStart (int timer)
 
void BundleTimerSwitch (int timer)
 
float BundleTimerGet (int timer)
 
void BundleTimerSwap (int timer1, int timer2)
 
float BundleTimerGetNow (int timer=TIMER_OPTIMIZATION)
 
void SaveBundleRecord (int iter, float res, float damping, float gn, float gi)
 
bool IsTimeBudgetAvailable ()
 
double MyClock ()
 

Protected Attributes

int _num_camera
 
int _num_point
 
int _num_imgpt
 
CameraT_camera_data
 
float * _point_data
 
const float * _imgpt_data
 
const int * _camera_idx
 
const int * _point_idx
 
const int * _focal_mask
 
std::vector< float > _imgpt_datax
 
float _projection_sse
 
CuTexImage _cuCameraData
 
CuTexImage _cuCameraDataEX
 
CuTexImage _cuPointData
 
CuTexImage _cuPointDataEX
 
CuTexImage _cuMeasurements
 
CuTexImage _cuImageProj
 
CuTexImage _cuJacobianCamera
 
CuTexImage _cuJacobianPoint
 
CuTexImage _cuJacobianCameraT
 
CuTexImage _cuProjectionMap
 
CuTexImage _cuPointMeasurementMap
 
CuTexImage _cuCameraMeasurementMap
 
CuTexImage _cuCameraMeasurementList
 
CuTexImage _cuCameraMeasurementListT
 
CuTexImage _cuBufferData
 
CuTexImage _cuBlockPC
 
CuTexImage _cuVectorSJ
 
CuTexImage _cuVectorJtE
 LM normal equation. More...
 
CuTexImage _cuVectorJJ
 
CuTexImage _cuVectorJX
 
CuTexImage _cuVectorXK
 
CuTexImage _cuVectorPK
 
CuTexImage _cuVectorZK
 
CuTexImage _cuVectorRK
 
int _num_imgpt_q
 
float _weight_q
 
CuTexImage _cuCameraQList
 
CuTexImage _cuCameraQMap
 
CuTexImage _cuCameraQMapW
 
CuTexImage _cuCameraQListW
 
- Protected Attributes inherited from pba::ConfigBA
bool __multiply_jx_usenoj
 
int __selected_device
 
int __cpu_data_precision
 
int __bundle_time_budget
 
int __bundle_mode_next
 
int __bundle_current_mode
 
float __initial_mse
 
float __final_mse
 
float __final_mse_x
 
float __focal_scaling
 
float __depth_scaling
 
int __current_device
 
int __current_iteration
 
int __num_cg_iteration
 
int __num_lm_success
 
int __num_lm_iteration
 
int __num_projection_eval
 
int __num_jacobian_eval
 
int __num_camera_modified
 
int __num_point_behind
 
int __pba_return_code
 
int __recent_cg_status
 
int __profile_pba
 
bool __cpu_thread_profile
 
bool __debug_pba
 
bool __warmup_device
 
size_t __memory_usage
 
bool __matlab_format_stat
 
char * __stat_filename
 
const char * __driver_output
 
std::vector< float > __bundle_records
 
double __timer_record [NUM_TIMER]
 
int __num_cpu_thread_all
 
int __num_cpu_thread [NUM_FUNC]
 

Additional Inherited Members

- Public Types inherited from pba::ParallelBA
enum  StatusT {
  STATUS_SUCCESS = 0 , STATUS_CAMERA_MISSING = 1 , STATUS_POINT_MISSING , STATUS_PROJECTION_MISSING ,
  STATUS_MEASURMENT_MISSING , STATUS_ALLOCATION_FAIL
}
 
enum  DeviceT {
  PBA_INVALID_DEVICE = -4 , PBA_CPU_DOUBLE = -3 , PBA_CPU_FLOAT = -2 , PBA_CUDA_DEVICE_DEFAULT = -1 ,
  PBA_CUDA_DEVICE0 = 0
}
 
enum  DistortionT { PBA_MEASUREMENT_DISTORTION = -1 , PBA_NO_DISTORTION = 0 , PBA_PROJECTION_DISTORTION = 1 }
 
enum  BundleModeT { BUNDLE_FULL = 0 , BUNDLE_ONLY_MOTION = 1 , BUNDLE_ONLY_STRUCTURE = 2 }
 
- Public Attributes inherited from pba::ConfigBA
int __lm_max_iteration
 
int __cg_max_iteration
 
int __cg_min_iteration
 
int __cg_recalculate_freq
 
bool __accurate_gain_ratio
 
float __lm_delta_threshold
 
float __lm_gradient_threshold
 
float __lm_mse_threshold
 
float __lm_initial_damp
 
float __lm_minimum_damp
 
float __lm_maximum_damp
 
float __cg_norm_threshold
 
float __cg_norm_guard
 
int __pba_experimental
 
bool __cg_schur_complement
 
bool __lm_check_gradient
 
float __lm_damping_auto_switch
 
bool __lm_use_diagonal_damp
 
bool __fixed_intrinsics
 
int __use_radial_distortion
 
bool __reset_initial_distortion
 
int __verbose_level
 
bool __abort_flag
 
bool __verbose_cg_iteration
 
bool __verbose_function_time
 
bool __save_gradient_norm
 
bool __verbose_allocation
 
bool __verbose_sse
 
bool __jc_store_transpose
 
bool __no_jacobian_store
 
bool __jc_store_original
 
bool __jacobian_normalize
 
bool __focal_normalize
 
bool __depth_normalize
 
bool __depth_degeneracy_fix
 
float __data_normalize_median
 
float __depth_check_epsilon
 
- Protected Types inherited from pba::ConfigBA
enum  {
  TIMER_OVERALL = 0 , TIMER_OPTIMIZATION , TIMER_GPU_ALLOCATION , TIMER_GPU_UPLOAD ,
  TIMER_PREPROCESSING , TIMER_GPU_DOWNLOAD , TIMER_CG_ITERATION , TIMER_LM_ITERATION ,
  TIMER_FUNCTION_JJ , TIMER_FUNCTION_PJ , TIMER_FUNCTION_DD , TIMER_FUNCTION_JX ,
  TIMER_FUNCTION_JTE , TIMER_FUNCTION_BC , TIMER_FUNCTION_MP , TIMER_FUNCTION_UP ,
  TIMER_PROFILE_STEP , NUM_TIMER , FUNC_JX = 0 , FUNC_JX_ ,
  FUNC_JTEC_JCT , FUNC_JTEC_JCO , FUNC_JTEP , FUNC_JTE_ ,
  FUNC_JJ_JCO_JCT_JP , FUNC_JJ_JCO_JP , FUNC_JJ_JCT_JP , FUNC_JJ_JP ,
  FUNC_PJ , FUNC_BCC_JCT , FUNC_BCC_JCO , FUNC_BCP ,
  FUNC_MPC , FUNC_MPP , FUNC_VS , FUNC_VV ,
  NUM_FUNC
}
 

Detailed Description

Definition at line 31 of file SparseBundleCU.h.

Constructor & Destructor Documentation

◆ SparseBundleCU()

pba::SparseBundleCU::SparseBundleCU ( int  device)

Definition at line 77 of file SparseBundleCU.cpp.

References pba::ConfigBA::__selected_device.

Member Function Documentation

◆ AbortBundleAdjustment()

virtual void pba::SparseBundleCU::AbortBundleAdjustment ( )
inlinevirtual

Reimplemented from pba::ParallelBA.

Definition at line 152 of file SparseBundleCU.h.

References pba::ConfigBA::__abort_flag.

◆ AdjustBundleAdjsutmentMode()

void pba::SparseBundleCU::AdjustBundleAdjsutmentMode ( )
protected

◆ ApplyBlockPC()

◆ BundleAdjustment()

◆ CheckRequiredMem()

◆ CheckRequiredMemX()

bool pba::SparseBundleCU::CheckRequiredMemX ( )
protected

◆ ComputeBlockPC()

◆ ComputeDiagonal()

◆ ComputeJtE()

◆ ComputeJX()

◆ DebugProjections()

void pba::SparseBundleCU::DebugProjections ( )
protected

◆ DenormalizeData()

◆ EnableRadialDistortion()

virtual void pba::SparseBundleCU::EnableRadialDistortion ( DistortionT  type)
inlinevirtual

Reimplemented from pba::ParallelBA.

Definition at line 161 of file SparseBundleCU.h.

References pba::ConfigBA::__use_radial_distortion, and type.

◆ EvaluateDeltaNorm()

◆ EvaluateJacobians()

◆ EvaluateProjection()

◆ EvaluateProjectionX()

◆ GetCurrentIteration()

virtual int pba::SparseBundleCU::GetCurrentIteration ( )
inlinevirtual

Reimplemented from pba::ParallelBA.

Definition at line 153 of file SparseBundleCU.h.

References pba::ConfigBA::__current_iteration.

◆ GetMeanSquaredError()

float pba::SparseBundleCU::GetMeanSquaredError ( )
virtual

Reimplemented from pba::ParallelBA.

Definition at line 125 of file SparseBundleCU.cpp.

References pba::ConfigBA::__focal_scaling, _num_imgpt, and _projection_sse.

◆ GetMemCapacity()

◆ GetParameterLength()

int pba::SparseBundleCU::GetParameterLength ( )
protected

◆ InitializeBundle()

◆ InitializeBundleGPU()

◆ InitializeStorageForCG()

◆ NonlinearOptimizeLM()

void pba::SparseBundleCU::NonlinearOptimizeLM ( )
protected

Definition at line 1586 of file SparseBundleCU.cpp.

References pba::ConfigBA::__abort_flag, pba::ConfigBA::__current_iteration, pba::ConfigBA::__final_mse, pba::ConfigBA::__final_mse_x, pba::ConfigBA::__focal_scaling, pba::ConfigBA::__initial_mse, pba::ConfigBA::__jacobian_normalize, pba::ConfigBA::__lm_check_gradient, pba::ConfigBA::__lm_damping_auto_switch, pba::ConfigBA::__lm_delta_threshold, pba::ConfigBA::__lm_gradient_threshold, pba::ConfigBA::__lm_initial_damp, pba::ConfigBA::__lm_max_iteration, pba::ConfigBA::__lm_maximum_damp, pba::ConfigBA::__lm_minimum_damp, pba::ConfigBA::__lm_mse_threshold, pba::ConfigBA::__lm_use_diagonal_damp, pba::ConfigBA::__num_lm_iteration, pba::ConfigBA::__num_lm_success, pba::ConfigBA::__pba_return_code, pba::ConfigBA::__recent_cg_status, pba::ConfigBA::__save_gradient_norm, pba::ConfigBA::__use_radial_distortion, pba::ConfigBA::__verbose_level, pba::ConfigBA::__verbose_sse, _cuCameraData, _cuImageProj, _cuPointData, _cuVectorJtE, _cuVectorJX, _cuVectorSJ, _cuVectorXK, _cuVectorZK, _num_imgpt, _projection_sse, pba::ConfigBA::BundleTimerGetNow(), ComputeJtE(), EvaluateDeltaNorm(), EvaluateJacobians(), EvaluateProjection(), EvaluateProjectionX(), cloudViewer::utility::floor(), pba::ConfigBA::IsTimeBudgetAvailable(), pba::CuTexImage::IsValid(), max(), PrepareJacobianNormalization(), SaveBundleRecord(), SaveUpdatedSystem(), SolveNormalEquation(), pba::CuTexImage::SwapData(), pba::ConfigBA::TIMER_OPTIMIZATION, and UpdateCameraPoint().

Referenced by BundleAdjustment().

◆ NormalizeData()

void pba::SparseBundleCU::NormalizeData ( )
protected

◆ NormalizeDataD()

◆ NormalizeDataF()

◆ ParseParam()

virtual void pba::SparseBundleCU::ParseParam ( int  narg,
char **  argv 
)
inlinevirtual

Reimplemented from pba::ParallelBA.

Definition at line 164 of file SparseBundleCU.h.

References pba::ConfigBA::ParseParam().

◆ PrepareJacobianNormalization()

◆ ProcessIndexCameraQ()

bool pba::SparseBundleCU::ProcessIndexCameraQ ( std::vector< int > &  qmap,
std::vector< int > &  qlist 
)
protected

◆ ProcessWeightCameraQ()

void pba::SparseBundleCU::ProcessWeightCameraQ ( std::vector< int > &  cpnum,
std::vector< int > &  qmap,
std::vector< float > &  qmapw,
std::vector< float > &  qlistw 
)
protected

◆ ReleaseAllocatedData()

◆ ReserveStorage()

◆ ReserveStorageAuto()

void pba::SparseBundleCU::ReserveStorageAuto ( )
protected

◆ RunBundleAdjustment()

◆ RunDebugSteps()

void pba::SparseBundleCU::RunDebugSteps ( )
protected

◆ RunProfileSteps()

◆ RunTestIterationLM()

◆ SaveBundleRecord()

void pba::SparseBundleCU::SaveBundleRecord ( int  iter,
float  res,
float  damping,
float &  g_norm,
float &  g_inf 
)
protected

◆ SaveNormalEquation()

void pba::SparseBundleCU::SaveNormalEquation ( float  lambda)
protected

◆ SaveUpdatedSystem()

◆ SetCameraData()

void pba::SparseBundleCU::SetCameraData ( size_t  ncam,
CameraT cams 
)
virtual

Reimplemented from pba::ParallelBA.

Definition at line 99 of file SparseBundleCU.cpp.

References _camera_data, _focal_mask, _num_camera, and NULL.

◆ SetFixedIntrinsics()

virtual void pba::SparseBundleCU::SetFixedIntrinsics ( bool  fixed)
inlinevirtual

Reimplemented from pba::ParallelBA.

Definition at line 160 of file SparseBundleCU.h.

References pba::ConfigBA::__fixed_intrinsics.

◆ SetFocalMask()

void pba::SparseBundleCU::SetFocalMask ( const int *  fmask,
float  weight 
)
virtual

Reimplemented from pba::ParallelBA.

Definition at line 106 of file SparseBundleCU.cpp.

References _focal_mask, and _weight_q.

◆ SetNextBundleMode()

virtual void pba::SparseBundleCU::SetNextBundleMode ( BundleModeT  mode)
inlinevirtual

Reimplemented from pba::ParallelBA.

Definition at line 157 of file SparseBundleCU.h.

References pba::ConfigBA::__bundle_mode_next.

◆ SetNextTimeBudget()

virtual void pba::SparseBundleCU::SetNextTimeBudget ( int  seconds)
inlinevirtual

Reimplemented from pba::ParallelBA.

Definition at line 154 of file SparseBundleCU.h.

References pba::ConfigBA::__bundle_time_budget, and seconds.

◆ SetPointData()

void pba::SparseBundleCU::SetPointData ( size_t  npoint,
Point3D pts 
)
virtual

Reimplemented from pba::ParallelBA.

Definition at line 111 of file SparseBundleCU.cpp.

References _num_point, and _point_data.

◆ SetProjection()

void pba::SparseBundleCU::SetProjection ( size_t  nproj,
const Point2D imgpts,
const int *  point_idx,
const int *  cam_idx 
)
virtual

Reimplemented from pba::ParallelBA.

Definition at line 116 of file SparseBundleCU.cpp.

References _camera_idx, _imgpt_data, _imgpt_datax, _num_imgpt, and _point_idx.

◆ SolveNormalEquation()

◆ SolveNormalEquationPCGB()

◆ SolveNormalEquationPCGX()

◆ TransferDataToGPU()

◆ TransferDataToHost()

void pba::SparseBundleCU::TransferDataToHost ( )
protected

◆ UpdateCameraPoint()

◆ ValidateInputData()

◆ WarmupDevice()

void pba::SparseBundleCU::WarmupDevice ( )
protected

Member Data Documentation

◆ _camera_data

◆ _camera_idx

const int* pba::SparseBundleCU::_camera_idx
protected

◆ _cuBlockPC

CuTexImage pba::SparseBundleCU::_cuBlockPC
protected

◆ _cuBufferData

◆ _cuCameraData

◆ _cuCameraDataEX

CuTexImage pba::SparseBundleCU::_cuCameraDataEX
protected

◆ _cuCameraMeasurementList

CuTexImage pba::SparseBundleCU::_cuCameraMeasurementList
protected

◆ _cuCameraMeasurementListT

CuTexImage pba::SparseBundleCU::_cuCameraMeasurementListT
protected

Definition at line 60 of file SparseBundleCU.h.

Referenced by EvaluateJacobians(), ReleaseAllocatedData(), and TransferDataToGPU().

◆ _cuCameraMeasurementMap

CuTexImage pba::SparseBundleCU::_cuCameraMeasurementMap
protected

◆ _cuCameraQList

CuTexImage pba::SparseBundleCU::_cuCameraQList
protected

Definition at line 81 of file SparseBundleCU.h.

Referenced by ComputeJtE(), ReleaseAllocatedData(), and TransferDataToGPU().

◆ _cuCameraQListW

CuTexImage pba::SparseBundleCU::_cuCameraQListW
protected

◆ _cuCameraQMap

CuTexImage pba::SparseBundleCU::_cuCameraQMap
protected

◆ _cuCameraQMapW

CuTexImage pba::SparseBundleCU::_cuCameraQMapW
protected

◆ _cuImageProj

◆ _cuJacobianCamera

◆ _cuJacobianCameraT

◆ _cuJacobianPoint

◆ _cuMeasurements

◆ _cuPointData

◆ _cuPointDataEX

CuTexImage pba::SparseBundleCU::_cuPointDataEX
protected

◆ _cuPointMeasurementMap

CuTexImage pba::SparseBundleCU::_cuPointMeasurementMap
protected

◆ _cuProjectionMap

CuTexImage pba::SparseBundleCU::_cuProjectionMap
protected

◆ _cuVectorJJ

◆ _cuVectorJtE

◆ _cuVectorJX

◆ _cuVectorPK

CuTexImage pba::SparseBundleCU::_cuVectorPK
protected

◆ _cuVectorRK

CuTexImage pba::SparseBundleCU::_cuVectorRK
protected

◆ _cuVectorSJ

◆ _cuVectorXK

◆ _cuVectorZK

◆ _focal_mask

const int* pba::SparseBundleCU::_focal_mask
protected

◆ _imgpt_data

const float* pba::SparseBundleCU::_imgpt_data
protected

◆ _imgpt_datax

std::vector<float> pba::SparseBundleCU::_imgpt_datax
protected

◆ _num_camera

◆ _num_imgpt

◆ _num_imgpt_q

◆ _num_point

◆ _point_data

float* pba::SparseBundleCU::_point_data
protected

◆ _point_idx

const int* pba::SparseBundleCU::_point_idx
protected

◆ _projection_sse

float pba::SparseBundleCU::_projection_sse
protected

Definition at line 45 of file SparseBundleCU.h.

Referenced by DenormalizeData(), GetMeanSquaredError(), and NonlinearOptimizeLM().

◆ _weight_q

float pba::SparseBundleCU::_weight_q
protected

Definition at line 80 of file SparseBundleCU.h.

Referenced by ProcessIndexCameraQ(), ProcessWeightCameraQ(), and SetFocalMask().


The documentation for this class was generated from the following files: