Using Dense_flow to extract the image of the optical flow image, the original project address: Https://github.com/wanglimin/dense_flow
This method uses the Opecnv most basic method of optical flow image calculation, the output is flow_x and flow_y two images.
Because the input is different from the program requirements (video---continuous frame image), the program is partially modified, roughly the same.
The method for compiling the program is:
Suppose the directory of the program is: $ROOT _dense
You should first modify the source file to be compiled in Cmakelist before compiling the program.
Modify the 5th, 6 lines to:
Add_executable (Denseflow denseFlow.cpp) target_link_libraries (Denseflow ${opencv_libs})
The program is then compiled:
CD $ROOT _densemkdir BUILDCD buildcmake. Make
Note: When using this method, you need to use the opecnv2.4.x version, it is recommended to use the 2.4.10 version, if you have installed OpenCV later version, such as 3.0, you need to modify it.
(due to the bug in 3.0, so in the process of processing image data may be problematic), the bug analysis see: http://stackoverflow.com/questions/31996367/ Opencv-resize-fails-on-large-image-with-error-215-ssize-area-0-in-funct
When the image length that needs to be resize is greater than 2^31, the Ssize.area () return value is negative. Therefore, you need to comment out the following statement:
The statement needs to be commented on for an image with a height higher than the width of the image:
If you need to use different versions of OPENCV in your project development, see the different versions of OPENCV management methods:Ubuntu under multiple versions OPENCV management (multiple OPENCV version)
Ubuntu uses Dense_flow to extract optical flow images from video images