- OpenCV 3.0 Computer Vision with Java
- Daniel Lélis Baggio
- 336字
- 2021-07-16 13:17:30
Getting OpenCV for Java development
The first thing to notice when working with OpenCV for Java development is that OpenCV is a C++ library that should be compiled with operating system- specific compilers. The native code that would be generated is platform-dependent. So, the native Linux code won't run in Windows, neither will the Android native code run in OSX. This sounds very different from the bytecode generated for Java, which is executed by an interpreter in any platform. In order to get the native code running in a Java Virtual Machine (JVM), one needs the so called Java Native Interface (JNI). This way, the native code will be required for each platform that your application is going to be run on.
It is important to understand that JNI is a native programming interface. It allows the Java code that runs inside a JVM to interoperate with the applications and libraries written in programming languages such as C, C++, and assembly. Since it bridges the gap between Java and other languages, it needs to convert datatypes from these languages, as well as to create some boilerplate code. Curious readers should refer to the gen_java.py
script, located in the modules/java/generator
folder, which automates most of this work. Lucky Windows users get compiled binaries, which means source C++ OpenCV code, compiled with Windows compilers into native code that runs only on Windows, from OpenCV packages. Users from other operating systems will need to build binaries from the source code, although one can make that in Windows as well. In order to download compiled binaries, we should get version 2.4.4 or higher of the OpenCV Windows package from the OpenCV SourceForge repository, which is located at http://sourceforge.net/projects/opencvlibrary/files/.
Note
Notice that the prebuilt files needed for Java development are located at opencv/build/java/
. For instance, if you are working with version 3.0.0 OpenCV, you should see files containing the Java interface in opencv-300.jar
and in the x86 and x64 native dynamic libraries, which contains the Java bindings in x86/opencv_java300.dll
and x64/opencv_java300.dll
.
- LaTeX Cookbook
- Design Principles for Process:driven Architectures Using Oracle BPM and SOA Suite 12c
- JavaScript 從入門到項(xiàng)目實(shí)踐(超值版)
- Scala Design Patterns
- Vue.js快速入門與深入實(shí)戰(zhàn)
- 機(jī)器人Python青少年編程開發(fā)實(shí)例
- 精通軟件性能測(cè)試與LoadRunner實(shí)戰(zhàn)(第2版)
- Microsoft Dynamics GP 2013 Reporting, Second Edition
- 精通網(wǎng)絡(luò)視頻核心開發(fā)技術(shù)
- MATLAB 2020從入門到精通
- 領(lǐng)域驅(qū)動(dòng)設(shè)計(jì):軟件核心復(fù)雜性應(yīng)對(duì)之道(修訂版)
- ExtJS高級(jí)程序設(shè)計(jì)
- Machine Learning in Java
- 小程序,巧應(yīng)用:微信小程序開發(fā)實(shí)戰(zhàn)(第2版)
- LabVIEW數(shù)據(jù)采集