資源簡介
為解決 volumetric fusion 重建時,重建的空間劃分成等大小的 voxel,顯存消耗太多,難以重建大場景,并且大量 voxel 更新耗費 GPU 資源問題,斯坦福圖形學組提出了 voxel hashing 算法(參考文獻:”Real-time 3D Reconstruction at Scale using Voxel Hashing”),voxel hashing 只在相機測量到的場景表面劃分 voxel,而不是將整個空間都劃分成 voxel,從而節省顯存。算法用 hash 表的形式存儲在場景表面劃分的 voxel block(8x8x8 voxels),方便 voxel block 的查詢。算法代碼開源。InfiniTAM 是對 voxel hashing 的改進,算法速度更快,適合在移動端運行。BunldeFusion mapping 部分 code 和 voxel hashing 是一樣的。
代碼片段和文件信息
//--------------------------------------------------------------------------------------
//?File:?DXUT.cpp
//
//?Copyright?(c)?Microsoft?Corporation.?All?rights?reserved.
//--------------------------------------------------------------------------------------
#include?“DXUT.h“
#define?DXUT_MIN_WINDOW_SIZE_X?200
#define?DXUT_MIN_WINDOW_SIZE_Y?200
#define?DXUT_COUNTER_STAT_LENGTH?2048
#undef?min?//?use?__min?instead?inside?this?source?file
#undef?max?//?use?__max?instead?inside?this?source?file
#ifndef?ARRAYSIZE
extern?“C++“?//?templates?cannot?be?declared?to?have?‘C‘?linkage
template?
char?(*RtlpNumberOf(?UNALIGNED?T?(&)[N]?))[N];
#define?RTL_NUMBER_OF_V2(A)?(sizeof(*RtlpNumberOf(A)))
#define?ARRAYSIZE(A)????RTL_NUMBER_OF_V2(A)
#endif
//--------------------------------------------------------------------------------------
//?Thread?safety
//--------------------------------------------------------------------------------------
CRITICAL_SECTION????g_cs;
bool????????????????g_bThreadSafe?=?true;
//--------------------------------------------------------------------------------------
//?Automatically?enters?&?leaves?the?CS?upon?object?creation/deletion
//--------------------------------------------------------------------------------------
class?DXUTLock
{
public:
????inline?DXUTLock()??{?if(?g_bThreadSafe?)?EnterCriticalSection(?&g_cs?);?}
????inline?~DXUTLock()?{?if(?g_bThreadSafe?)?LeaveCriticalSection(?&g_cs?);?}
};
//--------------------------------------------------------------------------------------
//?Helper?macros?to?build?member?functions?that?access?member?variables?with?thread?safety
//--------------------------------------------------------------------------------------
#define?SET_ACCESSOR(?x?y?)???????inline?void?Set##y(?x?t?)???{?DXUTLock?l;?m_state.m_##y?=?t;?};
#define?GET_ACCESSOR(?x?y?)???????inline?x?Get##y()???????????{?DXUTLock?l;?return?m_state.m_##y;?};
#define?GET_SET_ACCESSOR(?x?y?)???SET_ACCESSOR(?x?y?)?GET_ACCESSOR(?x?y?)
#define?SETP_ACCESSOR(?x?y?)??????inline?void?Set##y(?x*?t?)??{?DXUTLock?l;?m_state.m_##y?=?*t;?};
#define?GETP_ACCESSOR(?x?y?)??????inline?x*?Get##y()??????????{?DXUTLock?l;?return?&m_state.m_##y;?};
#define?GETP_SETP_ACCESSOR(?x?y?)?SETP_ACCESSOR(?x?y?)?GETP_ACCESSOR(?x?y?)
//--------------------------------------------------------------------------------------
//?Stores?timer?callback?info
//--------------------------------------------------------------------------------------
struct?DXUT_TIMER
{
????LPDXUTCALLBACKTIMER?pCallbackTimer;
????void*?pCallbackUserContext;
????float?fTimeoutInSecs;
????float?fCountdown;
????bool?bEnabled;
????UINT?nID;
};
//--------------------------------------------------------------------------------------
//?Stores?DXUT?state?and?data?access?is?done?with?thread?safety?(if?g_bThreadSafe==true)
//--------------------------------------------------------------------------------------
class?DXUTState
{
protected:
????struct?STATE
?
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2017-02-22?04:15??VoxelHashing-master\
?????文件?????????568??2017-02-22?04:15??VoxelHashing-master\CONTACT.txt
?????目錄???????????0??2017-02-22?04:15??VoxelHashing-master\DepthSensing\
?????目錄???????????0??2017-02-22?04:15??VoxelHashing-master\DepthSensing\DXUT\
?????目錄???????????0??2017-02-22?04:15??VoxelHashing-master\DepthSensing\DXUT\Core\
?????文件??????261813??2017-02-22?04:15??VoxelHashing-master\DepthSensing\DXUT\Core\DXUT.cpp
?????文件???????18240??2017-02-22?04:15??VoxelHashing-master\DepthSensing\DXUT\Core\DXUT.h
?????文件????13565952??2017-02-22?04:15??VoxelHashing-master\DepthSensing\DXUT\Core\DXUT.pch
?????文件???????43969??2017-02-22?04:15??VoxelHashing-master\DepthSensing\DXUT\Core\DXUTDevice11.cpp
?????文件????????8513??2017-02-22?04:15??VoxelHashing-master\DepthSensing\DXUT\Core\DXUTDevice11.h
?????文件???????42959??2017-02-22?04:15??VoxelHashing-master\DepthSensing\DXUT\Core\DXUTDevice9.cpp
?????文件????????9168??2017-02-22?04:15??VoxelHashing-master\DepthSensing\DXUT\Core\DXUTDevice9.h
?????文件????????1574??2017-02-22?04:15??VoxelHashing-master\DepthSensing\DXUT\Core\DXUT_2008.sln
?????文件???????10872??2017-02-22?04:15??VoxelHashing-master\DepthSensing\DXUT\Core\DXUT_2008.vcproj
?????文件????????1575??2017-02-22?04:15??VoxelHashing-master\DepthSensing\DXUT\Core\DXUT_2010.sln
?????文件???????17318??2017-02-22?04:15??VoxelHashing-master\DepthSensing\DXUT\Core\DXUT_2010.vcxproj
?????文件?????????851??2017-02-22?04:15??VoxelHashing-master\DepthSensing\DXUT\Core\DXUT_2010.vcxproj.filters
?????文件???????66781??2017-02-22?04:15??VoxelHashing-master\DepthSensing\DXUT\Core\DXUTmisc.cpp
?????文件???????24715??2017-02-22?04:15??VoxelHashing-master\DepthSensing\DXUT\Core\DXUTmisc.h
?????文件?????????329??2017-02-22?04:15??VoxelHashing-master\DepthSensing\DXUT\Core\dpiaware.manifest
?????目錄???????????0??2017-02-22?04:15??VoxelHashing-master\DepthSensing\DXUT\Optional\
?????文件????????9537??2017-02-22?04:15??VoxelHashing-master\DepthSensing\DXUT\Optional\DXUTLockFreePipe.h
?????文件????????1580??2017-02-22?04:15??VoxelHashing-master\DepthSensing\DXUT\Optional\DXUTOpt_2008.sln
?????文件???????11493??2017-02-22?04:15??VoxelHashing-master\DepthSensing\DXUT\Optional\DXUTOpt_2008.vcproj
?????文件????????1581??2017-02-22?04:15??VoxelHashing-master\DepthSensing\DXUT\Optional\DXUTOpt_2010.sln
?????文件???????17939??2017-02-22?04:15??VoxelHashing-master\DepthSensing\DXUT\Optional\DXUTOpt_2010.vcxproj
?????文件????????1412??2017-02-22?04:15??VoxelHashing-master\DepthSensing\DXUT\Optional\DXUTOpt_2010.vcxproj.filters
?????文件???????56672??2017-02-22?04:15??VoxelHashing-master\DepthSensing\DXUT\Optional\DXUTcamera.cpp
?????文件???????20553??2017-02-22?04:15??VoxelHashing-master\DepthSensing\DXUT\Optional\DXUTcamera.h
?????文件??????235353??2017-02-22?04:15??VoxelHashing-master\DepthSensing\DXUT\Optional\DXUTgui.cpp
?????文件???????45912??2017-02-22?04:15??VoxelHashing-master\DepthSensing\DXUT\Optional\DXUTgui.h
............此處省略3268個文件信息
評論
共有 條評論