Module Import alias identifier Import alias Import alias Assign NameStore Str FunctionDef arguments args NameParam NameParam NameParam defaults Num body Assign TupleStore NameStore NameStore SubscriptLoad AttributeLoad NameLoad attr Slice Num Assign TupleStore NameStore NameStore Call AttributeLoad SubscriptLoad AttributeLoad NameLoad attr ExtSlice Slice BinOpDiv NameLoad Num NameLoad NameLoad Slice BinOpDiv NameLoad Num NameLoad NameLoad attr Num Num Assign TupleStore NameStore NameStore AttributeLoad SubscriptLoad NameLoad Index TupleLoad NameLoad NameLoad attr Assign NameStore Call AttributeLoad AttributeLoad Call AttributeLoad NameLoad attr ListLoad NameLoad NameLoad BinOpAdd NameLoad NameLoad BinOpAdd NameLoad NameLoad attr attr Num Num Num Assign NameStore Call AttributeLoad NameLoad attr BinOpAdd NameLoad Num Assign NameStore Call AttributeLoad NameLoad attr NameLoad AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Num TupleLoad Num Num Num For TupleStore TupleStore NameStore NameStore TupleStore NameStore NameStore NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad TupleLoad NameLoad NameLoad Num TupleLoad Num Num Num Num Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Assign TupleStore NameStore NameStore SubscriptLoad AttributeLoad NameLoad attr Slice Num Assign TupleStore NameStore NameStore TupleLoad SubscriptLoad NameLoad ExtSlice Slice Slice Index Num SubscriptLoad NameLoad ExtSlice Slice Slice Index Num Assign NameStore BinOpAdd Call AttributeLoad NameLoad attr NameLoad NameLoad AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr BinOpAdd BinOpMult NameLoad NameLoad BinOpMult NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr TupleLoad NameLoad NameLoad Num AttributeLoad NameLoad attr Assign SubscriptStore NameLoad ExtSlice Ellipsis Index Num BinOpMult NameLoad BinOpDiv BinOpDiv Num AttributeLoad NameLoad attr Num Assign SubscriptStore NameLoad ExtSlice Ellipsis Index Num Num Assign SubscriptStore NameLoad ExtSlice Ellipsis Index Num Call AttributeLoad NameLoad attr BinOpMult NameLoad Num Num Assign NameStore Call AttributeLoad NameLoad attr NameLoad AttributeLoad NameLoad attr Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Assign TupleStore NameStore NameStore SubscriptLoad AttributeLoad NameLoad attr Slice Num Assign NameStore UnaryOpUSub NameLoad AugAssignAdd SubscriptStore NameLoad ExtSlice Slice Slice Index Num Call AttributeLoad NameLoad attr NameLoad AugAssignAdd SubscriptStore NameLoad ExtSlice Slice Slice Index Num SubscriptLoad Call AttributeLoad NameLoad attr NameLoad ExtSlice Slice Index AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad AttributeLoad NameLoad attr Return NameLoad decorator_list If CompareEq NameLoad Str body Import alias Print NameLoad TryExcept body Assign NameStore SubscriptLoad AttributeLoad NameLoad attr Index Num handlers ExceptHandler body Assign NameStore Num Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad AttributeLoad NameLoad attr Assign NameStore NameLoad Assign NameStore NameLoad Assign NameStore Call AttributeLoad NameLoad attr While NameLoad body Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad Num Num Num Num Num Num Num Assign NameStore NameLoad Expr Call AttributeLoad NameLoad attr Str Call NameLoad NameLoad NameLoad If NameLoad body Expr Call AttributeLoad NameLoad attr Str Call NameLoad NameLoad If NameLoad body Assign NameStore Call NameLoad NameLoad NameLoad Expr Call AttributeLoad NameLoad attr Str NameLoad Assign NameStore BinOpBitAnd Num Call AttributeLoad NameLoad attr Num If CompareEq NameLoad Num body Break If CompareEq NameLoad Call NameLoad Str body Assign NameStore UnaryOpNot NameLoad Print Str SubscriptLoad ListLoad Str Str Index NameLoad If CompareEq NameLoad Call NameLoad Str body Assign NameStore UnaryOpNot NameLoad If NameLoad body Assign NameStore Call AttributeLoad NameLoad attr Print Str SubscriptLoad ListLoad Str Str Index NameLoad Expr Call AttributeLoad NameLoad attr
N/A N/A numpy np N/A cv2 N/A video N/A help_message 
USAGE: opt_flow.py [<video_source>]

Keys:
 1 - toggle HSV flow visualization
 2 - toggle glitch

 draw_flow N/A N/A img flow step N/A 16 N/A N/A N/A h w N/A N/A img shape N/A 2 N/A N/A y x N/A N/A N/A N/A np mgrid N/A N/A N/A step 2 h step N/A N/A step 2 w step reshape 2 -1 N/A N/A fx fy N/A N/A flow N/A N/A y x T N/A lines N/A N/A N/A N/A N/A np vstack N/A x y N/A x fx N/A y fy T reshape -1 2 2 N/A lines N/A N/A np int32 N/A lines 0.5 N/A vis N/A N/A cv2 cvtColor img N/A cv2 COLOR_GRAY2BGR N/A N/A N/A cv2 polylines vis lines 0 N/A 0 255 0 N/A N/A N/A x1 y1 N/A x2 y2 lines N/A N/A N/A N/A cv2 circle vis N/A x1 y1 1 N/A 0 255 0 -1 N/A vis N/A draw_hsv N/A N/A flow N/A N/A N/A N/A h w N/A N/A flow shape N/A 2 N/A N/A fx fy N/A N/A flow N/A N/A N/A N/A 0 N/A flow N/A N/A N/A N/A 1 N/A ang N/A N/A N/A np arctan2 fy fx N/A np pi N/A v N/A N/A np sqrt N/A N/A fx fx N/A fy fy N/A hsv N/A N/A np zeros N/A h w 3 N/A np uint8 N/A N/A hsv N/A N/A N/A 0 N/A ang N/A N/A 180 N/A np pi 2 N/A N/A hsv N/A N/A N/A 1 255 N/A N/A hsv N/A N/A N/A 2 N/A N/A np minimum N/A v 4 255 N/A bgr N/A N/A cv2 cvtColor hsv N/A cv2 COLOR_HSV2BGR N/A bgr N/A warp_flow N/A N/A img flow N/A N/A N/A N/A h w N/A N/A flow shape N/A 2 N/A flow N/A flow N/A N/A flow N/A N/A N/A N/A 0 N/A N/A np arange w N/A N/A flow N/A N/A N/A N/A 1 N/A N/A N/A np arange h N/A N/A N/A N/A np newaxis N/A res N/A N/A cv2 remap img flow None N/A cv2 INTER_LINEAR N/A res N/A N/A N/A __name__ __main__ N/A N/A sys N/A help_message N/A N/A N/A fn N/A N/A sys argv N/A 1 N/A N/A N/A N/A fn 0 N/A cam N/A N/A video create_capture fn N/A N/A ret prev N/A N/A cam read N/A prevgray N/A N/A cv2 cvtColor prev N/A cv2 COLOR_BGR2GRAY N/A show_hsv False N/A show_glitch False N/A cur_glitch N/A N/A prev copy N/A True N/A N/A N/A ret img N/A N/A cam read N/A gray N/A N/A cv2 cvtColor img N/A cv2 COLOR_BGR2GRAY N/A flow N/A N/A cv2 calcOpticalFlowFarneback prevgray gray None 0.5 3 15 3 5 1.2 0 N/A prevgray gray N/A N/A N/A cv2 imshow flow N/A draw_flow gray flow N/A show_hsv N/A N/A N/A N/A cv2 imshow flow HSV N/A draw_hsv flow N/A show_glitch N/A N/A cur_glitch N/A warp_flow cur_glitch flow N/A N/A N/A cv2 imshow glitch cur_glitch N/A ch N/A 255 N/A N/A cv2 waitKey 5 N/A N/A ch 27 N/A N/A N/A N/A ch N/A ord 1 N/A N/A show_hsv N/A show_hsv N/A HSV flow visualization is N/A N/A off on N/A show_hsv N/A N/A ch N/A ord 2 N/A N/A show_glitch N/A show_glitch N/A show_glitch N/A N/A cur_glitch N/A N/A img copy N/A glitch is N/A N/A off on N/A show_glitch N/A N/A N/A cv2 destroyAllWindows