[python-pdal]python-pdal安装后测试代码

devtools/2024/9/25 14:09:10/

测试代码:

import pdal
import tiledbdata = "1.2-with-color.las"pipeline = pdal.Reader.las(filename=data).pipeline()
print(pipeline.execute())  # 1065 points# Get the data from the first array
# [array([(637012.24, 849028.31, 431.66, 143, 1,
# 1, 1, 0, 1,  -9., 132, 7326, 245380.78254963,  68,  77,  88),
# dtype=[('X', '<f8'), ('Y', '<f8'), ('Z', '<f8'), ('Intensity', '<u2'),
# ('ReturnNumber', 'u1'), ('NumberOfReturns', 'u1'), ('ScanDirectionFlag', 'u1'),
# ('EdgeOfFlightLine', 'u1'), ('Classification', 'u1'), ('ScanAngleRank', '<f4'),
# ('UserData', 'u1'), ('PointSourceId', '<u2'),
# ('GpsTime', '<f8'), ('Red', '<u2'), ('Green', '<u2'), ('Blue', '<u2')])
arr = pipeline.arrays[0]# Filter out entries that have intensity < 50
intensity = arr[arr["Intensity"] > 30]
print(len(intensity))  # 704 points# Now use pdal to clamp points that have intensity 100 <= v < 300
pipeline = pdal.Filter.range(limits="Intensity[100:300)").pipeline(intensity)
print(pipeline.execute())  # 387 points
clamped = pipeline.arrays[0]# Write our intensity data to a LAS file and a TileDB array. For TileDB it is
# recommended to use Hilbert ordering by default with geospatial point cloud data,
# which requires specifying a domain extent. This can be determined automatically
# from a stats filter that computes statistics about each dimension (min, max, etc.).
pipeline = pdal.Writer.las(filename="clamped.las",offset_x="auto",offset_y="auto",offset_z="auto",scale_x=0.01,scale_y=0.01,scale_z=0.01,
).pipeline(clamped)
print(dir(pdal))
pipeline |= pdal.Filter.stats() | pdal.Writer.pcd(filename="result.pcd")
print(pipeline.execute())  # 387 points

结果:

会在目录下面生成一个result.pcd文件

我们用PCDViewer打开查看pcd文件

完整测试代码下载地址: pdal_python_test.zip - 蓝奏云


http://www.ppmy.cn/devtools/116999.html

相关文章

Oracle 物化视图创建(materialized)

要想创建 “物化视图&#xff0c;至少具有 ‘CREATE MATERIALIZED VIEW’ 权限” -- 权限查询&#xff0c;非 DBA 用户&#xff0c;则使用 user_sys_privs 即可 SELECT * FROM dba_sys_privs t WHERE t.privilege LIKE %MATERIALIZED%; grant create materialized view to sco…

第十四届蓝桥杯嵌入式国赛

一. 前言 本篇博客主要讲述十四届蓝桥杯嵌入式的国赛题目&#xff0c;包括STM32CubeMx的相关配置以及相关功能实现代码以及我在做题过程中所遇到的一些问题和总结收获。如果有兴趣的伙伴还可以去做做其它届的真题&#xff0c;可去 蓝桥云课 上搜索历届真题即可。 二. 题目概述 …

智能养殖场人机交互检测系统源码分享

智能养殖场人机交互检测检测系统源码分享 [一条龙教学YOLOV8标注好的数据集一键训练_70全套改进创新点发刊_Web前端展示] 1.研究背景与意义 项目参考AAAI Association for the Advancement of Artificial Intelligence 项目来源AACV Association for the Advancement of Co…

视频压缩怎么操作?3款工具轻松告别内存不足的困扰

是不是越来越多的朋友都在用视频记录日常的点滴啊&#xff1f; 是不是想着把视频发到分享平台上&#xff0c;却发现视频的时长超过了平台的限制&#xff0c;没办法直接上传&#xff1f; 想找好用的视频压缩软件手机版&#xff0c;却发现都是需要付费的&#xff1f; 别急&…

ArcGIS Pro SDK (十五)共享

ArcGIS Pro SDK (十五)共享 文章目录 ArcGIS Pro SDK (十五)共享1 ArcGIS 项目管理器:获取当前活动门户2 ArcGIS 项目管理器:获取所有门户的列表3 ArcGIS 项目管理器:将门户添加到门户列表4 ArcGIS 项目管理器:获取门户并登录,将其设置为活动状态5 ArcGIS 程序管理器:…

QT——多线程操作

一、单线程和多线程的区别 单线程指的是程序在执行时只有一个流程,也就是一次只能执行一个任务。当程序中某个任务需要花费大量时间时,单线程会导致整个程序阻塞,用户体验会变差。 多线程则是指程序在执行时可以同时执行多个任务,每个任务都是一个独立的线程。多线程可以…

清华大学开源 CogVideoX-5B-I2V 模型,以支持图生视频

CogVideoX 是源于清影的开源视频生成模型。 下表列出了我们在此版本中提供的视频生成模型的相关信息。 Model NameCogVideoX-2BCogVideoX-5BCogVideoX-5B-I2V (This Repository)Model DescriptionEntry-level model, balancing compatibility. Low cost for running and second…

MacOS上安装MiniConda的详细步骤

前言 MiniConda是一种环境配置工具。在不同的开发项目中&#xff0c;我们会使用到不同版本的Python和第三方库&#xff08;例如Numpy、Pandas)。如果不使用环境配置工具&#xff0c;每次开发都需要清除电脑里上一次开发的环境和配置文件。为了在同一台机器上同时开发多个项目&…