I have a question concerning two parameters in CalcOpticalFlowPyrLK() class.Here is the link of the documentation:
The first parameter is the "err". In the documentation this is defined as the tracking error of it's feature, but they don't give any details. Error in respect of what?
Secondly the parameter "status".They define it as the state if a corresponding feature is found(1) or not(0). I have cases that the error of the tracking for a specific feature is low and the status is "not found=0" for this feature.I have also the opposite case.
Is there any connection between those two? I try to detect eye blink.Obviously the feature i have in the cornea of the eye(glints) are not there when the eye is closed.But still for this frame the state remains 1(found) but the error explodes. Eg I have frame t and i try to track the feature in frame t+1.In frame t all the features are there.In frame t+1 the features are gone(eye blink) but the status is still 1.
The connection of these two values is that you first have to check the status array. The status array says if a feature point was found or not. This "check" has a higher priority then the error. The documentation says: "if the flow wasn’t found then the error is not defined". But the memory has to get alloceted anyway to keep the index correspondences. In C++ you have to initalize values, if this not happend there will be some random value. So I think OpenCV is not fill the array with zeros or something before. So that is why it can happend that the error is really small, but there is no status bit!
Here is some explenation how it Lucas-Kanada Method works.
When I was implementing Optical Flow in OpenCV i found this nice link.
Also the book Mastering OpenCV with Practical Computer Vision Projects has a usefull chapter about that.