简体   繁体   English

添加 JavaCV 作为依赖项,以便在 Raspberry PI 上运行?

[英]Add JavaCV as a dependency, to run on a Raspberry PI?

JavaCV documentation says I should use this to add JavaCV as a dependency to my project; JavaCV 文档说我应该使用它来将 JavaCV 作为依赖项添加到我的项目中;

dependencies {
    implementation group: 'org.bytedeco', name: 'javacv-platform', version: '1.5.4'
}

The problem with this is that this includes all kinds of crap like runtime libs for Mac, Android, Windows, etc.问题在于这包括各种垃圾,例如 Mac、Android、Windows 等的运行时库。

Which dependencies do I need to use JavaCV in my project, in a more non-bloated fashion?在我的项目中使用 JavaCV 需要哪些依赖项,以更不臃肿的方式?

After some research I've found that this is easily done using the "platform plugin of Gradle JavaCPP":经过一些研究,我发现使用“Gradle JavaCPP 平台插件”可以轻松完成此操作:

http://bytedeco.org/builds/ http://bytedeco.org/builds/

https://github.com/bytedeco/gradle-javacpp#the-platform-plugin https://github.com/bytedeco/gradle-javacpp#the-platform-plugin

Using said plugin you can specify the target platform with : gradle -PjavacppPlatform=linux-armhf and only the needed platform dependencies will be used.使用上述插件,您可以使用以下命令指定目标平台: gradle -PjavacppPlatform=linux-armhf并且只会使用所需的平台依赖项。

You also can look at the example:您还可以查看示例:

https://github.com/bytedeco/gradle-javacpp/tree/master/samples/javacv-demo https://github.com/bytedeco/gradle-javacpp/tree/master/samples/javacv-demo

I've tried building the example and a uber-jar of "only" around 100Mb is generated.我已经尝试构建示例并生成了一个“仅”大约 100Mb 的 uber-jar。

I think you could also add some exclusions to eliminate unneeded libs and further reduce the size of the jar.我认为您还可以添加一些排除项以消除不需要的库并进一步减小 jar 的大小。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM