We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello all! I'm having a problem when trying to run a sketch that uses OpenCV. Right off the bat, I cannot run the examples that come bundled with "OpenCV for Processing"
For example, the sketch "FaceDetection", breaks down on the line:
opencv = new OpenCV(this, "test.jpg");
The error says:
A library used by this sketch is not installed properly
A library relies on native code that's not available. Or only works properly when the sketch is run as a 32-bit application
Needless to say, I tried running it with both 32 and 64 bits Processing, to no avail.
Nowadays, only "OpenCV for Processing" appears in the Library Manager, but I tried with both, that one, and "OpenCV", and none of them worked.
I also downloaded OpenCV's source, and compiled it into a .jar, but honestly, I don't know where to drop it, in order to use it in my sketches (beyond the fact that it would be cool to be able to use the Processing-compatible wrapper...)
If anyone could lend me a hand with this, I'll be forever grateful :D
Cheers!
Answers
Hi! You have to replace the jna.jar and gstreamer.jar for the older versions copied from Processing 2.0.3 or older, of the libraries at modes/java/libraries because the newer version has an unstable video libraries.
(Sorry for the writing and possible misspelling)
Hey Palom!
I tried out your solution, but the same error comes up. I downloaded 2.0.3 and replaced the libs; and I also tried just running the sketch from that old version, but it still doesn't work.
Another thing, when I try to run the example "BackgroundSubstraction", the error changes to:
java.lang.UnsatisfiedLinkError:/home/<myuser>/<processingPathToLibs>/libopencv_java245.so:libopencv_core.so.2.4: cannot open shared object file: No such file or directory
And the line where it breaks is:
opencv = new OpenCV(this, 720, 480);
(yeah, still the constructor)If you happen to have any idea, I'll gladly hear it, but in any case, thank you very much for your time!
Hi, Vyral=) There's some problem during installation of the OpenCV for Processing. You see, the path in the message is:
and should something like:
/home/Vyral/opencv_processing/library/linux32/libopencv_java245.so
Try to find if something is situated in this path.
I'd recommend you to re-install the OpenCV library through the standart method of installing libraries for Processing: "Sketch -> Import Library... -> Add library...".
Or you can try to do a very bad hack =) Create exactly this path: /home/// and puth there all from /home/Vyral/opencv_processing/library/linux32 (or some variation of it). But this solution isn't a good idea.
Hi bdshadow!
Thank you very much for your response!
The path I wrote was just a simplification of my real path. Blame my lazyness. To be precise, the error can be seen here: http://i.imgur.com/ELn3uwd.png
And, now that I'm in the screenshotty mood, here's the other error: http://i.imgur.com/dE0bALB.png
I've tried reinstalling the library with that method, to no avail. I also just tried placing my compiled OpenCV .jar as such:
sketchbook/libraries/compiled_opencv/library/opencv-248.jar
But as expected, didn't work either.
Now, I'm liking your "very bad hack" (I work as a Java developer, I make a living out of making ugly hacks). I can find the shared libs that Processing complains about: http://i.imgur.com/CzW5K7o.png
Could I make a symbolic link somewhere, so that Processing finds them?
Thanks again man!
Hi again =) As I could see here: http://i.imgur.com/ELn3uwd.png and here:http://i.imgur.com/dE0bALB.png the paths in the error and where the files we need are the same. So the question is why does it not see them? I've found this: http://itsfoss.com/solve-open-shared-object-file-quick-tip/ Shortly: check the file /etc/ld.so.conf. Our path should be there. And then run
sudo /sbin/ldconfig -v
I hope this will solve the problem.If not maybe there is still a problem with 32-64 versions. Here (https://github.com/atduskgreg/opencv-processing/tree/master/lib) are these files for all OSs. You can experiment with them: download and place in our path.
Could write the hole error? I thought it was this problem because it happened to me. And it seems that is the native libraries, the jna.jar.
I run OpenCV Processing on Ubuntu 32 bit with success. I had the same errors as you. You need to set a library path. Open a terminal window and type:
export LD_LIBRARY_PATH=~/sketchbook/libraries/opencv_processing/library/linux32 $LD_LIBRARY_PATH
Of course, change the location of the linux32 folder depending on your particular system.
Hello all!
I'm very sorry I haven't updated this! I was swamped with work lately.
bdshadow, I tried that, refreshing the libraries with ldconfig and such, but nothing new. Same old errors.
Palom, the errors are in the screenshots: The original one: http://i.imgur.com/dE0bALB.png, another one that comes up with certain sketches: http://i.imgur.com/ELn3uwd.png, and the proof that the libs are actually there: http://i.imgur.com/CzW5K7o.png
dttworld, that I haven't tried... I'll give it a shot and see what happens. Thanks a lot!
I’m on Linux 64 bits and want to share the issue I had an how it was solved.
Running the BrightestPoint example gave this error message:
A library relies on native code that’s not available. Or only works properly when the sketch is run as a 32-bit application.
Running the BackgroundSubtraction example gave me this error: java.lang.RuntimeException: java.lang.UnsatisfiedLinkError: no opencv_java245 in java.library.path
After reading other people’s similar experience I tried adding “export LD_LIBRARY_PATH=~/sketchbook/libraries/opencv_processing/library/linux64$LD_LIBRARY_PATH”
but it didn’t help
Then I googled for the file libopencv_java245.so and found a fatter version here: https://github.com/arichiv/space.carving.and.3d.printing/tree/master/java/lib
I downloaded the file and replaced the original that came with the opencv_processing library release in the /opencv_processing/library/linux64 folder, and now it works!
Hope it helps.