当前位置: 首页 > news >正文

移动网站开发 书网络公司网站asp

移动网站开发 书,网络公司网站asp,php开发网站优势,新闻发布会视频后续使用了fpfh特征作为训练数据#xff0c;遇到了一些困难 首先是flann冲突#xff0c;这个将opcv中的flann都改成了flann2就可以运行 后面在将得到的33特征值进行训练的时候一直内存超限#xff0c;传输的不太好#xff0c;到现在还是不行#xff0c;改了三天还是没有改…后续使用了fpfh特征作为训练数据遇到了一些困难 首先是flann冲突这个将opcv中的flann都改成了flann2就可以运行 后面在将得到的33特征值进行训练的时候一直内存超限传输的不太好到现在还是不行改了三天还是没有改好先放这里吧等后续有时间进行修改我感觉是传输的问题。 #pragma warning(disable:4996) #include iostream #include pcl/io/pcd_io.h #include pcl/point_types.h #include pcl/visualization/pcl_visualizer.h //点云显示 #include pcl/visualization/cloud_viewer.h #include pcl/visualization/point_cloud_color_handlers.h //数据组织 #include boost/thread/thread.hpp #include boost/thread/thread_time.hpp #includeflann/flann.h #include thread #include pcl/search/kdtree.h // #include omp.h //补充点云特征 #include pcl/features/normal_3d.h #include pcl/features/normal_3d_omp.h #include pcl/features/shot_omp.h #include pcl/features/shot.h #include pcl/features/fpfh_omp.h #include pcl/features/pfh.h #include pcl/features/normal_3d.h#include opencv2/opencv.hppint main() {// 读取初始点云pcl::PointCloudpcl::PointXYZ::Ptr cloud(new pcl::PointCloudpcl::PointXYZ);pcl::PCDReader reader;reader.read(svmtest.pcd, *cloud);cout 初始点云读取完成 endl;// 读取带标签的点云pcl::PointCloudpcl::PointXYZL::Ptr labeledCloud(new pcl::PointCloudpcl::PointXYZL);reader.read(svmlearn_xyzl.pcd, *labeledCloud);cout 标签点云读取完成 endl;// 计算法线pcl::PointCloudpcl::Normal::Ptr normals(new pcl::PointCloudpcl::Normal);pcl::NormalEstimationpcl::PointXYZL, pcl::Normal normalEstimation;normalEstimation.setInputCloud(labeledCloud);pcl::search::KdTreepcl::PointXYZL::Ptr kdtree(new pcl::search::KdTreepcl::PointXYZL);normalEstimation.setSearchMethod(kdtree);normalEstimation.setKSearch(20); // 设置法线估计时近邻点的数量normalEstimation.compute(*normals); cout 发线计算完成 endl;将法线和原始点云拼接起来//pcl::PointCloudpcl::PointNormal::Ptr cloudWithNormals(new pcl::PointCloudpcl::PointNormal);//pcl::concatenateFields(*cloud, *normals, *cloudWithNormals);// 将法线和原始点云拼接起来//pcl::PointCloudpcl::PointNormal::Ptr cloudWithNormals(new pcl::PointCloudpcl::PointNormal);pcl::PointCloudpcl::PointXYZLNormal::Ptr cloudWithNormals(new pcl::PointCloudpcl::PointXYZLNormal);cloudWithNormals-resize(cloud-size());for (size_t i 0; i cloud-size(); i) {cloudWithNormals-points[i].x cloud-points[i].x;cloudWithNormals-points[i].y cloud-points[i].y;cloudWithNormals-points[i].z cloud-points[i].z;cloudWithNormals-points[i].normal_x normals-points[i].normal_x;cloudWithNormals-points[i].normal_y normals-points[i].normal_y;cloudWithNormals-points[i].normal_z normals-points[i].normal_z;}cout cloudWithNormals的点云数量为 cloudWithNormals-size() endl;cout 法线和原始点云合并完成 endl;// 读取法线和曲率特征// pcl::PointCloudpcl::FPFHSignature33::Ptr features(new pcl::PointCloudpcl::FPFHSignature33);// 计算带标签点云的FPFH特征pcl::FPFHEstimationOMPpcl::PointXYZL, pcl::Normal, pcl::FPFHSignature33 fpfh_src;fpfh_src.setInputCloud(labeledCloud);fpfh_src.setInputNormals(normals);fpfh_src.setNumberOfThreads(10);pcl::search::KdTreepcl::PointXYZL::Ptr kdtree2(new pcl::search::KdTreepcl::PointXYZL);fpfh_src.setSearchMethod(kdtree2);cout 开始计算点云特征 endl;pcl::PointCloudpcl::FPFHSignature33::Ptr features(new pcl::PointCloudpcl::FPFHSignature33());fpfh_src.setKSearch(20);fpfh_src.compute(*features);// 开始计算前上锁omp_lock_t lock;omp_init_lock(lock);// 使用 OpenMP 设置锁 #pragma omp parallel{ #pragma omp single{ #pragma omp task{fpfh_src.compute(*features);}}}// 计算完成后解锁omp_destroy_lock(lock);cout 读取法线和曲率特征完成 endl;// 准备训练数据和标签cv::Mat trainingData(labeledCloud-size(), 33, CV_32FC1); // 注意特征的维度cv::Mat labels(labeledCloud-size(), 1, CV_32SC1);std::cout labeledCloud size: labeledCloud-size() std::endl;std::cout features size: features-size() std::endl;for (size_t i 0; i labeledCloud-size(); i){// 使用法线和曲率特征for (int j 0; j 33; j){if (i features-size()){ // 添加索引范围检查trainingData.atfloat(i, j) features-points[i].histogram[j];}else {std::cerr Index out of range for features at i i and j j std::endl;}}// 根据点的标签设置标签数据if (i labeledCloud-size()) { // 添加索引范围检查labels.atint(i, 0) labeledCloud-points[i].label;}else {std::cerr Index out of range for labeledCloud at i i std::endl;}}cout 根据点的标签设置标签数据完成 endl;// 创建并训练SVM分类器cv::Ptrcv::ml::SVM svm cv::ml::SVM::create();svm-setType(cv::ml::SVM::C_SVC);svm-setKernel(cv::ml::SVM::RBF);svm-setC(10);svm-setGamma(0.001);svm-train(trainingData, cv::ml::ROW_SAMPLE, labels);cout 创建并训练SVM分类器完成正在开始对点云进行分类 endl;// 对初始点云进行分类//cv::Mat testData(cloud-size(), 3, CV_32FC1);//for (size_t i 0; i cloud-size(); i) //{// testData.atfloat(i, 0) cloud-points[i].x;// testData.atfloat(i, 1) cloud-points[i].y;// testData.atfloat(i, 2) cloud-points[i].z;//}cv::Mat testData(cloud-size(), 33, CV_32FC1);for (size_t i 0; i cloud-size(); i){for (int j 0; j 33; j) {testData.atfloat(i, j) features-points[i].histogram[j];}}cv::Mat predictedLabels;/* svm-predict(testData, predictedLabels);*/try {svm-predict(testData, predictedLabels);}catch (cv::Exception e) {std::cerr OpenCV Exception: e.what() std::endl;}cout 正在将分类结果添加到点云中 endl;// 将分类结果添加到点云中pcl::PointCloudpcl::PointXYZL::Ptr classifiedCloud(new pcl::PointCloudpcl::PointXYZL);classifiedCloud-resize(cloud-size());for (size_t i 0; i cloud-size(); i) {classifiedCloud-points[i].x cloud-points[i].x;classifiedCloud-points[i].y cloud-points[i].y;classifiedCloud-points[i].z cloud-points[i].z;// 修正标签值假设标签是 0 或 1classifiedCloud-points[i].label static_castint(predictedLabels.atfloat(i, 0)) 1;}pcl::PCDWriter writer;writer.write(lable.pcd, *classifiedCloud);cout lable.pcd已完成储存请查看 endl;//----------------------------根据分类标签可视化-----------------------------boost::shared_ptrpcl::visualization::PCLVisualizer viewer(new pcl::visualization::PCLVisualizer(3D Viewer));pcl::visualization::PointCloudColorHandlerGenericFieldpcl::PointXYZLfildColor(classifiedCloud, label);viewer-setBackgroundColor(0, 0, 0);viewer-setWindowName(点云按分类标签显示);viewer-addText(Point clouds are shown by label, 50, 50, 0, 1, 0, v1_text);viewer-addPointCloudpcl::PointXYZL(classifiedCloud, fildColor, sample cloud);viewer-setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 1, sample cloud);while (!viewer-wasStopped()){viewer-spinOnce(100);boost::this_thread::sleep(boost::posix_time::microseconds(100000));}return 0; }
http://www.pierceye.com/news/689842/

相关文章:

  • wordpress数据量大网站访问石家庄网站建设招商
  • 公司核名在哪个网站免费申请无限流量卡
  • 做网站和网页的目的和作用是什么山西2地又检出阳性
  • 自助网站建设推广优化策略wordpress中文采集插件
  • 网站开发及运营成本做网站 公司 个体
  • 永久免费建站地址苏州h5网站建设价钱
  • 室内设计网站网站建设中请稍后再访问
  • 十堰网站开发培训编程软件手机
  • 南京网站优化推广微网站缺点
  • 大连零基础网站建设培训哪里有固安县建设局网站
  • 怎么制作网站首页培训心得体会总结简短
  • 商务网站建设 模板长春高端品牌网站建设
  • 做网站比较便宜办公资源网
  • 公司怎么做网页网站遵义网站设计公司
  • 网站建设毕业设计yy直播回放
  • 响应式网站有哪些2017淮南网络推广报价
  • 兰州公司网站建设网站建设筹备方案
  • 租房网站建设做一个跨境电商网站
  • 网站设计制作过程容桂做pc端网站
  • 宜昌市上海中学官网seo文章外包
  • 加强普法网站建设的通知制作婚恋网站
  • 北大荒建设集团有限公司网站网站添加在线qq聊天
  • 网站首页被k咋办上海市企业服务云登录
  • 长安镇网站建设公司大网站制作公司
  • 衡水做网站推广找谁廊坊百度推广排名优化
  • 网站建设毕业报告wordpress微信登录页面
  • 外包网站建设费用包括网站备份crm系统有哪些
  • 高端网站设计推广v信haotg8wordpress 付费后查看
  • cms管理手机网站长春做网站好的公司
  • 可信网站认证 技术支持单位沈阳又一烂尾项目复工