Source Code Examples

This website offers several source code examples of simple experiments using the DMDDB database. The examples use the DMDDB API for Java and Javascript that allows you to get full access to the DMDDB database and build your own experiments in less than 10 lines of Java or JavaScript code. The classes in the DMDDB API communicate directly with the on-line database and give you easy access to the depth data and metadata of the DMDDB database. More information about the DMDDB API can be found in this link.

The examples contain the following applications:
  • Simple Example A simple example that opens a particular depth sequence from the DMDDB database, the one that corresponds to the Driver 101, merging onto I-75 from Archer road, round 1. This example parses one by one all the depth frames in this dataset, and computes the average depth value per frame and prints the result in the system console.
  • DMDDB Player This example uses JogAmp's JOGL Java library to visualize the depth data as 3D surfaces in openGL. It also offers a simple graphical user interface for playing/pausing the depth stream, rotating in 3D the depth frames by mouse drag and drop, and skipping frames by interacting with the time slider. The image above shows a screen shot of this example.
  • Simple Experiment This example shows a simple experimental setup that opens multiple depth sequences from the DMDDB database and parses one by one all the depth frames in the selected datasets. This example gives you the option to process the depth data using your own algorithms and write the results in simple text files that are automatically exported during the execution of this experiment.

  • How to write your own DMDDB experiment

    This tutorial will show you how to develop your own data processing applications using the DMDDB API.
    The most important part of code in all the above source code examples is the definition of a class that handles the depth streams received from the DMDDB database. You can easily define such a class in less than 10 lines of Java or Javascript code!

    Here is how:

    import edu.ufl.digitalworlds.dmddb.DMDDBTerminal;

    /*This class is an implementation of the abstract class DMDDBTerminal.
      It is a simple example of source code that shows how to read 
      and process the depth frames from the DMDDB database.*/

    public class SimpleExample extends DMDDBTerminal{

    First of all, your class should extend the DMDDBTerminal class from the DMDDB API library, as shown above. Optionally, you can define your own constructor and custom parameters for your class, as shown in the example below.

        /*The constructor of the class initializes the DMDDBTerminal object
          and establishes connection with the DMDDB database.*/

        public SimpleExample() throws URISyntaxException {

    Finally, you have to implement the interface of the 3 methods that will be automatically called every time a new depth frame is received from the DMDDB database, when connection is established, and when a new file is opened. You can customize the content of these 3 methods according to the needs of your application. An example of such implementation is shown below.

        /*The following method will run every time a new depth frame is
          received from the DMDDB database. The average depth value is
          calculated for each frame and the result is printed in
          the system console.*/

        public void onDepthFrame(short[] depth_data) {
            System.out.println("New depth frame received. Frame id: "+getCurrentFrameID());
            double average=0;
            for(int i=0;i<320*240;i++)
            System.out.println("The average depth in this frame is: "+average+"mm");

        /*The following method will run when connection is established with the
          DMDDB database.*/
        public void onConnect() {
            System.out.println("Connection Established.");

        /*The following method will run when a new depth sequence is
          opened from the DMDDB database.*/
        public void onOpenFile() {    
            System.out.println("File opened. Number of frames: "+getNumOfFrames());

        /*This is the main method that will create an instance of
          the SimpleExample class and run this example.*/
        public static void main(String args[]) {    
            try {
            SimpleExample player=new SimpleExample();
            } catch (URISyntaxException e) {}

    That's it! A simpler implementation can be written in less than 10 lines. As easy as A-B-C!

    Acknowledgement: Funded in part by the US Department of Transportation / STRIDE, Award ID: DTRT12-G-UTC04 / 2013-051S, STRIDE project title "Investigating the effect of drivers' body motion on traffic safety", Principal Investigator: Angelos Barmpoutis, September 2013-April 2015.

    Disclaimer: The names JAVA and KINECT and their associated logos are trademarks of their respective copyright owners Oracle and Microsoft. None of these companies endorse, fund, or are in any way associated with the DMDDB project.

    Disclaimer: This database and accompanied software is provided for free without any warranty expressed or implied for academic, research, and strictly non commercial purposes only. By downloading this software and/or database you accept the Terms and Conditions.

    University of Florida, Digital Worlds Institute, P.O.Box 115810, 101 Norman Gym, Gainesville, FL 32611-5810, USA