Skip to content

Latest commit

 

History

History
 
 

librealsense

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

JavaCPP Presets for librealsense

Introduction

This directory contains the JavaCPP Presets module for:

Please refer to the parent README.md file for more detailed information about the JavaCPP Presets.

Documentation

Java API documentation is available here:

Sample Usage

Here is a very simple example that check if you can load the library, and connect to a camera.

We can use Maven 3 to download and install automatically all the class files as well as the native binaries. To run this sample code, after creating the pom.xml and TestConnection.java source files below, simply execute on the command line:

 $ mvn compile exec:java

The pom.xml build file

<project>
    <modelVersion>4.0.0</modelVersion>
    <groupId>org.bytedeco.librealsense</groupId>
    <artifactId>TestConnection</artifactId>
    <version>1.5.2</version>
    <properties>
        <exec.mainClass>TestConnection</exec.mainClass>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.bytedeco</groupId>
            <artifactId>librealsense-platform</artifactId>
            <version>1.12.4-1.5.2</version>
        </dependency>
    </dependencies>
    <build>
        <sourceDirectory>.</sourceDirectory>
    </build>
</project>

The TestConnection.java source file

import org.bytedeco.javacpp.*;
import org.bytedeco.librealsense.*;
import static org.bytedeco.librealsense.global.RealSense.*;

public class TestConnection {

    public static void main(String[] args) {
        context context = new context();
        System.out.println("Devices found: " + context.get_device_count());

        device device = context.get_device(0);
        System.out.println("Using device 0, an " + device.get_name());
    }
}