Possible to see Optical Flow output?
I hope this doesn't sound too crazy, but I want to see what the optical flow looks like to make sure I know what it is seeing in a sense. The following doesn't work because opt_flow is a 2 channel float Mat. Is opt_flow even a Mat that you can visually display?
cv::Mat opt_flow;
cv::Mat gray, prevGray;
cv::Ptr<cv::DenseOpticalFlow> tvl1 = cv::createOptFlow_DualTVL1();
cv::cvtColor(image, gray, cv::COLOR_BGR2GRAY);
if(prevGray.empty()){
gray.copyTo(prevGray);
}
tvl1->calc(prevGray,gray,opt_flow);
cv::imshow("Opt Flow", opt_flow);
cv::swap(prevGray, gray);
i think you can re-use the drawing code from the farneback example (idea there is to sample a grid from the of-Mat and draw lines for the corner points)
another would be: split() it into seperate x and y channels, multiply by some factor, then imshow()
Thanks! That is a great example to work with. Extremely slow but a good start for me! Next step is to move it to the GPU! Just wanted to see it work before I did that.