当前位置:网站首页>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
边栏推荐
- Shared memory for interprocess communication
- rt-thread 中对 hardfault 的处理
- 3428. 放苹果
- string(讲解)
- 骑士战胜魔王(背包&dp)
- K8s running Oracle
- Wechat applet hides the progress bar component of the video tag
- HKUST & MsrA new research: on image to image conversion, fine tuning is all you need
- Talking about reading excel with POI
- uniapp开发小程序如何使用微信云托管或云函数进行云开发
猜你喜欢
一段程序让你明白什么静态内部类,局部内部类,匿名内部类
屏幕程序用串口无法调试情况
laravel 使用腾讯云 COS5全教程
What are the classic database questions in the interview?
Three updates to build applications for different types of devices | 2022 i/o key review
Force deduction 62 different paths (the number of all paths from the upper left to the lower right of the matrix) (dynamic planning)
Ctfshow-- common posture
CloudCompare-点对选取
开发者别错过!飞桨黑客马拉松第三期链桨赛道报名开启
693. 行程排序
随机推荐
JVM in-depth
基于FPGA的VGA协议实现
3531. Huffman tree
Handling hardfault in RT thread
那些自损八百的甲方要求
软件测试到了35岁,真的就干不动了吗?
骑士战胜魔王(背包&dp)
How to use wechat cloud hosting or cloud functions for cloud development of unapp development applet
JVM command - jmap: export memory image file & memory usage
当我们谈论不可变基础设施时,我们在谈论什么
Qtthread, one of many methods of QT multithreading
Rk3399 platform development series explanation (WiFi) 5.52. Introduction to WiFi framework composition
Crudini profile editing tool
安装VMmare时候提示hyper-v / device defender 侧通道安全性
直击2022ECDC萤石云开发者大会:携手千百行业加速智能升级
PostgreSQL database timescaledb function time_ bucket_ Gapfill() error resolution and license replacement
Redis (II) - redis General Command
ICML 2022 | 探索语言模型的最佳架构和训练方法
ETCD数据库源码分析——从raftNode的start函数说起
Common problems of caching in high concurrency scenarios