Python Forum

Full Version: Creating a GUI for Point Cloud visualisation
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello everyone, i need to create a interface for the visualisation the Point Cloud (PCD-Format), i tried with this code but it`s doesnt work.
Normally i want to build a simple visualisation tool to visualise Point cloud Data with some Buttons for example ( Swiping the Pictures or using some Filter or adding some options too..)
In my code i tried to build Point Cloud viewer
i will be very thankful for the help

this the Code:


from tkinter import*
from PIL import ImageTk,Image
import numpy as np
import open3d as o3d

root= Tk()
root.title(" Visualisierung ")
img = PhotoImage(file='index.ico')
root.tk.call('wm', 'iconphoto', root._w, img)


my_img1= o3d.io.read_point_cloud("z.pcd")
my_img2= o3d.io.read_point_cloud("o.pcd")
my_img3= o3d.io.read_point_cloud("p.pcd")
my_img4= o3d.io.read_point_cloud("u.pcd")
my_img5= o3d.io.read_point_cloud("person.pcd")
image_list = [my_img1, my_img2, my_img3, my_img4,my_img5]
print()
o3d.visualization.draw_geometries([image_list])


my_label = Label(image=my_img1)
my_label.grid(row=0, column=0, columnspan=3)

def forward(image_number):
global my_label
global button_forward
global button_back

my_label.grid_forget()
my_label = Label(image=image_list[image_number-1])
button_forward = Button(root, text=">>", command=lambda: forward(image_number+1))
button_back = Button(root, text="<<", command=lambda: back(image_number-1))

if image_number == 5:
button_forward = Button(root, text=">>", state=DISABLED)

my_label.grid(row=0, column=0, columnspan=3)
button_back.grid(row=1, column=0)
button_forward.grid(row=1, column=2)

def back(image_number):
global my_label
global button_forward
global button_back

my_label.grid_forget()
my_label = Label(image=image_list[image_number-1])
button_forward = Button(root, text=">>", command=lambda: forward(image_number+1))
button_back = Button(root, text="<<", command=lambda: back(image_number-1))

if image_number == 1:
button_back = Button(root, text="<<", state=DISABLED)

my_label.grid(row=0, column=0, columnspan=3)
button_back.grid(row=1, column=0)
button_forward.grid(row=1, column=2)



button_back = Button(root, text="<<", command=back, state=DISABLED)
button_exit = Button(root, text="Exit Program", command=root.quit)
button_forward = Button(root, text=">>", command=lambda: forward(2))


button_back.grid(row=1, column=0)
button_exit.grid(row=1, column=1)
button_forward.grid(row=1, column=2)

root.mainloop()
What doesn't work?

Please wrap code with Python tags so it retains the indenting.
(Feb-15-2022, 09:56 PM)deanhystad Wrote: [ -> ]What doesn't work?

Please wrap code with Python tags so it retains the indenting.

This what i get, when i run the Code.
thanks Smile

[Open3D WARNING] [CheckHeader] PCD has no fields.
[Open3D WARNING] Read PCD failed: unable to parse header.

Traceback (most recent call last):
File "pcd_viewer.py", line 19, in <module>
o3d.visualization.draw_geometries([image_list])
TypeError: draw_geometries(): incompatible function arguments. The following argument types are supported:
1. (geometry_list: List[open3d.cpu.pybind.geometry.Geometry], window_name: str = 'Open3D', width: int = 1920, height: int = 1080, left: int = 50, top: int = 50, point_show_normal: bool = False, mesh_show_wireframe: bool = False, mesh_show_back_face: bool = False) -> None
2. (geometry_list: List[open3d.cpu.pybind.geometry.Geometry], window_name: str = 'Open3D', width: int = 1920, height: int = 1080, left: int = 50, top: int = 50, point_show_normal: bool = False, mesh_show_wireframe: bool = False, mesh_show_back_face: bool = False, lookat: numpy.ndarray[numpy.float64[3, 1]], up: numpy.ndarray[numpy.float64[3, 1]], front: numpy.ndarray[numpy.float64[3, 1]], zoom: float) -> None

Invoked with: [[PointCloud with 1771 points., PointCloud with 9311 points., PointCloud with 3400 points., PointCloud with 0 points., PointCloud with 307200 points.]]
It doesn't like this.
Error:
PCD has no fields
And it reports this info about the point clouds.
Error:
Invoked with: [[PointCloud with 1771 points., PointCloud with 9311 points., PointCloud with 3400 points., PointCloud with 0 points., PointCloud with 307200 points.]
So maybe it doesn't run because this doesn't have any points.
my_img4= o3d.io.read_point_cloud("u.pcd")
(Feb-16-2022, 02:49 PM)deanhystad Wrote: [ -> ]It doesn't like this.
Error:
PCD has no fields
And it reports this info about the point clouds.
Error:
Invoked with: [[PointCloud with 1771 points., PointCloud with 9311 points., PointCloud with 3400 points., PointCloud with 0 points., PointCloud with 307200 points.]
So maybe it doesn't run because this doesn't have any points.
my_img4= o3d.io.read_point_cloud("u.pcd")
Thanks Big Grin , i remove the u.pcd, the PCD Error Message is disappeared. but the other Error still there

Traceback (most recent call last):
File "pcd_viewer.py", line 18, in <module>
o3d.visualization.draw_geometries([image_list])
TypeError: draw_geometries(): incompatible function arguments. The following argument types are supported:
1. (geometry_list: List[open3d.cpu.pybind.geometry.Geometry], window_name: str = 'Open3D', width: int = 1920, height: int = 1080, left: int = 50, top: int = 50, point_show_normal: bool = False, mesh_show_wireframe: bool = False, mesh_show_back_face: bool = False) -> None
2. (geometry_list: List[open3d.cpu.pybind.geometry.Geometry], window_name: str = 'Open3D', width: int = 1920, height: int = 1080, left: int = 50, top: int = 50, point_show_normal: bool = False, mesh_show_wireframe: bool = False, mesh_show_back_face: bool = False, lookat: numpy.ndarray[numpy.float64[3, 1]], up: numpy.ndarray[numpy.float64[3, 1]], front: numpy.ndarray[numpy.float64[3, 1]], zoom: float) -> None

Invoked with: [[PointCloud with 1771 points., PointCloud with 9311 points., PointCloud with 3400 points., PointCloud with 307200 points.]]
Now you have to look at this error.
Error:
TypeError: draw_geometries(): incompatible function arguments
The function expects a list. You are passing a list inside a list.
yeah it work but not Really like i want.
Normally i want to create visualization tool for Point cloud data,Gui with option like ( swiping images and using some Filter on the Point Cloud) i already built a simple tool, but only work with (png, Jpg....) not for PCD format.
Sad