Home > Software engineering >  How do you use the error value returned by calcOpticalFlowPyrLK
How do you use the error value returned by calcOpticalFlowPyrLK

Time:09-02

I am using goodFeaturesToTrack and calcOpticalFlowPyrLK and I am trying to eliminate poor matches. I would like to use the error that is returned. The standard format is

kp2, st, err = cv2.calcOpticalFlowPyrLK(prevImg, currImg, prevPts, None, **lk_params)

What is the 'err' and how do I interpret it? I have read that it is the euclidean distance but I am unsure what that means. From where to where? I can find absolutely no examples using this. Does that mean it is not very useful?

Thanks

CodePudding user response:

Docs say:

type of the error measure can be set in flags parameter; if the flow wasn't found then the error is not defined (use the status parameter to find such cases).

And

OPTFLOW_LK_GET_MIN_EIGENVALS: use minimum eigenvalues as an error measure (see minEigThreshold description); if the flag is not set, then L1 distance between patches around the original and a moved point, divided by number of pixels in a window, is used as a error measure.

So, depends on what flags you pass, or didn't pass. If you did nothing, then you've got an "L1 distance between patches around the original and a moved point [...]"

That's a measure of per-pixel difference. L1 means "straight-up sum" (of absolute differences).

  • Related