当前位置:网站首页>tkinter窗口选择pcd文件并显示点云(open3d)
tkinter窗口选择pcd文件并显示点云(open3d)
2022-07-07 01:36:00 【程序员进化不脱发!】
# !/user/bin/env Python3
# -*- coding:utf-8 -*-
import open3d as o3d
import numpy as np
import os
import tkinter as tk
from tkinter import filedialog, dialog
import open3d as o3d
import numpy as np
file_path = ''
file_text = ''
vis = None
def init_window():
# ------------------------初始化显示窗口-------------------------
vis = o3d.visualization.Visualizer()
vis.create_window(window_name='pcd', width=800, height=600)
# ------------------------可视化参数设置-------------------------
opt = vis.get_render_option()
opt.background_color = np.asarray([0, 0, 0]) # 设置背景色
opt.point_size = 2 # 设置点云大小
opt.show_coordinate_frame = True # 设置是否显示坐标系
def updata_pcd(vis):
pcd = o3d.io.read_point_cloud(pcd_path)
vis.update_geometry(pcd) # 更新窗口中显示的内容
vis.add_geometry(pcd) # 添加点云到可视化窗口
vis.poll_events()
vis.update_renderer() # 更新显示窗口
vis.clear_geometries() # 清空显示内容
def choose_pcd():
''' 打开文件 :return:local_ '''
global file_path
global file_text
file_path = filedialog.askopenfilename(title=u'选择文件', initialdir=(os.path.expanduser('H:/')))
print('打开文件:', file_path)
if file_path is not None:
file_text = file_path
text1.insert('insert', file_text)
def open_point():
global file_text
print("加载pcd文件路径:" + file_text)
pcd = o3d.io.read_point_cloud(file_text)
print(pcd) # 输出点云点的个数
print(np.asarray(pcd.points)) # 输出点的三维坐标
print('给所有的点上一个统一的颜色,颜色是在RGB空间得[0,1]范围内得值')
pcd.paint_uniform_color([0, 1, 0])
o3d.io.write_point_cloud("copy_of_fragment.pcd", pcd)
o3d.visualization.draw_geometries([pcd])
if __name__ == '__main__':
window = tk.Tk()
window.title('窗口标题') # 标题
window.geometry('500x300') # 窗口尺寸
text1 = tk.Text(window, width=50, height=10, bg='orange', font=('Arial', 12))
text1.pack()
vis1 = init_window()
bt1 = tk.Button(window, text='选择pcd文件', width=15, height=2, command=choose_pcd)
bt1.pack()
bt2 = tk.Button(window, text='打开点云', width=15, height=2, command=open_point)
bt2.pack()
window.mainloop() # 显示
边栏推荐
- Laravel uses Tencent cloud cos5 full tutorial
- 云加速,帮助您有效解决攻击问题!
- Flask1.1.4 werkzeug1.0.1 source code analysis: start the process
- @pathvariable 和 @Requestparam的详细区别
- Apple CMS V10 template /mxone Pro adaptive film and television website template
- Detailed explanation of platform device driver architecture in driver development
- [cloud native] what is the microservice architecture?
- cf:C. Column Swapping【排序 + 模拟】
- Rk3399 platform development series explanation (interruption) 13.10, workqueue work queue
- 话说SQLyog欺骗了我!
猜你喜欢

Why does the data center need a set of infrastructure visual management system

软件测试的几个关键步骤,你需要知道

JVM命令之 jstat:查看JVM統計信息

JVM命令之 jstat:查看JVM统计信息

Bbox regression loss function in target detection -l2, smooth L1, IOU, giou, Diou, ciou, focal eiou, alpha IOU, Siou

Go语学习笔记 - gorm使用 - 原生sql、命名参数、Rows、ToSQL | Web框架Gin(九)

Jcmd of JVM command: multifunctional command line

3531. 哈夫曼树

如何在Touch Designer 2022版中设置解决Leap Motion不识别的问题?

Ideas of high concurrency and high traffic seckill scheme
随机推荐
解决pod install报错:ffi is an incompatible architecture
[solved] record an error in easyexcel [when reading the XLS file, no error will be reported when reading the whole table, and an error will be reported when reading the specified sheet name]
3428. Put apples
What is make makefile cmake qmake and what is the difference?
jmeter 函数助手 — — 随机值、随机字符串、 固定值随机提取
Rk3399 platform development series explanation (WiFi) 5.52. Introduction to WiFi framework composition
vim映射大K
PowerPivot - DAX (function)
Check Point:企业部署零信任网络(ZTNA)的核心要素
Flask1.1.4 Werkzeug1.0.1 源码分析:启动流程
postgresql 数据库 timescaledb 函数time_bucket_gapfill()报错解决及更换 license
JMeter function assistant - random value, random string, fixed value random extraction
JVM命令之 jstat:查看JVM统计信息
苹果cms V10模板/MXone Pro自适应影视电影网站模板
Interview questions and salary and welfare of Shanghai byte
Find duplicate email addresses
rt-thread 中对 hardfault 的处理
Flask1.1.4 werkzeug1.0.1 source code analysis: start the process
JVM命令之- jmap:导出内存映像文件&内存使用情况
go-microservice-simple(2) go-Probuffer
