python pcl学习入门
源码地址:
https://github.com/strawlab/python-pcl
pcd可视化:
# -*- coding: utf-8 -*-
# Point cloud library
import pcl
import pcl.pcl_visualization# Opencv
# import opencv
import cv2def main():a = 22b = 12c = 10# PCL Visualizer to view the pointcloud# pcl::visualization::PCLVisualizer viewer ("Simple visualizing window");viewer = pcl.pcl_visualization.PCLVisualizering()# int main (int argc, char** argv)# {# pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZRGBA>);# pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud_filtered (new pcl::PointCloud<pcl::PointXYZRGBA>);# if (pcl::io::loadPLYFile<pcl::PointXYZRGBA> (argv[1], *cloud) == -1) //* load the ply file from command line# {# PCL_ERROR ("Couldn't load the file\n");# return (-1);# }# cloud = pcl.load("lamppost.pcd")# cloud = pcl.load("Tile_173078_LD_010_017_L22.obj")cloud = pcl.load("official/Surface/bun0.pcd")# pcl::copyPointCloud( *cloud,*cloud_filtered);# cloud_filtered = cloud.copyPointCloud()cloud_filtered = cloud# float i# float j# float k# cv::namedWindow("picture");# // Creating trackbars uisng opencv to control the pcl filter limits# cvCreateTrackbar("X_limit", "picture", &a, 30, NULL);# cvCreateTrackbar("Y_limit", "picture", &b, 30, NULL);# cvCreateTrackbar("Z_limit", "picture", &c, 30, NULL);# cv2.CreateTrackbar("X_limit", "picture", a, 30)# cv2.CreateTrackbar("Y_limit", "picture", b, 30)# cv2.CreateTrackbar("Z_limit", "picture", c, 30)# // Starting the while loop where we continually filter with limits using trackbars and display pointcloud# char last_c = 0;last_c = 0# while(true && (last_c != 27))while last_c != 27:# pcl::copyPointCloud(*cloud_filtered, *cloud);# // i,j,k Need to be adjusted depending on the pointcloud and its xyz limits if used with new pointclouds.i = 0.1 * aj = 0.1 * bk = 0.1 * c# Printing to ensure that the passthrough filter values are changing if we move trackbars.# cout << "i = " << i << " j = " << j << " k = " << k << endl;print("i = " + str(i) + " j = " + str(j) + " k = " + str(k))# Applying passthrough filters with XYZ limits# pcl::PassThrough<pcl::PointXYZRGBA> pass;# pass.setInputCloud (cloud);# pass.setFilterFieldName ("y");# // pass.setFilterLimits (-0.1, 0.1);# pass.setFilterLimits (-k, k);# pass.filter (*cloud);pass_th = cloud.make_passthrough_filter()pass_th.set_filter_field_name("y")pass_th.set_filter_limits(-k, k)cloud = pass_th.filter()# pass.setInputCloud (cloud);# pass.setFilterFieldName ("x");# // pass.setFilterLimits (-0.1, 0.1);# pass.setFilterLimits (-j, j);# pass.filter (*cloud);# pass_th.setInputCloud(cloud)pass_th.set_filter_field_name("x")pass_th.set_filter_limits(-j, j)cloud = pass_th.filter()# pass.setInputCloud (cloud);# pass.setFilterFieldName ("z");# // pass.setFilterLimits (-10, 10);# pass.setFilterLimits (-i, i);# pass.filter (*cloud);# pass_th.setInputCloud(cloud)pass_th.set_filter_field_name("z")pass_th.set_filter_limits(-10, 10)cloud = pass_th.filter()# // Visualizing pointcloud# viewer.addPointCloud (cloud, "scene_cloud");# viewer.spinOnce();# viewer.removePointCloud("scene_cloud");viewer.AddPointCloud(cloud, b'scene_cloud', 0)viewer.SpinOnce()# viewer.Spin()viewer.RemovePointCloud(b'scene_cloud', 0)if __name__ == "__main__":# import cProfile# cProfile.run('main()', sort='time')main()
python pcl学习入门相关推荐
- python深度学习入门-与学习相关的技巧
深度学习入门-与学习相关的技巧 博主微信公众号(左).Python+智能大数据+AI学习交流群(右):欢迎关注和加群,大家一起学习交流,共同进步! 目录 摘要 1. 参数的更新 1.1 SGD 1.2 ...
- Python深度学习入门之plt画图工具基础使用(注释详细,超级简单)
Python自带的plt是深度学习最常用的库之一,在发表文章时必然得有图作为支撑,plt为深度学习必备技能之一.作为深度学习入门,只需要掌握一些基础画图操作即可,其他等要用到的时候看看函数API就行. ...
- [Python深度学习入门]实战一·Numpy梯度下降求最小值
[深度学习入门]实战一·Numpy梯度下降求最小值 问题描述: 求解y1 = xx -2 x +3 + 0.01*(-1到1的随机值) 与 y2 = 0 的最小距离点(x,y) 给定x范围(0,3 不 ...
- python从入门到精通 邮电出版社_《人民邮电出版社Python深度学习入门:基于PYTHON的理论与实现》【价格 目录 书评 正版】_中国图书网...
译者序 xiii 前言 xv 第 1 章 Python入门 1 1.1 Python是什么 1 1.2 Python的安装 2 1.2.1 Python版本 2 1.2.2 使用的外部库 2 1.2. ...
- Python 画图学习入门
Python:使用matplotlib绘制图表 python绘制图表的方法,有个强大的类库matplotlib,可以制作出高质量的2D和3D图形,先记录一下,以后慢慢学习. matplotlib下载 ...
- python zipfile_Python 学习入门(16)—— zipfile
zipfile 是python里用来做zip格式编码的压缩和解压缩的,由于是很常见的zip格式,所以这个模块使用频率也是比较高. zipfile里有两个非常重要的class, 分别是ZipFile和Z ...
- python 爬虫学习入门6 requests库 添加代理proxies等其他信息
Requests库 通过Requests 库 提供的方法我们可以在请求页面的时候同时添加更多的信息,在urllib库中同时添加代理和User-agent 我在网上找了一些办法但是没有理解就不在这里说了 ...
- Python深度学习入门笔记(二):使用Pandas读取批量CSV文件,文件名中有顺序变量
前言 本文主要展示如何将具有变量名称的 CSV 文件导入 Python,比如一系列连续变化的文件如: r1.csv r2.csv r3.csv - 我将使用一个简单的例子来说明这个概念,并提供完整的 ...
- Python 基础学习 --入门(了解小常识)
计算机简介: 计算机是什么? 用来计算的机器(eg:电脑.笔记本.手机.汽车导航.智能电视......) 目前来讲,计算机只能根据人类的指令完成各种操作.学习计算机,就是学会如何去控制它. 计算机的组 ...
最新文章
- DataFrame 数据去重
- Daily Scrum 11.5
- early z optimization
- bigquery 教程_bigquery挑战实验室教程从数据中获取见解
- 超干货议程发布 | 2021全球分布式云大会 · 上海站 重磅来袭
- lisp代码编写地物符号_Aroma:通过结构代码搜索推荐代码
- jquery之提示信息
- Optisystem中器件的学习(1-Visualizer Library、Sensors)
- cad图纸问号怎么转换文字_CAD打开图纸后为什么文字显示为问号?怎么解决?
- win7旗舰版激活教程
- 深度学习之 梯度消失与爆炸原因公式推导
- 亲自动手搭建微服务框架和测试环境-1-背景
- html画布里面画圆,html5 canvas 画布画圆
- CheckBox 如何改变背景色和选中时的背景颜色
- 【数理知识】Lipschitz 条件 Lipschitz 常数
- 太阳的后裔--OST.3 This love这份爱
- I/Q信号解调分析过程
- 魅族便签导出,实践中
- python3爬取微博评论api情感分析_如何科学地蹭热点:用python爬虫获取热门微博评论并进行情感分析...
- VS Code工作区用法
热门文章
- centos6.8无法安装锐速的解决方法
- VC中宽字符串换行(WCHAR字符串换行)
- Process Monitor中文手册
- Deep Learning(深度学习)学习笔记整理系列
- Linux 内核中的 Device Mapper 机制
- Linux学习路线指南
- php sql server配置文件路径,云服务器初始化 第六章:更改MySQL数据文件存放路径...
- 莫比乌斯函数_莫比乌斯环:python-matplotlib可视化实现
- html svg波浪,svg+css3做一个动感的波浪效果实现
- php判断是否已关注,php判断用户是否关注微信订阅号或公众号