Module Expr Str Import alias identifier Import alias Import alias ImportFrom alias alias ImportFrom alias Assign NameStore Call NameLoad keyword TupleLoad Num Num keyword Num keyword TupleLoad BinOpBitOr AttributeLoad NameLoad attr AttributeLoad NameLoad attr Num Num Assign NameStore Call NameLoad keyword Num keyword Num keyword Num keyword Num ClassDef bases body FunctionDef arguments args NameParam NameParam defaults body Assign AttributeStore NameLoad attr Num Assign AttributeStore NameLoad attr Num Assign AttributeStore NameLoad attr ListLoad Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr NameLoad Assign AttributeStore NameLoad attr Num decorator_list FunctionDef arguments args NameParam defaults body While NameLoad body Assign TupleStore NameStore NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr If CompareGt Call NameLoad AttributeLoad NameLoad attr Num body Assign TupleStore NameStore NameStore TupleLoad AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad Call AttributeLoad NameLoad attr ListComp SubscriptLoad NameLoad Index Num comprehension NameStore AttributeLoad NameLoad attr attr Num Num Num Assign TupleStore NameStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad NameLoad NameLoad Assign TupleStore NameStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad NameLoad NameLoad Assign NameStore Call AttributeLoad Call AttributeLoad Call NameLoad BinOpSub NameLoad NameLoad attr Num Num attr Num Assign NameStore CompareLt NameLoad Num Assign NameStore ListLoad For TupleStore NameStore TupleStore NameStore NameStore NameStore Call NameLoad AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Num Num NameLoad body If UnaryOpNot NameLoad body Continue Expr Call AttributeLoad NameLoad attr TupleLoad NameLoad NameLoad If CompareGt Call NameLoad NameLoad AttributeLoad NameLoad attr body Delete SubscriptDel NameLoad Index Num Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad TupleLoad NameLoad NameLoad Num TupleLoad Num Num Num Num Assign AttributeStore NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad ListComp Call AttributeLoad NameLoad attr NameLoad comprehension NameStore AttributeLoad NameLoad attr NameLoad TupleLoad Num Num Num Expr Call NameLoad NameLoad TupleLoad Num Num BinOpMod Str Call NameLoad AttributeLoad NameLoad attr If CompareEq BinOpMod AttributeLoad NameLoad attr AttributeLoad NameLoad attr Num body Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign SubscriptStore NameLoad Slice Num For TupleStore NameStore NameStore ListComp Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Num comprehension NameStore AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr NameLoad TupleLoad NameLoad NameLoad Num Num Num Assign NameStore Call AttributeLoad NameLoad attr NameLoad keyword NameLoad NameLoad If CompareIsNot NameLoad NameLoad body For TupleStore NameStore NameStore Call AttributeLoad Call AttributeLoad NameLoad attr NameLoad attr Num Num body Expr Call AttributeLoad AttributeLoad NameLoad attr attr ListLoad TupleLoad NameLoad NameLoad AugAssignAdd AttributeStore NameLoad attr Num Assign AttributeStore NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr Str NameLoad Assign NameStore BinOpBitAnd Num Call AttributeLoad NameLoad attr Num If CompareEq NameLoad Num body Break decorator_list decorator_list FunctionDef arguments args defaults body Import alias TryExcept body Assign NameStore SubscriptLoad AttributeLoad NameLoad attr Index Num handlers ExceptHandler body Assign NameStore Num Print NameLoad Expr Call AttributeLoad Call NameLoad NameLoad attr Expr Call AttributeLoad NameLoad attr decorator_list If CompareEq NameLoad Str body Expr Call NameLoad
N/A N/A 
Lucas-Kanade tracker
====================

Lucas-Kanade sparse optical flow demo. Uses goodFeaturesToTrack
for track initialization and back-tracking for match verification
between frames.

Usage
-----
lk_track.py [<video_source>]


Keys
----
ESC - exit
 N/A numpy np N/A cv2 N/A video common anorm2 draw_str time clock N/A lk_params N/A dict winSize N/A 15 15 maxLevel 2 criteria N/A N/A N/A cv2 TERM_CRITERIA_EPS N/A cv2 TERM_CRITERIA_COUNT 10 0.03 N/A feature_params N/A dict maxCorners 500 qualityLevel 0.3 minDistance 7 blockSize 7 App N/A N/A __init__ N/A N/A self video_src N/A N/A N/A N/A self track_len 10 N/A N/A self detect_interval 5 N/A N/A self tracks N/A N/A N/A self cam N/A N/A video create_capture video_src N/A N/A self frame_idx 0 N/A run N/A N/A self N/A N/A N/A True N/A N/A N/A ret frame N/A N/A N/A self cam read N/A frame_gray N/A N/A cv2 cvtColor frame N/A cv2 COLOR_BGR2GRAY N/A vis N/A N/A frame copy N/A N/A N/A len N/A self tracks 0 N/A N/A N/A img0 img1 N/A N/A self prev_gray frame_gray N/A p0 N/A N/A N/A N/A np float32 N/A N/A tr N/A -1 N/A tr N/A self tracks reshape -1 1 2 N/A N/A p1 st err N/A N/A cv2 calcOpticalFlowPyrLK img0 img1 p0 None lk_params N/A N/A p0r st err N/A N/A cv2 calcOpticalFlowPyrLK img1 img0 p1 None lk_params N/A d N/A N/A N/A N/A N/A abs N/A p0 p0r reshape -1 2 max -1 N/A good N/A d 1 N/A new_tracks N/A N/A N/A tr N/A x y good_flag N/A zip N/A self tracks N/A N/A p1 reshape -1 2 good N/A N/A N/A good_flag N/A N/A N/A N/A N/A tr append N/A x y N/A N/A N/A len tr N/A self track_len N/A N/A N/A tr N/A 0 N/A N/A N/A new_tracks append tr N/A N/A N/A cv2 circle vis N/A x y 2 N/A 0 255 0 -1 N/A N/A self tracks new_tracks N/A N/A N/A cv2 polylines vis N/A N/A N/A np int32 tr N/A tr N/A self tracks False N/A 0 255 0 N/A N/A draw_str vis N/A 20 20 N/A track count: %d N/A len N/A self tracks N/A N/A N/A N/A self frame_idx N/A self detect_interval 0 N/A N/A mask N/A N/A np zeros_like frame_gray N/A N/A mask N/A 255 N/A N/A x y N/A N/A N/A np int32 N/A tr N/A -1 N/A tr N/A self tracks N/A N/A N/A N/A cv2 circle mask N/A x y 5 0 -1 N/A p N/A N/A cv2 goodFeaturesToTrack frame_gray mask mask feature_params N/A N/A p None N/A N/A N/A x y N/A N/A N/A N/A np float32 p reshape -1 2 N/A N/A N/A N/A N/A self tracks append N/A N/A x y N/A N/A self frame_idx 1 N/A N/A self prev_gray frame_gray N/A N/A N/A cv2 imshow lk_track vis N/A ch N/A 255 N/A N/A cv2 waitKey 1 N/A N/A ch 27 N/A N/A N/A N/A main N/A N/A N/A N/A N/A sys N/A N/A N/A video_src N/A N/A sys argv N/A 1 N/A N/A N/A N/A video_src 0 N/A __doc__ N/A N/A N/A N/A App video_src run N/A N/A N/A cv2 destroyAllWindows N/A N/A N/A __name__ __main__ N/A N/A N/A main