Fork me on GitHub

Bytedeco makes native libraries available to the Java platform by offering ready-to-use bindings generated with the codeveloped JavaCPP technology. This, we hope, is the missing bridge between Java and C/C++, bringing compute-intensive science, multimedia, computer vision, deep learning, etc to the Java platform.

Core Technologies

  • JavaCPP [API] – A tool that can not only generate JNI code but also build native wrapper library files from an appropriate interface file written entirely in Java. It can also parse automatically C/C++ header files to produce the required Java interface files.

Prebuilt Java Bindings to C/C++ Libraries

These are part of a project that we call the JavaCPP Presets. Many coexist in the same GitHub repository, and all use JavaCPP to wrap predefined C/C++ libraries from open-source land. The bindings expose almost all of the relevant APIs and make them available in a portable and user-friendly fashion to any Java virtual machine (including Android), as if they were like any other normal Java libraries. We have presets for the following C/C++ libraries:

We will add more to this list as they are made, including those from outside the bytedeco/javacpp-presets repository.

Projects Leveraging the Presets Bindings

  • JavaCV [API] – Library based on the JavaCPP Presets that depends on commonly used native libraries in the field of computer vision to facilitate the development of those applications on the Java platform. It provides easy-to-use interfaces to grab frames from cameras and audio/video streams, process them, and record them back on disk or send them over the network.
  • JavaCV Examples – Collection of examples originally written in C++ for the book entitled OpenCV 2 Computer Vision Application Programming Cookbook by Robert Laganière, but ported to JavaCV and written in Scala.
  • ProCamCalib – Sample JavaCV application that can perform geometric and photometric calibration of a set of video projectors and color cameras.
  • ProCamTracker – Another sample JavaCV application that uses the calibration from ProCamCalib to implement a vision method that tracks a textured planar surface and realizes markerless interactive augmented reality with projection mapping.

More Project Information

Please refer to the contribute and download pages for more information about how to help out or obtain this software.

See the developer site on GitHub for more general information about the Bytedeco projects.

Latest News feed twitter

Java meets Caffe, deep learning in perspective

March 14, 2015

My main field of expertise being basically computer vision, there I see something like JavaCPP playing an important role. Apart from my own efforts with JavaCV, recently I became aware of similar sentiments in the field of deep learning, which has been gaining tremendously in popularity over the past few years. Namely, Yann LeCun, one of the gurus of deep learning, has made surprisingly relevant comments last year about their own efforts:

(At Facebook) We are using Torch7 for many projects (as does Deep Mind and several groups at Google) and will be contributing to the public version.

Torch is a numerical/scientific computing extension of LuaJIT with an ML/neural net library on top.

The huge advantage of LuaJIT over Python is that it way, way faster, leaner, simpler, and that interfacing C/C++/CUDA code to it is incredibly easy and fast.

Yann LeCun’s answers from the Reddit AMA

In other words, he admits that they would probably be using Python if the runtime were faster and could easily interface with native functionality, the lack of which are reason enough to justify taking some distance from the more vibrant communities evolving around NumPy, SciPy, and Theano. Java already has performance and simplicity on its side, and even leanness with implementations like Avian sporting a footprint of less than 1 MB, but easy and fast access to native functionality never materialized — until JavaCPP became reality. Lua can interface directly with C only, but we have a better solution here that can even use C++ template libraries for CUDA, such as Thrust, all that without writing a single line of C++: Interface Thrust and CUDA with JavaCPP. To illustrate my point and demonstrate the potential of our approach, I created Java bindings for Caffe, one of the most popular deep learning frameworks, that also happens to feature a complicated C++ API. Nevertheless, it took only a weekend’s time to create an almost complete interface, now available on GitHub as JavaCPP Presets for Caffe. At the time of this writing, we are not aware of any other existing Java wrappers, not even partial, for Caffe.

Now, for someone working in this kind of field, what else is missing from Java to become an attractive alternative to Python or Lua? An interactive command line interface would be one of those things. Even though languages such as Groovy or Scala already have REPL on top of the JVM, it might become a standard feature of the JDK itself as soon as Java 9 with JEP 222: Java Read-Eval-Print Loop (REPL). The only other important missing piece seems to be extensive library support for image processing, statistics, operations on matrices, data visualization, etc. We ourselves are attempting to provide some of these APIs by taping into available native libraries via the JavaCPP Presets, but given the recent interest expressed by the industry for deep learning, where Java is king, popular frameworks such as Deeplearning4j have already emerged, in a renewed quest to fill those gaps in Java.

That said, we hope the tools offered here can help you succeed in your own endeavors, deep learning or not. We would very much like to hear what you have to say, so do not hesitate to leave a comment. Moreover, if there is anything you need that is not currently available and would like to have a more private discussion, please contact us by email. This will also help us considerably in better orienting our future goals. Thank you very much for your time!