The following example ported the original OpenCV motion template sample code in C to Java/Processing. The original source is the motempl.c file in the OpenCV distribution.
The program started using the default video capture device and passed it to the class Motion. It employed the accumulated difference images to segment into different motion regions, delivered back with a list of rectangles, indicating where the motion components are. It then returned to the Processing main program with an ArrayList of the class Result.
Continue reading “OpenCV Motion Template Example in Processing”
This example illustrates the use of the Java version of OpenCV. I built the OpenCV 2.4.8 in Mac OSX 10.9. After building, I copied the following two files to the code folder of the Processing sketch:
The program initialised the default video capture device. It converted the PImage first into an OpenCV matrix – Mat. The matrix is duplicated into another copy and then converted back to another PImage for display with the image command.
It can achieve around 60 frame per second in my old iMac. Here is the screenshot.
Continue reading “Conversion between Processing PImage and OpenCV cv::Mat”