当前位置:网站首页>Tkinter window selects PCD file and displays point cloud (open3d)
Tkinter window selects PCD file and displays point cloud (open3d)
2022-07-07 06:26:00 【Programmers evolve without losing their hair!】
# !/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():
# ------------------------ Initialize the display window -------------------------
vis = o3d.visualization.Visualizer()
vis.create_window(window_name='pcd', width=800, height=600)
# ------------------------ Visual parameter setting -------------------------
opt = vis.get_render_option()
opt.background_color = np.asarray([0, 0, 0]) # Set background color
opt.point_size = 2 # Set the point cloud size
opt.show_coordinate_frame = True # Set whether to display coordinate system
def updata_pcd(vis):
pcd = o3d.io.read_point_cloud(pcd_path)
vis.update_geometry(pcd) # Update the contents displayed in the window
vis.add_geometry(pcd) # Add a point cloud to the visualization window
vis.poll_events()
vis.update_renderer() # Update the display window
vis.clear_geometries() # Clear the display
def choose_pcd():
''' Open file :return:local_ '''
global file_path
global file_text
file_path = filedialog.askopenfilename(title=u' Select File ', initialdir=(os.path.expanduser('H:/')))
print(' Open file :', file_path)
if file_path is not None:
file_text = file_path
text1.insert('insert', file_text)
def open_point():
global file_text
print(" load pcd File path :" + file_text)
pcd = o3d.io.read_point_cloud(file_text)
print(pcd) # Number of output point cloud points
print(np.asarray(pcd.points)) # Output the 3D coordinates of the point
print(' Give all the dots a uniform color , The color is in RGB Space has to be [0,1] The value in the range ')
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 title ') # title
window.geometry('500x300') # Window size
text1 = tk.Text(window, width=50, height=10, bg='orange', font=('Arial', 12))
text1.pack()
vis1 = init_window()
bt1 = tk.Button(window, text=' choice pcd file ', width=15, height=2, command=choose_pcd)
bt1.pack()
bt2 = tk.Button(window, text=' Open point cloud ', width=15, height=2, command=open_point)
bt2.pack()
window.mainloop() # Show
边栏推荐
- Navicat导入15G数据报错 【2013 - Lost connection to MySQL server during query】 【1153:Got a packet bigger】
- Apple CMS V10 template /mxone Pro adaptive film and television website template
- C interview encryption program: input plaintext by keyboard, convert it into ciphertext through encryption program and output it to the screen.
- Redis (II) - redis General Command
- QT console output in GUI applications- Console output in a Qt GUI app?
- Bypass open_ basedir
- go-microservice-simple(2) go-Probuffer
- Ha Qu projection dark horse posture, only half a year to break through the 1000 yuan projector market!
- VMware安装后打开就蓝屏
- C interview 24 (pointer) define a double array with 20 elements a
猜你喜欢
Ctfshow-- common posture
3531. 哈夫曼树
A program lets you understand what static inner classes, local inner classes, and anonymous inner classes are
ICML 2022 | 探索语言模型的最佳架构和训练方法
拼多多败诉:“砍价免费拿”侵犯知情权但不构成欺诈,被判赔400元
laravel 使用腾讯云 COS5全教程
Test the foundation of development, and teach you to prepare for a fully functional web platform environment
Haqi projection Black Horse posture, avec seulement six mois de forte pénétration du marché des projecteurs de 1000 yuans!
The difference between string constants and string objects when allocating memory
postgresql 数据库 timescaledb 函数time_bucket_gapfill()报错解决及更换 license
随机推荐
Navicat导入15G数据报错 【2013 - Lost connection to MySQL server during query】 【1153:Got a packet bigger】
"Parse" focalloss to solve the problem of data imbalance
线性代数(一)
Markdown 并排显示图片
3531. 哈夫曼树
win系统下安装redis以及windows扩展方法
C language interview to write a function to find the first occurrence of substring m in string n.
JMeter's own functions are not enough? Why don't you develop one yourself
VIM mapping large K
Qtthread, one of many methods of QT multithreading
window下面如何安装swoole
学习笔记|数据小白使用DataEase制作数据大屏
Oracle迁移中关于大容量表使用数据泵(expdp、impdp)导出导入容易出现的问题和注意事项
A program lets you understand what static inner classes, local inner classes, and anonymous inner classes are
当我们谈论不可变基础设施时,我们在谈论什么
蚂蚁庄园安全头盔 7.8蚂蚁庄园答案
Jmeter自带函数不够用?不如自己动手开发一个
拼多多败诉:“砍价免费拿”侵犯知情权但不构成欺诈,被判赔400元
你不知道的互联网公司招聘黑话大全
Rk3399 platform development series explanation (interruption) 13.10, workqueue work queue