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

matlab点云的可视化-源码复制粘贴即可(一)

 一、导入并可视化一个无属性的点云

clc; clear; close; % clear everything% Import a point cloud from a plain text file (run type('Lion.xyz') to see the contents of the file)
pc = pointCloud('Lion.xyz');% Generate a z-colored view of the point cloud
pc.plot;% Set three-dimensional view and add title
view(3); title('Z-colored plot of point cloud', 'Color', 'w');

 

二、导入并加载一个有属性的点云

clc; clear; close; % clear everything% Import point cloud with attributes (nx, ny, nz are the components of the normal vectors)
pc = pointCloud('Lion.xyz', 'Attributes', {'nx' 'ny' 'nz' 'roughness'});% Plot point cloud colored according to imported attribute 'roughness'
pc.plot('Color', 'A.roughness', ... % attribute to plot'MarkerSize', 5); % size of points% Set three-dimensional view and add title
view(3); title('Point cloud colored by roughness point attribute', 'Color', 'w');

 三、从矩阵中导入点云

 

clc; clear; close; % clear everything% Generate points on a unit sphere
[x, y, z] = sphere(100);
x = x(:); y = y(:); z = z(:);% Import points and define a label for the point cloud
pc = pointCloud([x y z], 'Label', 'sphere');% Plot point cloud
pc.plot('MarkerSize', 5);% Set three-dimensional view and add title
view(3); title('Sphere', 'Color', 'w');

 四、点云的rgb色图

clc; clear; close; % clear everything% Import point cloud with attributes red, green and blue
pc = pointCloud('Dino.xyz', 'Attributes', {'r' 'g' 'b'});% Plot point cloud
pc.plot('Color', 'A.rgb', ... % rgb-colored plot'MarkerSize', 5); % size of points% Set three-dimensional view and add title
view(110,0); title('RGB-colored point cloud', 'Color', 'w');

 

五、导入两个点云,并以不同的颜色可视化它们

clc; clear; close; % clear everything% Import point clouds
scan1 = pointCloud('LionScan1.xyz');
scan2 = pointCloud('LionScan2.xyz');% Plot
scan1.plot('Color', 'y'); % yellow
scan2.plot('Color', 'm'); % magenta% Set three-dimensional view and add title
view(3); title('Scan1 (=yellow) and scan2 (=magenta)', 'Color', 'w');

 六、选择点的子集(即过滤/稀释点云)并将它们导出到文本文件

clc; clear; close; % clear everything% Import point cloud
pc = pointCloud('Lion.xyz', 'Attributes', {'nx' 'ny' 'nz' 'roughness'});% Select a random subset of points
pc.select('RandomSampling', 5); % select randomly 5 percent of points% Export selected points to a plain text file with attributes
pc.export('LionSubset.xyz', 'Attributes', {'nx' 'ny' 'nz' 'roughness'});% Plot
pc.plot('MarkerSize', 5);% Set title
title('Z-colored plot of a subset of points', 'Color', 'w');

 

注意:属性pc。Act是一个n × 1的逻辑向量,定义每个点是活动(true)还是不活动(false)。
大多数方法只适用于活动点。

七、计算点云的法线并可视化它们

clc; clear; close; % clear everything% Import point cloud
pc = pointCloud('Lion.xyz');% Select a random subset of points
pc.select('RandomSampling', 1); % select randomly 1 percent of points% Calculate normals (normals are only calculated for the selected points)
pc.normals(2); % search radius is 2% Plot point cloud and normals
pc.plot('MarkerSize', 5);
pc.plotNormals('Scale', 10, 'Color', 'y'); % lenght of normals is 10% Set three-dimensional view and add title
view(3); title('Normal vectors', 'Color', 'w');

 八、变换点云 Transform a point cloud

clc; clear; close; % clear everything% Import point cloud
pc = pointCloud('Lion.xyz');% Plot original point cloud
pc.plot('Color', 'y');% Transformation with a rotation angle of 100 gradians about the z axis
pc.transform(1, opk2R(0, 0, 100), zeros(3,1)); % opk2R generates a rotation matrix from 3 rotation angles (about the x, y and z axis / units = gradian!)% Plot transformed point cloud
pc.plot('Color', 'm'); title('Point cloud transformation', 'Color', 'w');

 

九、保存和加载点云

clc; clear; close; % clear everything% Import point cloud
pc = pointCloud('Lion.xyz');% Save to mat file
pc.save('Lion.mat');% Clear point cloud
clear pc;% Load point cloud from mat file
pcLoaded = pointCloud('Lion.mat');% Plot
pcLoaded.plot;% Set three-dimensional view and add title
view(3); title('Point cloud loaded from mat file', 'Color', 'w');

 十、创建一个对象的副本,并选择其中的点子集

clc; clear; close; % clear everything% Import point cloud
pc = pointCloud('Stone.ply'); % attributes from ply file are imported automatically% Create an indipendent copy of the object
pcCopy = pc.copy;% Select a subset of points and remove all non active points
pcCopy.select('UniformSampling', 40); % uniform sampling with mean sampling distance of 40 mm
pcCopy.reconstruct;% Plot both point clouds
pc.plot('Color', 'y', 'MarkerSize', 1);
pcCopy.plot('Color', 'r', 'MarkerSize', 10);
view(3); title('Original point cloud (yellow) and filtered point cloud (red)', 'Color', 'w');

 

相关文章:

matlab点云的可视化-源码复制粘贴即可(一)

一、导入并可视化一个无属性的点云 clc; clear; close; % clear everything% Import a point cloud from a plain text file (run type(Lion.xyz) to see the contents of the file) pc pointCloud(Lion.xyz);% Generate a z-colored view of the point cloud pc.plot;% Set …...

反射-Class类分析

反射相关的主要类 java.lang.Class:代表一个类,Class对象表示某个类加载后在堆中的对象java.lang.reflect.Method:代表类的方法,Method对象表示某个类的方法java.lang.reflect.Field:代表类的成员变量,Fie…...

Let’s Make C++ Great Again——string与常用字符处理函数

文章目录 string使用string类的例子,统计一个字符串中单词的个数:在算法模拟题中翻转字符串:判断回文字符串:字符串查找:字符串替换: 常用字符处理函数strlen()strcpy()strcat()strcmp()toupper() 和 tolow…...

〖Python网络爬虫实战⑰〗- 网页解析利器parsel实战

订阅:新手可以订阅我的其他专栏。免费阶段订阅量1000 python项目实战 Python编程基础教程系列(零基础小白搬砖逆袭) 说明:本专栏持续更新中,目前专栏免费订阅,在转为付费专栏前订阅本专栏的,可以免费订阅付…...

中电金信:生成式AI热潮下,文本智能走向何方?

突破通用人工智能场景,生成式AI正在向全行业应用进攻。 一个脑筋急转弯,几个月前ChatGPT是这样回答的: 然而,仅仅几个月的迭代,它的回答却让人出乎意料。 看似调侃的对比背后实则是无数次模型训练的支撑。基于数据的激…...

探索Linux设备树:硬件描述与驱动程序的桥梁

目录标题 引言:Linux设备树简介 | Introduction: Linux Device Tree Overviewa. 设备树的背景与发展 | Background and Development of Device Treeb. 设备树的作用与意义 | The Role and Significance of Device Tree 设备树语法与结构 | Device Tree Syntax and S…...

UNION ALL用法 以及 UNION ALL和UNION的区别

部分参考自文章: https://blog.csdn.net/a200822146085/article/details/119545374(CC 4.0 BY-SA版权协议)CSDN「我心依依旧」 https://www.1keydata.com/cn/sql/sql-unionall.php SQL Union All SQL指令 UNION ALL用法 UNION ALL 这个指令的目的也是要将两个 SQL 语…...

Ubuntu Linux操作

引言 晚上上课发现桌子上遗留了这本书,水课就看了看学习下,以下内容直接总结知识点 磁盘内存解析 (1)硬盘有数个盘片,每个盘片两个面,每个面一个磁头。 (2)盘片被划分为多个扇形区域即扇区。 (3)同一盘片不同半径的同心圆为磁道。 (4)不同盘片相同半径…...

MongoDB常用语句(CURD)

文章目录 一、数据库操作二、集合操作三、文档操作3.1 插入文档3.2 查询文档3.3 更新文档3.4 删除文档 四、安全认证4.1 创建管理员账号4.2 创建应用数据库用户4.3 启动和连接 (校验方式) 提示:以下是本篇文章正文内容,MongoDB 系列学习将会持续更新 一…...

一篇文章让你彻底学会--节流(并且自己可以手写)

Hi,有的小伙伴们在面试的时候会被要求手写节流函数,很多都被难着了吧,宝贝,那你你没有理解节流函数。 今天,就让我带你攻克它! 1.节流 单位时间内,事件触发,最多只执行一次事件回调。 人话:说…...

C++ 形参是类的指针 class * 通过new的方式创建对象

当你在C中使用类指针(class *)作为函数的形参,并通过 new 关键字创建对象时,这种用法确实会改变类对象的值。原因是你通过指针传递了对象的内存地址,而不是传递对象本身。这意味着在函数内部对对象的任何修改都会直接影…...

手把手教你将项目部署到服务器!

一、导入centos7虚拟机: 打开VMWare,点击“打开虚拟机”,选择centos7.ova之后,选择存储路径: 点击导入: 选择“不再显示此消息”,点击“重试”按钮: 点击“编辑虚拟机设置”&#x…...

OpenHarmony应用开发-ArkUI方舟开发框架简析

方舟开发框架(简称ArkUI)为OpenHarmony应用的UI开发提供了完整的基础设施,包括简洁的UI语法、丰富的UI功能(组件、布局、动画以及交互事件),以及实时界面预览工具等,可以支持开发者进行可视化界…...

【Transformer系列(4)】Transformer模型结构超详细解读

前言 前一篇我们一起读了Transformer的论文《Attention Is All You Need》,不知道大家是否真的理解这个传说中的神(反正俺是没有~) 这两天我又看了一些视频讲解,感谢各位大佬的解读,让我通透了不少。 这篇文章就和…...

Idea启动运行报错:Error:java: 无效的源发行版: 13

最近在做Springboot项目时,常常出现上述错误,小编也不知道怎么回事,到网上找了这个方面的解决办法,但是却发现根本解决不了,最终通过小编多次尝试,终于发现,为什么会报这个错误。(应该是Java版本…...

【元分析研究方法】学习笔记1.形成问题

步骤1 形成问题 该步骤的作用该步骤中需要注意的问题该步骤中部分知识点我的收获 参考来源:库珀 (Cooper, H. M. )., 李超平, & 张昱城. (2020). 元分析研究方法: A step-by step approach. 中国人民大学出版社. 这章内容很简单:①变量的刻画&#x…...

2023年3月 青少年软件编程(Python) 等级考试试卷(五级)

一、单选题(共25题,共50分) 1.已知一个列表lst [2,3,4,5,6],lst.append(20),print(lst)的结果是?(C)(2分) A.[10,2,3,4,5,6,20] B.[20,2,10,3,4,5,6] C.[2,3,4,5,6,20] D.[2,3,4,5,…...

必须要知道的hive调优知识(上)

Hive数据倾斜以及解决方案 1、什么是数据倾斜 数据倾斜主要表现在,map/reduce程序执行时,reduce节点大部分执行完毕,但是有一个或者几个reduce节点运行很慢,导致整个程序的处理时间很长,这是因为某一个key的条数比其…...

什么是Cache Aside Pattern与延迟双删

Cache Aside Pattern是一种常用的缓存设计模式,用于在应用程序中使用缓存提高系统性能的同时,避免缓存与数据库数据不一致的情况出现。延迟双删是Cache Aside Pattern的一种优化,可以进一步提高系统性能。 以下是关于Cache Aside Pattern和延…...

frp 流量特征

frp 流量特征 非常明显的明文流量特征...

Unity --- UGUI(Unity Graphical user interface)--- Canvas画布

1.UI --- User Interface --- 使用者与机器之间的交互界面 1.所谓的自适应系统指的是分辨率的适应: 比如在一个分辨率下做的UI放到另一个分辨率下显示时,如果没有自适应系统的话就会导致UI过大,过小,被辟成一半等等情况&#xff…...

c++积累6-内联函数

1、说明 内联函数是c为提高程序运行速度所做的一项改进。 2、常规函数运行 编译的可执行程序:由一组机器语言指令组成。 程序执行: 1、操作系统将这些指令载入到内存,每条指令都有一个特定的内存地址 2、计算机逐步执行这些指令 3、如果有…...

ESP32学习笔记13-MCPWM主要用于无刷电机驱动

16.MCPWM 16.1概述 ESP32 有两个 MCPWM 单元,可用于控制不同类型的电机。每个单元都有三对PWM输出 每个 A/B 对可由三个定时器定时器 0、1 和 2 中的任何一个计时。 同一定时器可用于为多对PWM输出提供时钟。 每个单元还能够收集输入,例如,检测电机过电流或过电压,以及获得…...

MyBatis-plu 和 JPA 对比

提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档 MyBatis-plu 和 JPA 前言一、说下相同点二、差异点一、从实现来说:CURD实现方式不一样二、分页上三、雪花id四、伪删除五、子类排除父类的字段 总结 前言 提示&…...

一文详解Python中多进程和进程池的使用方法

这篇文章将介绍Python中多进程和进程池的使用方法,并提供一些实用的案例供大家参考,文中的示例代码讲解详细,感兴趣的小伙伴可以了解一下 目录 Python是一种高级编程语言,它在众多编程语言中,拥有极高的人气和使用率。…...

前端部署发布项目后,如何通知用户刷新页面、清除缓存

以下只是一些思路,有更好的实现方式可以留言一起交流学习 方式一:纯前端 在每次发布前端时,使用webpack构建命令生成一个json文件,json中写个随机生成的一个字符串(比如时间戳),每次打包程序都…...

项目上线|慕尚集团携手盖雅工场,用数字化推动人效持续提升

过去十年,中国零售业以前所未有的速度被颠覆、被重塑,数字化则是其中重要的推动要素。 随着数字化转型的深入,零售企业的数字化不再局限于布局线上渠道,且更关乎其背后企业核心运营能力的全链路数字化改造。而贯穿于运营全链路的…...

Java重载 与封装、继承

方法重载 在同一个类中,出现了方法名相同,参数不同的方法时 ,我们叫方法重载 作用:根据不同参数,选择不同方法 实例 public static void main(String[] args){public int add(int a,int b){return ab;}public double…...

sed正则表达式替换字符方法

在 Linux 命令行中&#xff0c;可以使用 sed 命令来替换指定文件中的指定字符。具体方法如下&#xff1a; sed -i s/<old_string>/<new_string>/g <filename>其中&#xff0c;<old_string> 表示要被替换的字符串&#xff0c;<new_string> 表示替…...

不讲废话普通人了解 ChatGPT——基础篇第一课

wx供重浩&#xff1a;创享日记 获取更多内容 文章目录 前言什么是 ChatGPT它是如何工作的ChatGPT 和其它机器人有什么不同 前言 不知道大家在第一次会使用 ChatGPT 并尝试和他对话时有没有感到震惊。当ChatGPT首次推出时&#xff0c;我立即被它的功能所吸引。 曾经在遇到繁杂…...