Pointcloud Visualisation in Python – Edition 1, in a series

What? This series aims to allow you to easily create udStream SDK integrations allowing visualisation of your data in a context that is meaningful for your application.  

Who? This series is aimed at developers and advanced users wishing to make the best use of  Euclideon udStream Development Kit (VDK)  for their specific workflow or custom solution. For a general purpose, high performance point cloud viewer, check out Euclideon udStream Client. It’s also open source, so feel free to steal our ideas!

So you downloaded the udStream SDK and now you want to view your own pointcloud. Maybe that 2TB set of LiDAR scans isn’t doing any favours for your memory usage or loading time. Possibly your data isn’t spatial at all but you want to explore it in three dimensions. In any case we provide an efficient method of displaying billions of data points without the need for GPU or locally stored data.  

Why? Perhaps you want to integrate udStream into your application workflow, take advantage of its ability to view unlimited scale point clouds, or export portions of that data as points for processing by other programs.   

For most large data sets, the first step is to actually evaluate all factors to establish the scope of the problem. Even though ML agents and data cleaners think in ‘ones and zeros’ we still need to supervise them. This series aims to allow you to easily create udStream SDK integrations allowing visualisation of your data in a context that is meaningful for your application.  

Python Sample Introduction  

For this series we will be using a Python to explore building our own applications using VDK. We will explore different way that VDK can be interfaced with Python’s myriad of libraries and you can gain fine control of your data using Python’s simple scripting interfaces.   

Building a full application (especially one using 3D graphics) is sometimes a daunting task so we have shortened this process to include a functional implementation of a massive point cloud viewer in Python. We will be going through the process of adding our own specialised features to this viewer and in the process be showcasing the functionality of VDK.  

The program we provide is intentionally minimalist. As this series progresses, we aim to add more features to it.  

Before getting started  

Before diving into the Python samples, you need to make sure that all prerequisite installs and packages are met. For more information on this, you can follow this page on Prerequisites and how to install.

udStream SDK Python Repository  

Go to Euclideon’s GitHub page and clone the repository. You should get the following files:  

That’s it, you’re ready start with the udStream Python!  

So, what’s inside?  

Now that you downloaded the scripts from the previous section, it’s time to inspect what we’ve got so far:  

udStream.py  

Contains the implementation of udSDK’s functions set. It is effectively a wrapper of udSDK for Python. These classes are the most basic building blocks we provide for udSDK  

camera.py  

Contains the camera classes definitions for this sample. It allows you to run (or fly?) around the model. Also contains some neat functions that allow you to achieve different effects and visuals.   

main.py  

A simple python application that prints any model you load as an image. Super useful to get an idea of how the renderer works. It produces an image given the model, camera parameters, and log in details, then writes it to disk as a PNG.  

easyrenderer.py  

An implementation of the renderer from vault.py. It abstracts away many of the complexities by assuming some standard settings and providing a more object-oriented interface for the renderer.   

pygletexample.py  

This is an interactive application of udSDK built using python and the pyglet platform. Allows you to render any UDS and fly around it interactively. This is interfaced with the console, allowing users to modify behavior. This will serve as our starting point for learning the functionality of udSDK. In this post we’ll be familiarizing ourselves with the base application.   

Testing the pyglet example  

To get the Pyglet renderer running, open a terminal and set the directory to where you saved the files.  

Once there simply execute the command: 
`ipython3 pygletexample.py [vaultUsername] [vaultPassword]`  
If everything is setup correctly, you should be able to see this:  

To load a model:  
If you have a local UDS you can simply drag the UDS file into the window 
Alternatively you can specify the location (URL or file path to the program by running the following command from your console:   
app.renderer.add_model(“path_to_uds”)  
For example, we host a photogrammetry model of the Gold Coast, QLD by Aerometrex which can be loaded by:  
app.renderer.add_model("https://azmodels.vault.euclideon.com/Gold_Coast_20mm.uds")  

And that’s it, you have rendered your first UDS file in Python. You can fly around the model (be sure to maximise the window to see the instructions). You can also play around with the camera via the console (check the readme for ways to do this).   

In this post we have learned to setup Python prerequisites for udSDK. We also made our first UDS render via the piglet Example. A lot of things to go through still, as udSDK does more than just render. On the next series we will take a deep dive on what exactly a UDS is, and what makes it special. We will also show you way on how to make your own UDS files.  

Blog article created by: 
Kisar Samsuya Euclideon Solutions Engineer 
Braden Wockner Euclideon Graduate Solutions Engineer