使用PCL::GPU::遇到问题
一:使用GPU進(jìn)行點云分割,理論上可以極大地加快分割速度;
????? 于是對PCL1.7.1進(jìn)行了編譯,回到32位系統(tǒng),重設(shè)QT,編譯成功(時間好漫長,一定要配置仔細(xì),否則編譯一次又一次浪費(fèi)更多時間);
使用時:
#include < pcl/gpu/segmentation/gpu_extract_cluster.h>或者
#include < pcl/gpu/segmentation/gpu_extract_cluster.h>
函數(shù)里面添加代碼:
// Get params from function in
float???????????????????????????????????????????????????????tolerance?=m_DistanceThre;
unsigned?int??????????????????????????????????????min_pts_per_cluster?=MaxCloudNum;
unsigned?int??????????????????????????????????????max_pts_per_cluster?=MinCloudNum;
std::vector<pcl::PointIndices>?????????????????????????????????????cluster_indices;
//define the extractor
pcl::gpu::EuclideanClusterExtraction?ec;
pcl::gpu::DeviceArray<pcl::PointXYZ>???DevicePointArray(CloudSrc->size());?? // allocation the new GPU memory!
pcl::gpu::EuclideanClusterExtraction::GPUTreePtr?treeGPU(new?pcl::gpu::EuclideanClusterExtraction::GPUTree);
treeGPU->setCloud(DevicePointArray);
//Set paramS!
ec.setSearchMethod?(treeGPU);
ec.setClusterTolerance?(tolerance);
ec.setMinClusterSize?(MinCloudNum);//ec.setMinClusterSize?(100)
ec.setMaxClusterSize?(MaxCloudNum);//ec.setMaxClusterSize?(25000)
ec.setHostCloud?(CloudSrc);
//ec.setInput?(DevicePointArray);
ec.extract(cluster_indices);
由此轉(zhuǎn)入函數(shù)調(diào)用? ,編譯出現(xiàn)問題? 工程出現(xiàn)重定義,反復(fù)修改幾次
設(shè)置 extract 函數(shù)里面調(diào)用的函數(shù)為全局函數(shù),消除了兩個重定義;不過extract本身不能消除,也無法設(shè)置為靜態(tài)成員函數(shù);
二:沒有辦法,注釋掉gpu_extract_cluster.cpp里面的HPP包含,
重新加入庫,編譯庫,最后還是沒有成功,出現(xiàn)同樣問題。發(fā)現(xiàn)時源代碼的問題
三:把gpu_extract_cluster.hpp 和gpu_extract_cluster.h從源代碼里面抽離出來,
gpu_extract_cluster.hpp 修改為gpu_extract_cluster.cpp
把gpu_extract_cluster.cpp 和gpu_extract_cluster.h添加到項目里面
程序編譯成功。
四:編譯成功可以運(yùn)行,
待程序運(yùn)行到gpu_extract_cluster.cpp 的extract函數(shù)里面,
if( !tree_->isBuilt() )
{
tree_->build();//
}
建立八叉樹的時候,顯卡驅(qū)動出現(xiàn)崩潰!瞬間我快要心碎的哭了,這可如何是好啊!
錯誤提示:
?????? AviTest.exe 中的 0x74a71ee9 處有未經(jīng)處理的異常: Microsoft C++ 異常: 內(nèi)存位置 0x035ded58 處的 thrust::system::system_error。
這可到頭了,trust雖然可以像C++庫一樣被使用,我可,沒有時間再去調(diào)試這個東西了,一股蛋蛋的淡疼的感覺。
最終定位到 afxmem.cpp,定位到323下一句要執(zhí)行的語句:
320#if?!defined(_AFX_NO_DEBUG_CRT)?&&?defined(_DEBUG)321pResult?=?_malloc_dbg(nSize,?_NORMAL_BLOCK,?NULL,?0);
322#else
323pResult?=?malloc(nSize);
324#endif
(tree_->build()行提示 treesize =4915200 702000個pointxyz ,
而 pResult?=?malloc(nSize);提示為nSize=4294967295,坑死人的大空間,怎么分配啊!)
這難道是顯卡驅(qū)動有問題?還是CUDA有問題,我只能孤獨(dú)地在黑夜里提心吊膽地摸索著前行,一步一磕絆,痛苦不堪.....
路慢慢其修遠(yuǎn)兮,不想探索了!!!先放下,哪天想起來或者發(fā)現(xiàn)自己的錯誤在哪里了,再回頭解決.
總結(jié)
以上是生活随笔為你收集整理的使用PCL::GPU::遇到问题的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 天天象棋神1什么水平
- 下一篇: OnLineML一:关于Jubatus