Farneback Optical flow Opencv simple C++ tutorial and code to achieve optical flow and farneback optical flow of moving an object in OpenCV video. Let's check the video example and the achieved result on my blog. Working and well describe code is included. Optical Flow Farneback parameters remarks You need 2 images at least to calculate optical flow, the previous image (prevgray) and the current image (img). !! The previous image must be initialized first !! Both images have to be grayscale. The result is stored in flowUmat which has the same size as inputs but the format is CV_32FC2 calcOpticalFlowFarneback (prevgray, img, flowUmat, 0.4 , 1 , 12 , 2 , 8 , 1.2 , 0 ); 0.4- image pyramid or simple image scale 1 is the number of pyramid layers. 1 means that flow is calculated only from the previous image. 12 is window size. Flow is computed over the window larger value is more robust to the noise. 2 mean number of iteration of the algorithm 8 is polyn

The blog is full of OpenCV source code, tutorials, tips, tricks, and from basics to advanced streaming and video processing. The code examples are from C++. Most of the tutorials are dedicated to basics C++ OpenCV image processing, people detection from LBP haar cascades to modern deep learning. The tutorials are as well dealing with GStreamer OpenCV integration to be able to stream OpenCV output as a video stream to the web.