我无法让 OpenCV 与 Grails 一起工作。我有以下错误:
no opencv_java2413 in java.library.path
我在 "C:\opencv" 中安装了最新的 OpenCV (2.4.13),并添加了以下 Gradle 依赖项:
compile files('libs/opencv-2413.jar')
我无法让 OpenCV 与 Grails 一起工作。我有以下错误:
no opencv_java2413 in java.library.path
我在 "C:\opencv" 中安装了最新的 OpenCV (2.4.13),并添加了以下 Gradle 依赖项:
compile files('libs/opencv-2413.jar')
GOT IT! Add a ton of logging to my vv.Hello.java class (IDK if this works with groovy or not)
What the HELL is the "files" directory?
Where did that come from GRAILS GURUS?
I put my DLL in there & it just worked. haha. mine is the 310 yours will be 24x.
EDIT: Turns out the .dll has to be in BOTH, files dir & the system PATH. Add the sample code snippet to see where the locations are for your system (ie: if you're running jetty or something.) put the DLL in both. then run it. To get it to run from IntelliJ I had to drop the dll in this system dir:
C:\Windows\System32\WindowsPowerShell\v1.0\
and here:
user.dir=C:\grdev\hwopencv\files\
see below.
GitHub sample of what I got working
https://github.com/kmacpher67/grails-opencv-sample/blob/master/README.md
My motto is: "When in doubt, log the crap of everything, till there's enough log files to crash the o/s and end the futility!"
System.out.println("Welcome to OpenCV " + Core.VERSION);
System.out.println("Welcome to OpenCV NATIVE_LIBRARY_NAME= " + Core.NATIVE_LIBRARY_NAME);
String opencvpath = System.getProperty("user.dir") + "\\files\\";
System.out.println("user.dir="+opencvpath);
String libPath = System.getProperty("java.library.path");
System.out.println("libPath="+libPath);
System.load(opencvpath + Core.NATIVE_LIBRARY_NAME + ".dll");
I got a love-hate relationship with libs. When they do magic for you, love them! When they do this to me. Thanks for motivating me to figure this out!
NOTE2: I got this working from groovy too! Use a different static loader syntax (see sample controller method index1
Runtime.getRuntime().load0(groovy.lang.GroovyClassLoader.class, path)
它可能没有找到jar文件?我是那种破坏构建的专家,你能试着把它作为绝对路径而不是相对路径吗?
compile files('c:/opencv/libs/opencv-2413.jar')
顺便说一句:你有没有遵循任何具体的指南或食谱?我希望有一个简单的插件已经完成,它使用事件处理或其他东西将其作为服务,这些可能是非确定性的长时间运行过程,不适合网页响应时间。编辑添加图像:所以我 d/l 3.1 版本。这就像 grails 2x 与 3.x 的决定,我都使用过,我认为 3.x 有更多的功能,而且绝对足够稳定。就像 grails 一样,那里有很多 2.x 的人。使用 IDEA 导入 Eclipse 项目。他们有一个不是 gradle 或 grails 的“ant”示例,但基本的 java 版本工作表明这是一个类路径或 .dll 源路径问题。我将尝试构建一个简单的硬件 grails 示例,看看是否可以编译它。您是否能够获得一个基本的仅限 java 的示例来工作?