Which version of Processing is compatible with the openCV library?

edited May 17 in Kinect


I'm a beginner and I want to make a program in which my camera detects how a frame differs from a previous frame. If it differs, I want my camera to automatically take a picture.

I found something about this:

A useful function is absDiff() (absolute difference). This calculates the difference between two images, the one in the regular buffer and one in a second buffer (which an image can be stored in using the ‘remember()’ function. absDiff can be used to perform a number of useful functions.

One of these is background subtraction:

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

When a key is pressed, the current frame is stored in memory and is used when calculating the absolute difference. This means that only changes between the stored frame and the current frame are shown.

To use this code, I downloaded the openCV library but it won't work with the latest version of Processing. I get the error that 'something isn't installed right'. Does anybody know which version is compatible with the openCV library? And does anybody perhaps have some tips and tricks for making my program as described above.


Sign In or Register to comment.