Hamilton: 3D Data Visualizer
Context
In my user studies, I often use motion capture (“mocap”) systems to study people’s body movements. Optical mocap systems triangulate the position of objects in space, and produce data with 3D position and orientation info. I typically collect and save this data as independent files to be used for offline analysis.
A screenshot of the .csv file from one of my studies. This sample data, which represents the full body skeleton from Microsoft’s Azure Kinect, consists of 699 frames for 224 position and rotation variables for under 30 seconds of data.
Problem
I’ve found it helpful to be able to explore and make sense of the raw data when processing and handling data. For instance, I often need to perform coordinate transformations to view the data from different perspectives (e.g., convert from world coordinates to a local coordinate system). Visualizing the raw and processed data quickly can ensure I did my math correctly. However, this process has proven to be a challenge because:
Existing data visualization libraries in Python (e.g., matplotlib) provide limited set of tools for 3D data
Visualizing 3D can be computationally expensive depending on the language and data volume
For a while, I would generate frame-by-frame plots and stitch those images together using ffmpeg. Then one day, I decided that I needed a more scalable solution.
This is what stitching together frame-by-frame plots via ffmpeg would produce. Even with multiprocessing using 12 processors, this data of just 699 frames would take 30 seconds to be visualized. Imagine repeating this process for every time I wanted to view the data from a different angle…
Solution
Enter my macOS app, called Hamilton. Written in Swift and Metal, Hamilton can read large volumes of 3D time series data instantaneously and plays back the data like a video. The code is on GitHub.
The same csv file visualized in Hamilton. It’s instantaneous and provides an intuitive interface for viewing the data at different points in time as well as from different angles.