atduskgreg / opencv-processing

OpenCV for Processing. A creative coding computer vision library based on the official OpenCV Java API
Other
1.34k stars 464 forks source link

Duplicate libraries error when creating a contributed library using OpenCV for Processing #72

Closed jorditost closed 9 years ago

jorditost commented 9 years ago

Hi, First of all, sorry if it's not the place to ask this.

I am creating a contributed library (the name is StageDetector) using this one and I get the following error in the Processing IDE:

Duplicate libraries found for gab.opencv.

processing.app.SketchException: Duplicate libraries found for gab.opencv.
    at processing.app.Mode.getLibrary(Mode.java:333)
    at processing.mode.java.JavaBuild.preprocess(JavaBuild.java:434)
    at processing.mode.java.JavaBuild.preprocess(JavaBuild.java:192)
    at processing.mode.java.JavaBuild.build(JavaBuild.java:151)
    at processing.mode.java.JavaBuild.build(JavaBuild.java:130)
    at processing.mode.java.JavaMode.handleRun(JavaMode.java:120)
    at processing.mode.java.JavaEditor$23.run(JavaEditor.java:697)
    at java.lang.Thread.run(Thread.java:745)

I have created the library in Eclipse using the processing library template. I added the opencv_processing.jar in my Build Path and I import the library like this:

import gab.opencv.*;

Before I created my library, I had a sketch in Processing that imported OpenCV, and the StageDetector was simply a class in my code. Now I've moved the StageDetector class to my library (StageDetector), and here is where the problem comes.

If I remove the import.gab.opencv.*; from the sketch (this is already added in my library), then I get this error in the Processing IDE:

A library used by this sketch is not installed properly.

Stage Detector 0.2.0 by Jordi Tost
A library relies on native code that's not available.
Or only works properly when the sketch is run as a 32-bit  application.

In the Build Path of my library I had to add the JAR files for OpenCV for Processing (opencv_processing.jar) and for the native OpenCV (opencv-245.jar). This last one is already included by the OpenCV library, so I don't know why I had to include it again to the build path, but if I didn't I got some errors (when working with Mat).

Any ideas?

Thanks for your help!

jorditost commented 9 years ago

I checked this thread here but without luck: http://forum.processing.org/one/topic/duplicate-libraries-in-2-0.html

jorditost commented 9 years ago

I resolved this adding all opencv files (the folders linux32, linux 64, etc.) into my lib/ folder. Wondering if it's possible not to add all this files again, since they are already on the opencv_processing library?