-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathsample_visualizer.py
More file actions
57 lines (40 loc) · 1.61 KB
/
sample_visualizer.py
File metadata and controls
57 lines (40 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
"""
Sample demonstrating Zivid Visualizer functionality.
This sample shows how to use the Visualizer class to display point clouds
using a file camera for simplicity.
"""
from pathlib import Path
import zivid
file_camera_file_path = Path(__file__).parent.parent / "test" / "test_data" / "FileCameraZivid2M70.zfc"
def _main():
print("Starting Visualizer sample")
app = zivid.Application()
camera = app.create_file_camera(file_camera_file_path)
print("Created file camera")
# Simple settings for capture
settings = zivid.Settings(
acquisitions=[zivid.Settings.Acquisition()],
color=zivid.Settings2D(acquisitions=[zivid.Settings2D.Acquisition()]),
)
frame = camera.capture_2d_3d(settings)
print("Frame captured successfully")
# Create visualizer
visualizer = zivid.visualization.Visualizer()
visualizer.set_window_title("Zivid Visualizer Sample")
# Configure visualization settings
visualizer.colors_enabled = True
visualizer.meshing_enabled = True
visualizer.axis_indicator_enabled = True
print(f"Colors enabled: {visualizer.colors_enabled}")
print(f"Meshing enabled: {visualizer.meshing_enabled}")
print(f"Axis indicator enabled: {visualizer.axis_indicator_enabled}")
# Show the frame
print("Displaying frame...")
visualizer.show(frame)
visualizer.reset_to_fit()
# Run the event loop - this will show the window and allow interaction
print("Starting visualizer. Close the window to exit.")
exit_code = visualizer.run()
print(f"Visualizer exited with code: {exit_code}")
if __name__ == "__main__":
_main()