问题
I'm trying to work with the openCV library. I keep getting errors (I've tried to install both 32-bit and 64-bit processing, and followed the exact instructions online). This is the code I'm trying to run (the most basic one i think):
import hypermedia.video.*; // Imports the OpenCV library
OpenCV opencv; // Creates a new OpenCV Object
void setup()
{
size( 320, 240 );
opencv = new OpenCV( this ); // Initialises the OpenCV object
opencv.capture( 320, 240 ); // Opens a video capture stream
}
void draw()
{
opencv.read(); // Grabs a frame from the camera
opencv.absDiff(); // Calculates the absolute difference
image( opencv.image(), 0, 0 ); // Display the difference image
}
void keyPressed()
{
opencv.remember(); // Remembers a frame when a key is pressed
}
This is the error I get: A library relies on native code that's not available. Or only works properly when the sketch is run as a 64-bit application.
Any help would be appreciated!, thanks
回答1:
For the old school OpenCV 1.0 wrapper make sure you install OpenCV 1.0 first. So on Windows install the OpenCV1.0 and in the install tick the Add <...>\OpenCV\bin to system PATH checkbox when you install it, or manually add the PATH to environment variables. On OSX it's a matter of installing the OpencV.framework. The Processing wrapper should work after that.
That wrapper is a bit outdated though. You might want to try Greg's OpenCV Processing wrapper







回答2:
Depends on what version of OpenCV you are using, the library hypermedia doesn't work for processing 2.0 If you want to continue with that code you need to get Processing 1.0 but I recommend to update the OpenCV library.
来源:https://stackoverflow.com/questions/19942608/open-cv-with-processing-error