Skip to content

tomtzook/jpixy

Repository files navigation

jpixy

Java port for Pixy

Building

The java part is built using gradle, while the native part is built with cmake. To build for the current system, simply run ./gradlew/gradlew.bat clean build, which will build the native part as well. Outputs can be found under build and build/cmake.

Custom Toolchain

For using a custom toolchain to compile the native part, run gradle with -PTOOLCHAIN={path/to/cmake/toolchain/file}. The cmake toolchain file must define settings for the wanted toolchain. This can be useful for cross compilation.

Usage

Pixy provides the basic interfacing to the camera. It is divided into modules, each providing different functionallity.

try (Pixy pixy = PixyInstance.getDefault()) { 
    System.out.println("Pixy version: " + pixy.getFirmwareVersion());

    int frame = 0;
    while (true) {
        if (!pixy.hasNewBlocks()) {
            Thread.yield();
        }

        Collection<Block> blocks = pixy.getBlocks(10);
        System.out.println("New Block: " + (++frame));
        for (Block block : blocks) {
            System.out.println("Block :: " + block);
        }
    }
}

Loading Native

Before using Pixy, the native library must first be loaded, just like any other native library.

About

Java port for libpixyusb

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published