精华内容
下载资源
问答
  • JavaCPP

    2018-03-25 13:28:00
    https://github.com/bytedeco/javacpp#introduction https://github.com/bytedeco/javacpp-presets ——————————————————————————————————————————————...JavaCPP...

    https://github.com/bytedeco/javacpp#introduction

    https://github.com/bytedeco/javacpp-presets

    ——————————————————————————————————————————————————————————————————————————————————

    Introduction

    JavaCPP provides efficient access to native C++ inside Java, not unlike the way some C/C++ compilers interact with assembly language. No need to invent new languages such as with SWIG, SIP, C++/CLI, Cython, or RPython as required by cppyy. Instead, it exploits the syntactic and semantic similarities between Java and C++. Under the hood, it uses JNI, so it works with all implementations of Java SE, in addition to Android, Avian, and RoboVM (instructions).

    More specifically, when compared to the approaches above or elsewhere (CableSwig, JNIGeneratorApp, cxxwrap, JNIWrapper, Platform Invoke, GlueGen, LWJGL Generator, JNIDirect, ctypes, JNA, JNIEasy, JniMarshall, JNative, J/Invoke, HawtJNI, JNR, BridJ, fficxx, CppSharp, cgo, rust-bindgen, etc.), it maps naturally and efficiently many common features afforded by the C++ language and often considered problematic, including overloaded operators, class and function templates, callbacks through function pointers, function objects (aka functors), virtual functions and member function pointers, nested struct definitions, variable length arguments, nested namespaces, large data structures containing arbitrary cycles, virtual and multiple inheritance, passing/returning by value/reference/string/vector, anonymous unions, bit fields, exceptions, destructors and shared or unique pointers (via either try-with-resources or garbage collection), and documentation comments. Obviously, neatly supporting the whole of C++ would require more work (although one could argue about the intrinsic neatness of C++), but we are releasing it here as a proof of concept.

    As a case in point, we have already used it to produce complete interfaces to OpenCV, FFmpeg, libdc1394, PGR FlyCapture, OpenKinect, videoInput, ARToolKitPlus, and others as part of the JavaCPP Presets subproject, also demonstrating early parsing capabilities of C/C++ header files that show promising and useful results.

    Please feel free to ask questions on the mailing list if you encounter any problems with the software! I am sure it is far from perfect...

    Downloads

    转载于:https://www.cnblogs.com/cuizhenfu/p/8644192.html

    展开全文
  • JavaCPP Commercial support: Introduction JavaCPP provides efficient access to native C++ inside Java, not unlike the way some C/C++ compilers interact with assembly language. No need to invent new ...
  • javacpp.jar

    2019-05-17 14:09:50
    javacpp 新版本!javacpp 提供了在Java中高效访问本地C++的方法优于jni!
  • javacpp-1.3.2.jar
  • javacpp实践

    2019-04-30 22:18:39
    下面记录的是自己在使用javacpp过程中的代码。整个工程是在java里面调用别人的dll。自己写一个中间代理c程序,由java调用自己的c,然后自己的c调用其它人的dll。实践里面使用了主流的传参方式,其它传参请参考api。 ...

    下面记录的是自己在使用javacpp过程中的代码。整个工程是在java里面调用别人的dll。自己写一个中间代理c程序,由java调用自己的c,然后自己的c调用其它人的dll。实践里面使用了主流的传参方式,其它传参请参考api。

    前提工作:

    下载javacpp.jar,安装visual studio

    1.编写java代码:

    
    
    import org.bytedeco.javacpp.*;
    import org.bytedeco.javacpp.annotation.*;
    
    @Platform(include="ZLPrint.h")
    public class ZLPrint extends Pointer {
    	static {
    		Loader.load();
    	}
    	private static ZLPrint	s_print	= null;
    
    	public final static ZLPrint getSingleton() {
    		if (s_print == null) {
    			s_print = new ZLPrint();
    		}
    		return s_print;
    	}
    	
    
    	private ZLPrint() {
    		allocate();
    	}
    
    	
    
    	private native void allocate();
    
    	// 初始化
    	public native int init(int port);
    
    	public native int get_printstatus();
    
    	public native int get_booklet_page(IntPointer page);
    
    	public native int get_booklet_id(BytePointer buf, IntPointer length);
    
    	
    
    	public static void main(String[] args) {
    		
    		System.out.println("test");
    		
    	}
    	
    }

    保存为ZLprint.java

    2.编写c代码

    
    #ifdef ZLPRINT_EXPORTS
    #define ZLPRINT_API  extern "C" __declspec(dllexport)
    #else
    #define ZLPRINT_API	 extern "C" __declspec(dllimport)
    #endif
    
    #include <string>
    
    ZLPRINT_API int zl_init(int port);
    ZLPRINT_API int zl_get_printstatus(void);
    ZLPRINT_API int zl_get_booklet_page(int* page);
    ZLPRINT_API	int zl_get_booklet_id(char* buf, int* length);
    
    #pragma comment(lib, "D:/引用其他dll")
    
    	class ZLPrint{
    		public :
    			
    			int init(int port){ return ::zl_init(port);};
    			
    			int get_printstatus(){return ::zl_get_printstatus();};
    			
    			int get_booklet_page(int* page){return zl_get_booklet_page(page);};
    			
    			int get_booklet_id(signed char* buf, int* length){return zl_get_booklet_id((char *)buf,length);};
    			
    	};

    保存为ZLprint.h格式

    把上面两个源码文件放在同一个目录里面。保证在全局能直接java命令。在visual studio里面找到cmd命令窗口,比如:vs2012 x64 native Tools Command,在cmd里面进入到两个文件的目录,执行:

    javac -cp javacpp.jar ZLPrint.java
    
    ava -jar javacpp.jar ZLPrint

    保证每步都不会出错,如果会出错,请检查。

    如果指令正确,第一步会获得ZLprint.class文件,第二步获得:jniZLprint.dll、jniZLprint.exp、jniZLprint.lib、jniZLprint.obj四个文件。

    展开全文
  • JavaCPP使用

    千次阅读 2019-01-23 17:42:19
    GitHub: https://github.com/bytedeco/javacpp 如有侵权请联系笔者删除 ...JavaCPP是一个开源库,它提供了在 Java 中高效访问本地 C++的方法。采用 JNI 技术实现,所以支持所有 Java 实现包括 Andr...

    部分内容引用自网站:https://www.ibm.com/developerworks/cn/java/j-lo-cpp/index.html
    GitHub: https://github.com/bytedeco/javacpp
    如有侵权请联系笔者删除

    JavaCPP是一个开源库,它提供了在 Java 中高效访问本地 C++的方法。采用 JNI 技术实现,所以支持所有 Java 实现包括 Android 系统,Avian 和 RoboVM。

    为了调用本地方法,JavaCPP 生成了对应的 JNI 代码,并且把这些代码输入到 C++编译器,用来构建本地库。使用了 Annotations 特性的 Java 代码在运行时会自动调用 Loader.load() 方法从 Java 资源里载入本地库,这里指的资源是工程构建过程中配置好的。

    示例:
    这是一个简单的注入/读出方法,类似于 JavaBean 的工作方式。清单 1 所示的 LegacyLibrary.h 包含了 C++类。

    清单 1. LegacyLibrary.h

    #include <string>
    namespace LegacyLibrary {
     	class LegacyClass {
         public:
     	const std::string& get_property() { return property; }
     	void set_property(const std::string& property) { this->property = property; }
     	std::string property;
     	};
    }
    

    接下来定义一个 Java 类,驱动 JavaCPP 来完成调用 C++代码。

    清单 2. LegacyLibrary.java

    import org.bytedeco.javacpp.*;
    import org.bytedeco.javacpp.annotation.*;
     
    @Platform(include="LegacyLibrary.h")
    @Namespace("LegacyLibrary")
    public class LegacyLibrary {
     	public static class LegacyClass extends Pointer {
     	static { Loader.load(); }
     	public LegacyClass() { allocate(); }
     	private native void allocate();
     
     	// to call the getter and setter functions 
     	public native @StdString String get_property(); public native void set_property(String property);
     
    	 // to access the member variable directly
     	public native @StdString String property(); public native void property(String property);
     }
     
     	public static void main(String[] args) {
     	// Pointer objects allocated in Java get deallocated once they become unreachable,
     	// but C++ destructors can still be called in a timely fashion with Pointer.deallocate()
     	LegacyClass l = new LegacyClass();
     	l.set_property("Hello World!");
     	System.out.println(l.property());
     }
    }
    

    以上两个类放在一个目录下面,接下来运行一系列编译指令,如清单 3 所示。

    清单 3. 运行命令

    $ javac -cp javacpp.jar LegacyLibrary.java 
    $ java -jar javacpp.jar LegacyLibrary
    $ java -cp javacpp.jar LegacyLibrary
    Hello World!
    

    我们看到清单 3 最后运行输出了一行“Hello World!”,这是 LegacyLibrary 类里面定义好的,通过一个 setter 方法注入字符串,getter 方法读出字符串。

    上述内容都是引用自网站https://www.ibm.com/developerworks/cn/java/j-lo-cpp/index.html

    光看别人的东西还是一知半解,所以笔者亲自动手试了一下,发现总是生成不了dll文件,在这里详细记录一下,仅供参考。欢迎各位讨论

    第一步:
    参照上述内容创建 Legacylibrary.h LegacyLibrary.java文件并将其和 javacpp.jar 文件放在一个文件夹里。

    第二步:
    打开VS的本机命令工具提示窗口(和Windows命令行窗口一样),用次命令窗口进入到以上三个文件所在的文件夹目录下,再用

    $ javac -cp javacpp.jar LegacyLibrary.java 
    $ java -jar javacpp.jar LegacyLibrary
    $ java -cp javacpp.jar LegacyLibrary
    

    这三条命令去生成 dll 文件库。
    注意: 此处必须使用VS下的命令行进行操作,笔者此前使用Windows自带命令行一直没有成功,在执行第二条命令时会报“找不到指定文件”的错误。

    VS下的命令行窗口启动如下图:
    在这里插入图片描述
    点击打开文件夹并选择对应的32位或64位工具。(打开命令行窗口时,若上方出现 Cannot determine the location of the VS Common Tools Folder,则需要在环境变量的 path中设置值:c:\windows\system32)

    进入三个文件所在的文件夹及执行第一步编译操作:
    在这里插入图片描述
    生成 dll 文件:
    在这里插入图片描述
    在这里插入图片描述
    此时程序所在文件夹会生成一个子文件夹“windows-x86_64”,在此文件夹下会有生成的动态链接库以及相关文件。
    在这里插入图片描述
    执行程序:
    在这里插入图片描述
    生成动态链接库后将文件夹“windows-x86_64”整体粘贴到java项目下的 src 目录下,并加载 javacpp.jar 包然后运行,显示成功。
    在这里插入图片描述

    展开全文
  • Gradle JavaCPP 商业支持: 介绍 Gradle JavaCPP提供的插件使将和用作Gradle构建系统的一部分成为可能。 如果您遇到软件方面的任何问题,请随时提问。 我相信这还远非完美... 必备软件 要使用Gradle JavaCPP,您将...
  • sample-projects, 用于 JavaCPPJavaCPP预设和JavaCV的样例项目文件 示例项目简介为了帮助你更快地使用 JavaCPPJavaCPP预置或者 JavaCV,我们在这个存储库中提供了各种小样本项目文件。 they的shapes,Gradle,...
  • <div><p>what is the diffrence beetwen javacpp-platform.jar and javacpp.jar</p><p>该提问来源于开源项目:bytedeco/javacpp</p></div>
  • 为了帮助您更快地使用JavaCPPJavaCPP预设或JavaCV,我们在此存储库中提供了各种小型示例项目文件。 它们具有各种形状和形式,包括用于Maven,Gradle或sbt的简单构建文件,并且可以针对从Android到Hadoop和Spark的...
  • javacpp-1.3.2.jar

    2018-12-07 11:04:18
    javacpp-1.3.2.jar
  • JavaCPP fails tests on ARM64

    2021-01-08 22:10:23
    Native library not found in JAR: org/bytedeco/javacpp/test/osgi/linux-x86_64/libjniCalc.so Below <p>Note (2) a quick look around reveals libjniCalc.so on... ./target/integration-test/projects/osgi/...
  • javacpp.jar 包

    2017-12-29 11:40:45
    javacpp.jar 包还是可以的。而且哪里有摘要啊?????
  • javacpp-embedded-python
  • javacpp-1.2.4.jar

    2019-03-01 18:33:10
    车牌识别系统使用的javacpp 工具类,eclipse工具必须要使用此jar 包
  • opencv+javacpp+javacv

    2018-09-15 18:09:04
    opencv+javacpp+javacv
  • JavaCV, JavaCPP,和JavaCPP Presets的关系

    千次阅读 2019-02-18 16:14:09
    本文旨在帮助理解JavaCV, JavaCPP,和JavaCPP Presets之间的关系   JavaCV是对各种常用计算机视觉库的封装后的一组jar包,其中封装了ffmpeg、OpenCV、libdc1394、OpenKinect、videoInput和ARToolKitPlus等计算机...

    本文旨在帮助理解JavaCV, JavaCPP,和JavaCPP Presets之间的关系

     

    JavaCV是对各种常用计算机视觉库的封装后的一组jar包,其中封装了ffmpeg、OpenCV、libdc1394、OpenKinect、videoInput和ARToolKitPlus等计算机视觉编程人员常用库的接口,可以通过其中的utility类方便的在包括Android在内的Java平台上调用这些接口。其中使用最多的应该就是ffmpeg了。

     

    JavaCV 提供了在计算机视觉领域的封装库,由 JavaCPP Presets 封装而得,包括:OpenCV、ARToolKitPlus、libdc1394 2.x 、PGR FlyCapture和FFmpeg。此外,该工具可以很容易地使用Java平台的功能。

    JavaCV 还带有硬件加速的全屏幕图像显示(CanvasFrame),易于在多个内核中执行并行代码(并行),用户友好的几何和色彩的相机和投影仪校准(GeometricCalibrator,ProCamGeometricCalibrator,ProCamColorCalibrator ),检测和特征点(ObjectFinder),一类是实现投影,摄像系统(直接图像对齐设置匹配主要GNImageAligner,ProjectiveTransformer,ProjectiveGainBiasTransformer,ProCamTransformer 和ReflectanceInitializer),以及在 JavaCV 类杂项功能。

     

    JavaCPP提供了在Java中高效访问本地C++的方法。采用JNI技术实现,支持所有Java实现包括Android系统,Avian 和 RoboVM

    JavaCPP提供了一系列的Annotation将Java代码映射到C++代码,并使用一个可执行的jar包将C++代码转化为可以从JVM内调用的动态链接库文件。

     

    JavaCPP Presets 包括了java配置及一些被广泛应用的C/C++库接口。

     

    可以简单的理解为JavaCV利用了JavaCPP和JavaCPP Presets做支持。

    更多英文解释见下:

    JavaCV uses wrappers from the JavaCPP Presets of commonly used libraries by researchers in the field of computer vision (OpenCVFFmpeglibdc1394PGR FlyCaptureOpenKinectlibrealsenseCL PS3 Eye DrivervideoInputARToolKitPlusflandmarkLeptonica, and Tesseract) and provides utility classes to make their functionality easier to use on the Java platform, including Android.

    JavaCV also comes with hardware accelerated full-screen image display (CanvasFrame and GLCanvasFrame), easy-to-use methods to execute code in parallel on multiple cores (Parallel), user-friendly geometric and color calibration of cameras and projectors (GeometricCalibratorProCamGeometricCalibratorProCamColorCalibrator), detection and matching of feature points (ObjectFinder), a set of classes that implement direct image alignment of projector-camera systems (mainly GNImageAlignerProjectiveTransformerProjectiveColorTransformerProCamTransformer, and ReflectanceInitializer), a blob analysis package (Blobs), as well as miscellaneous functionality in the JavaCV class. Some of these classes also have an OpenCL and OpenGL counterpart, their names ending with CL or starting with GL, i.e.: JavaCVCLGLCanvasFrame, etc.

     

     


     

     

    JavaCPP provides efficient access to native C++ inside Java, not unlike the way some C/C++ compilers interact with assembly language. No need to invent new languages such as with SWIGSIPC++/CLICython, or RPython. Instead, similar to what cppyy strives to do for Python, it exploits the syntactic and semantic similarities between Java and C++. Under the hood, it uses JNI, so it works with all implementations of Java SE, in addition to AndroidAvian, and RoboVM (instructions).

    More specifically, when compared to the approaches above or elsewhere (CableSwigJNIGeneratorAppcxxwrapJNIWrapperPlatform InvokeGlueGenLWJGL GeneratorJNIDirectctypesJNAJNIEasyJniMarshallJNativeJ/InvokeHawtJNIJNRBridJCFFIfficxxCppSharpcgorust-bindgen, etc.), it maps naturally and efficiently many common features afforded by the C++ language and often considered problematic, including overloaded operators, class and function templates, callbacks through function pointers, function objects (aka functors), virtual functions and member function pointers, nested struct definitions, variable length arguments, nested namespaces, large data structures containing arbitrary cycles, virtual and multiple inheritance, passing/returning by value/reference/string/vector, anonymous unions, bit fields, exceptions, destructors and shared or unique pointers (via either try-with-resources or garbage collection), and documentation comments. Obviously, neatly supporting the whole of C++ would require more work (although one could argue about the intrinsic neatness of C++), but we are releasing it here as a proof of concept.

    As a case in point, we have already used it to produce complete interfaces to OpenCV, FFmpeg, libdc1394, PGR FlyCapture, OpenKinect, videoInput, ARToolKitPlus, Leptonica, Tesseract, GSL, LLVM, HDF5, MKL, CUDA, Caffe, MXNet, TensorFlow, System APIs, and others as part of the JavaCPP Presets subproject, also demonstrating early parsing capabilities of C/C++ header files that show promising and useful results.

     

     

     

     

     

    The JavaCPP Presets module contains Java configuration and interface classes for widely used C/C++ libraries.  The configuration files in the org.bytedeco.javacpp.presets package are used by the Parser to create from C/C++ header files the Java interface files targeting the org.bytedeco.javacpp package, which is turn are used by the Generator and the native C++ compiler to produce the required JNI libraries. Moreover, helper classes make their functionality easier to use on the Java platform, including Android.

     

     

     

     

    Each child module in turn relies by default on the included cppbuild.sh scripts, explained below, to install its corresponding native libraries in the cppbuild subdirectory. To use native libraries already installed somewhere else on the system, other installation directories than cppbuild can also be specified either in the pom.xml files or in the .java configuration files. The following versions are supported:

     

     

     


    起初Javacv是googlecode下面的一个项目,后续迁移到了github,并且包名也由com.googlecode.javacv改为org.bytedeco.javacv,网上的demo主要有两个:
    https://github.com/peirenlei/FFmpegRecorder
    https://github.com/CrazyOrr/FFmpegRecorder

     

    ffmpeg也有私人封装(Andrew Brampton)的java api接口,详见:

    https://github.com/bramp/ffmpeg-cli-wrapper

    <dependency>
      <groupId>net.bramp.ffmpeg</groupId>
      <artifactId>ffmpeg</artifactId>
      <version>0.6.2</version>
    </dependency>

     

     

    在深度学习方面,JavaCPP,  JavaCPP Presets, 和 JavaCV 已被集成到 ND4J 和 Deeplearning4j Caffe , cuDNN,  MXNetTensorFlow.

     


    参考资料:

     

    https://www.jianshu.com/p/fd3349d6622a
    https://www.jianshu.com/p/4d047a0d58e1

    http://bytedeco.org/news/2016/05/15/deeper-in-deep-learning/

    https://github.com/bytedeco/javacpp-presets

    https://github.com/bytedeco/javacpp

    https://github.com/bytedeco/javacv

    展开全文
  • [ERROR] Failed to execute goal on project javacpp-presets: Could not resolve dependencies for project org.bytedeco:javacpp-presets:pom:1.2-SNAPSHOT: Could not find artifact org.bytedeco:javacpp-...
  • javacpp-1.3.3-bin

    2017-10-25 19:46:56
    车牌识别项目EasyPR-Java所需要的jar包,包括javacpp-1.3.3-bin。
  • 本文旨在帮助理解JavaCV, JavaCPP,和JavaCPP Presets之间的关系JavaCV是对各种常用计算机视觉库的封装后的一组jar包,其中封装了ffmpeg、OpenCV、libdc1394、OpenKinect、videoInput和ARToolKitPlus等计算机视觉编程...
  • JavaCPP初体验

    2020-07-12 11:02:22
    JavaCPP Presets模块包含用于广泛使用的C / C ++库的Java配置和接口类。 解析器使用org.bytedeco。<moduleName> .presets包中的配置文件从C / C ++头文件中创建以org.bytedeco。<moduleName>包为目标的...
  • javacpp-master.zip

    2017-11-30 01:00:59
    javacpp的最新版本,对应的opencv版本是3.30,那个文件比较大可以直接下载,别人我什么用,人脸识别
  • <div><p>iam coding android and very confuse with mat type, in another class need Mat from org.bytedeco,javacv another asking org.bytedeco.javacpp Mat another class asking javacpp-presets Mat class ...
  • <code>No implementation found for long org.bytedeco.javacpp.Pointer.physicalBytes() (tried Java_org_bytedeco_javacpp_Pointer_physicalBytes and Java_org_bytedeco_javacpp_Pointer_physicalBytes__)</code>...
  • <div><p>I detected a strange problem while testing JavaCPP OpenCV-based functions in multi-threading mode. It occurs not frequently, but stable enough. Unfortunately, I have no a simple test for ...
  • <div><p>Is there a reason i keep getting ClassNotFound issues for org.bytedeco.javacpp.BytePointer and org.bytedeco.javacpp.Pointer? <p>I'm using this version in my sbt: "org.bytedeco" % &...
  • javacpp工具能自动封装生成java调用c++接口所需的jni库,此处提供helloworld样例便于快速上手
  • 最简单的JavaCPP调用DLL

    2017-12-12 21:10:37
    http://blog.csdn.net/ezhchai/article/details/78786035对应代码资源 解压密码:ezhchai JavaCPP调用DLL最简单示例。
  • <div><p>I’ve tried to use javacpp-presets ffmpeg on a RPI (ffmpeg-3.0.2-1.2-linux-armhf.jar ffmpeg.jar javacpp.jar). It seems that the ALSA device is not included in the ffmpeg libraries. <p>It may ...

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 1,390
精华内容 556
关键字:

javacpp

java 订阅