1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- #include <QCoreApplication>
- #include "transfusion_call.h"
- transfusion_call * gptf;
- #include <pcl/io/pcd_io.h>
- #include <QFile>
- void LoadBin(pcl::PointCloud<pcl::PointXYZI>::Ptr & point_cloud,std::string strpath)
- {
- pcl::PointXYZI xp;
- point_cloud->height = 1;
- QFile xFile;
- xFile.setFileName(strpath.data());
- if(xFile.open(QIODevice::ReadOnly))
- {
- while(1)
- {
- float x,y,z,i,ring;
- int nread;
- // std::cout<<"float size : "<<sizeof(float)<<std::endl;
- nread = xFile.read((char *)&x,sizeof(float));
- if(nread < 1)break;
- xFile.read((char *)&y,sizeof(float));
- xFile.read((char *)&z,sizeof(float));
- xFile.read((char *)&i,sizeof(float));
- // xFile.read((char *)&ring,sizeof(float));
- // std::cout<<x<<" "<<y<<" "<<z<<" "<<i<<std::endl;
- xp.x = x; xp.y = y; xp.z = z; xp.intensity = i ;
- std::cout<<" x: "<<xp.x<<" y:"<<xp.y<<" z:"<<xp.z<<" int:"<<xp.intensity<<" ring:"<<ring<<std::endl;
- point_cloud->points.push_back(xp);++point_cloud->width;
- }
- }
- xFile.close();
- // pcl::io::savePCDFile("/home/nvidia/kittypcd.pcd",*point_cloud);
- }
- void testdet(std::string & path)
- {
- pcl::PointCloud<pcl::PointXYZI>::Ptr point_cloud(
- new pcl::PointCloud<pcl::PointXYZI>());
- // pcl::io::loadPCDFile<pcl::PointXYZI>(path,*point_cloud);
- LoadBin(point_cloud, path);
- std::vector<Box3D> det_boxes3d;
- int i;
- for(i=0;i<10;i++)
- {
- gptf ->detect(point_cloud,det_boxes3d);
- std::cout<<" box size: "<<det_boxes3d.size()<<std::endl;
- }
- }
- int main(int argc, char *argv[])
- {
- QCoreApplication a(argc, argv);
- gptf = new transfusion_call();
- std::string strpath = "/home/nvidia/data/tem/000005.bin";// "/home/nvidia/1.pcd"; //
- testdet(strpath);
- return a.exec();
- }
|