OpenCV and Processing 16

This example continues from the last post to compute the optical flow between 2 greyscale images by using the calcOpticalFlowPyrLK() function in the Video module. The new position of the pixels tracked will be delivered in a MatOfPoint2f object. By using the last and current position of the feature points, we can plot the path of the pixel movements. Furthermore, we can use such information for interactive or generative drawings, found in my artwork, Movement in Time.


Continue reading

OpenCV and Processing 13

In this example, we move on to the Video module of OpenCV 3.0.0. The first function we test is the Dense Optical Flow. It demonstrates the use of the calcOpticalFlowFarneback function. Again it makes use of the previous CVImage object to bridge between the Processing PImage and OpenCV Mat. The example also reduces the size of the video (using the variable factor) before sending it for the optical flow processing; otherwise, the process can be lengthy.

The optical flow process will basically compare two consecutive frames (the Mat last and grey) from the live webcam video. It will try to compute where the current pixels move to in the new frame.

Here are a number of screen shots from the sample run.


Continue reading