This OpenCV tutorial is a very simple code example of GPU Cuda optical flow in OpenCV written in c++. The configuration of the project, code, and explanation are included for farneback Optical Flow method. Farneback algorithm is a dense method that is used to process all the pixels in the given image. The dense methods are slower but more accurate as all the pixels of the image are processed. In the following example, I am displaying just a few pixes based on a grid. I am not displaying all the pixes. In the opposite to dense method the sparse method like Lucas Kanade using just a selected subset of pixels. They are faster. Both methods have specific applications. Lucas-Kanade is widely used in tracking. The farneback can be used for the analysis of more complex movement in image scene and furder segmentation based on these changes. As dense methods are slightly slower, the GPU and Cuda implementation can lead to great performance improvements to calculate optical flow for all pixels o
I compiled OpenCV from source code many times on different platforms and configurations. I recently tried to compile OpenCV on ubuntu with FFmpeg. So, I compile FFmpeg from the source. I tried to compile OpenCV from the source, linked to FFmpeg and failed. The short message is to use apt-get install for FFmpeg’s avlibsxxx instead of compiling from the source. Why do I get to this point? I need OpenCV lib compiled with FFmpeg for the application to read the video stream. Additionally, the final App needs Opencv with this setup as well as a custom FFmpeg build to create a streaming output of my processed video. So I need two different FFmpegs libs in the whole process. I will tell you more details in the following lines. So the goal is on the following picture. The App is linking Opencv libs( compiled with FFmpeg) and FFmpeg libs. App linking Opencv and FFmpeg More Motivation Opencv can read video from many sources, using FFMPEG, DSHOW, MSMF, GStreamer, and other reader implementation