Ask Your Question

how to use calcOpticalFlowSF

asked 2012-12-21 04:24:42 -0500

bagheraa gravatar image

Hello, I'm new to OpenCV, y I dont have meny skills on OpenCV 2. I'm trying to use the function calcOpticalFlowSF(), but the documentation on this item in seem to be wrong. In the header of the c++ it says:

void calcOpticalFlowSF(Mat& from, Mat& to, Mat& flow, int layers, int averaging_block_size, int max_flow, double sigma_dist, double sigma_color, int postprocess_window, double sigma_dist_fix, double sigma_color_fix, double occ_thr, int upscale_averaging_radius, double upscale_sigma_dist, double upscale_sigma_color, double speed_up_thr)

that sums a total of 16 parameters, but in the explanation of the parameters the Matrix 'flow' doesn't appear. In its place it appears two Matrices: 'flowX' and 'flowY'.

I have checked the library header, and the function call is like the one on the docs. So I have suppossed that 'flow' is a void matrix that will be filled by the function.

The problem is that when I call the function, it hangs and waits forever.

How must I call the function? Must I prepare flow as a two float channel image?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2012-12-21 07:31:21 -0500

There is C++ sample for calcOpticalFlowSF in <opencv_root>/samples/cpp/simpleflow_demo.cpp.

edit flag offensive delete link more


The demo doesn't really help. No matter if I call the function with the arguments provided in the demo the function never returns. What is the time complexity for this algorithm compared to the image resolution?

erenik gravatar imageerenik ( 2014-08-04 10:34:07 -0500 )edit

Question Tools


Asked: 2012-12-21 04:24:42 -0500

Seen: 2,337 times

Last updated: Dec 21 '12