How can i use this Optical Flow GPU in your video stabilization code ?

Thank you for great posts !

Best regards,

]]>I like it a lot that this method generalizes to any dimension without changing anything but the number “3” to a symbol “K” indicating the dimension.

One remark that no-one has yet made, though: I expected this method to be completely general, but it doesn’t work if A and B are rank-deficient, meaning that the vectors in A are expressed as K-dimensional tuples but are all, in fact, in a proper H-dimensional subspace of \mathbb{R}^K. I am using the following (Python) example:

n = 3

A = zeros((n,n))

A[0] = [0,0,0]

A[1] = [1.22664, 0.0, 0.0]

A[2] = [-0.77977173025500601, -1.1568922037921743, 0.0]

B = zeros((n,n))

B[0] = [-0.77 , 0.49 , 0. ]

B[1] = [-1.33 ,-0.6 , 0. ]

B[2] = [ 0.62 , 0.66 , 0. ]

Whereas A and B are very slightly off, the matrix (A’ = R . A + t) is not a congruence of A, as the following Euclidean distances show:

||A0-A1|| = 1.227; ||B0-B1|| = 1.225; ||A’0-A’1|| = 1.452

||A0-A2|| = 1.395; ||B0-B2|| = 1.400; ||A’0-A’2|| = 2.471

||A1-A2|| = 2.316; ||B1-B2|| = 2.322; ||A’1-A’2|| = 1.715

I’m rather surprised because, tracing through the code execution, the rotation matrix is correctly (?) identified as decomposed into an upper-left 2×2 block and a lower-right 1×1 block. But the result is obviously wrong.

My next port of call will be to project A,B on the subspace and work in full dimension (i.e. 3 vectors in 2D). But it would be nice to have a completely general method that works in any dimension and that also holds in rank-deficient cases.

]]>though according to me giving kalman filter to each blob my camera sees can work (not sure) ,,

does any one know any simple method to give a unique id to the blob .. (cpp and opencv )

thanks

]]>In this line: cv::calcOpticalFlowPyrLK(prev_grey, cur_grey, prev_corner, cur_corner, status, err);

All elements in status are 0 meaning no match found, however the grey images seem fine. I had to convert them to CV_8U:

cur_grey.convertTo(cur_grey, CV_8U);

, otherwise program crashes with assertion fail.

any ideas?

]]>