我正在使用 Java 启动 OpenCV,并希望通过创建一个 maven 项目开始。 为此,我正在使用 OpenCV-2.4.4 jar。
但无法找到将该 jar 包含在依赖项 中所需的 pom 条目。
如果我遗漏了一些太微不足道的东西,请告诉我。或者在哪里可以找到相同的 POM 条目。 我所能找到的只是谷歌版本的 pom 条目:
<dependency>
<groupId>com.googlecode.javacv</groupId>
<artifactId>javacv</artifactId>
<classifier>linux-x86_64</classifier>
<version>0.3</version>
</dependency>
但是我需要 OpenCV-2.4.4.jar 的 pom 标签
最佳答案
据我所见http://code.google.com/p/javacv/#Quick_Start_for_OpenCV_and_FFmpeg你应该:
point your pom.xml file to the Maven repository http://maven2.javacv.googlecode.com/git/, and make sure that the library files of OpenCV and FFmpeg (*.so, *.dylib, or *.dll) can be found either in their default installation directories or in the system library PATH, which under Windows includes the current working directory.
要添加新的maven repo,您可以按照: http://www.mkyong.com/maven/how-to-add-remote-repository-in-maven-pom-xml/
之后,您似乎可以使用最新版本的 javacv(存在于 repo 中):
<dependency>
<groupId>com.googlecode.javacv</groupId>
<artifactId>javacv</artifactId>
<version>0.5</version>
</dependency>
或者,如您指定的那样(使用特定于平台的分类器):
<dependency>
<groupId>com.googlecode.javacv</groupId>
<artifactId>javacv</artifactId>
<classifier>linux-x86_64</classifier>
<version>0.5</version>
</dependency>
更新:
抱歉,我之前的回答似乎没有捕获要点。如果您尝试使用 OpenCV
java 绑定(bind)而不是 JavaCV
( http://code.google.com/p/javacv ),似乎还没有提供 Maven 打包。
由于官方教程只使用ant
(http://docs.opencv.org/2.4.4-beta/doc/tutorials/introduction/desktop_java/java_dev_intro.html)
此外,对于您所期望的,还有一个 Unresolved 错误:http://code.opencv.org/issues/3097
所以唯一的选择似乎是等待错误的解决,同时使用其他方式。
关于maven - OpenCV-2.4.4 POM入门标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17916764/