I am currently working on a project of object tracking and have used C++ and OpenCV. I have successfully used Farneback dense optical flow to implement segmentation methods such as k means (using the displacement in each frame). Now I want to do the same thing with Lucas Kanade sparse method. But the output of this function is:
(as stated by the official site) My question is How I am going to get the result to a Mat flow? for example I have so far tried: This is the optical flow presentation. Any ideas on how I should get a Mat flow similar to the result of the Farneback optical flow? (http://docs.opencv.org/2.4/modules/video/doc/motion_analysis_and_object_tracking.html#calcopticalflowfarneback ) UPDATE: Very good answer. But now I have problems with showing the kmeans image. With farneback I used: Any ideas? (责任编辑:蚂蚁团队) |