This example continues to explore the Video module in OpenCV. It uses one of the BackgroundSubtractors, the BackgroundSubtractorKNN. It learns the motion in front of the camera and treats the stationary scene as background cad program free mac download.
In the code, the important command is
The subtractor object bkg takes in the latest frame and generates a foreground mask, fgmaskfut draft 20. We can use the foreground mask to single out the foreground moving object.
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 albums kostenlosen.
Here are a number of screen shots from the sample run.