简体   繁体   中英

OpenCV image-based optical flow field

I am looking for a simple algorithm to detect the optical flow of the entire input. In OpenCV, the Lucas-Kanade point tracking functionality is really good, but it is very slow for more than a handful of points. I am looking for an image-based result, rather than point-based. The only information I can find is about LK tracking.

I can calculate the magnitude of motion based on simple frame differencing, but I want to know the direction too. I basically want to end up with an optical flow field texture that I can feed into a gpu fluid simulation.

There must be some simple algorithm based on elementary motion detectors or something. Something like a combination of frame differencing, scaling and blurring with 3 sequential frames.

Just to be super clear, I DON'T want information on the Lucas-Kanade method.

OpenCV has a BackgroundSubtractor class that does frame differencing, I guess you'll have to do the blurring part yourself. This is, however, not strictly a calculation of optical flow.

Farneback has a method for dense optical flow, implemented in OpenCV through the cv::calcOpticalFlowFarneback(..) method. It will generate a matrix "flow" which has magnitude and direction components. Horn-Schunck method is not a built-in in OpenCV.

PS: Lukas Kanade is not very slow. It's probably the extraction of feature points that is slow. Try using cv::FAST detector.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM