日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 人文社科 > 生活经验 >内容正文

生活经验

将三维点云投影到XOZ面上

發布時間:2023/11/27 生活经验 39 豆豆
生活随笔 收集整理的這篇文章主要介紹了 将三维点云投影到XOZ面上 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??

如圖左邊是原始的三維點云pcd格式,右邊是投影到XOZ面上的數據,Y為0.

#include <iostream>
#include <pcl/filters/project_inliers.h>
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
#include <pcl/filters/statistical_outlier_removal.h>
#include <pcl/features/normal_3d.h>
#include <pcl/segmentation/extract_clusters.h>
#include <pcl/visualization/pcl_visualizer.h>
#include <pcl/visualization/cloud_viewer.h>
#include <pcl/ModelCoefficients.h>
#include<cstdlib>
#include <windows.h>
#include <pcl/console/parse.h>
#include <pcl/console/print.h>
#include <pcl/correspondence.h>
#include <boost/filesystem.hpp>using namespace pcl;
typedef PointXYZ PoinT;
int *rand_rgb()
{//隨機產生顏色int *rgb = new int[3];rgb[0] = rand() % 255;rgb[1] = rand() % 255;rgb[2] = rand() % 255;return rgb;
}int
main(int argc, char** argv)
{pcl::PointCloud<pcl::PointXYZ>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZ>);pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_projected(new pcl::PointCloud<pcl::PointXYZ>);//點云的讀取*********************************************************if (io::loadPCDFile("F://coutsaved//test//boxes//pcd//11Cloud.pcd", *cloud) == -1){PCL_ERROR("read false");return 0;}// Create a set of planar coefficients with X=Y=0,Z=1//In this case, we use a plane model, with ax+by+cz+d=0, where a=b=d=0, and c=1, or said differently, the X-Y plane.pcl::ModelCoefficients::Ptr coefficients(new pcl::ModelCoefficients());coefficients->values.resize(4);coefficients->values[0] = 0;coefficients->values[1] = 1.0;coefficients->values[2] = 0;coefficients->values[3] = 0;visualization::PCLVisualizer::Ptr viewer1(new visualization::PCLVisualizer("Remove-Y"));// Create the filtering objectpcl::ProjectInliers<pcl::PointXYZ> proj;proj.setModelType(pcl::SACMODEL_PLANE);proj.setInputCloud(cloud);proj.setModelCoefficients(coefficients);proj.filter(*cloud_projected);io::savePCDFileASCII("F://coutsaved//test//boxes//plane//removey.pcd", *cloud_projected);//保存投影到XOZ面上的點云int *rgb = rand_rgb();		//隨機生成0-255的顏色值visualization::PointCloudColorHandlerCustom<PoinT>rgb1(cloud_projected, rgb[0], rgb[1], rgb[2]);delete[]rgb;viewer1->addPointCloud(cloud_projected, rgb1, "F://coutsaved//test//boxes//plane//removey.pcd");system("pause");return (0);
}

?

總結

以上是生活随笔為你收集整理的将三维点云投影到XOZ面上的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。