Module Expr Str Import alias identifier Import alias Import alias ClassDef bases NameLoad body FunctionDef arguments args NameParam NameParam defaults body Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr NameLoad Assign TupleStore NameStore AttributeStore NameLoad attr Call AttributeLoad AttributeLoad NameLoad attr attr Expr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr Str AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr Num Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam defaults body Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr ListLoad NameLoad NameLoad If CompareEq NameLoad AttributeLoad NameLoad attr body Assign AttributeStore NameLoad attr TupleLoad NameLoad NameLoad Assign AttributeStore NameLoad attr Num If AttributeLoad NameLoad attr body If BinOpBitAnd NameLoad AttributeLoad NameLoad attr body Assign TupleStore NameStore NameStore SubscriptLoad AttributeLoad AttributeLoad NameLoad attr attr Slice Num Assign TupleStore NameStore NameStore AttributeLoad NameLoad attr Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr Num Call AttributeLoad NameLoad attr ListLoad NameLoad NameLoad ListLoad NameLoad NameLoad Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr ListLoad NameLoad NameLoad Call AttributeLoad NameLoad attr ListLoad NameLoad NameLoad ListLoad NameLoad NameLoad Assign AttributeStore NameLoad attr NameLoad If BoolOpAnd CompareGt BinOpSub NameLoad NameLoad Num CompareGt BinOpSub NameLoad NameLoad Num body Assign AttributeStore NameLoad attr TupleLoad NameLoad NameLoad NameLoad NameLoad orelse Assign AttributeStore NameLoad attr NameLoad If CompareIsNot AttributeLoad NameLoad attr NameLoad body Assign AttributeStore NameLoad attr Num decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore SubscriptLoad AttributeLoad AttributeLoad NameLoad attr attr Index Num Assign NameStore Num Assign NameStore Call AttributeLoad NameLoad attr TupleLoad Num BinOpMult NameLoad NameLoad Num AttributeLoad NameLoad attr For NameStore Call NameLoad NameLoad body Assign NameStore Call NameLoad SubscriptLoad AttributeLoad NameLoad attr Index NameLoad Expr Call AttributeLoad NameLoad attr NameLoad TupleLoad BinOpAdd BinOpMult NameLoad NameLoad Num Num TupleLoad BinOpSub BinOpMult BinOpAdd NameLoad Num NameLoad Num BinOpSub Num NameLoad TupleLoad Call NameLoad BinOpDiv BinOpMult Num NameLoad NameLoad Num Num Num Assign NameStore Call AttributeLoad NameLoad attr NameLoad AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Str NameLoad decorator_list FunctionDef arguments args NameParam defaults body While NameLoad body Assign TupleStore NameStore AttributeStore NameLoad attr Call AttributeLoad AttributeLoad NameLoad attr attr Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad Call AttributeLoad NameLoad attr TupleLoad Num Num Num Call AttributeLoad NameLoad attr TupleLoad Num Num Num If AttributeLoad NameLoad attr body Assign TupleStore NameStore NameStore NameStore NameStore AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr TupleLoad NameLoad NameLoad BinOpSub NameLoad NameLoad BinOpSub NameLoad NameLoad Assign NameStore SubscriptLoad NameLoad ExtSlice Slice NameLoad NameLoad Slice NameLoad NameLoad Assign NameStore SubscriptLoad NameLoad ExtSlice Slice NameLoad NameLoad Slice NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr ListLoad NameLoad ListLoad Num NameLoad ListLoad Num ListLoad Num Num Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Num Num AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Num Expr Call AttributeLoad NameLoad attr Assign NameStore SubscriptLoad NameLoad ExtSlice Slice NameLoad NameLoad Slice NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Assign SubscriptStore NameLoad Index CompareEq NameLoad Num Num If CompareEq AttributeLoad NameLoad attr Num body Assign AttributeStore NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr ListLoad NameLoad ListLoad Num AttributeLoad NameLoad attr ListLoad Num Num Num AugAssignBitAnd NameStore NameLoad Assign NameStore TupleLoad BinOpBitOr AttributeLoad NameLoad attr AttributeLoad NameLoad attr Num Num Assign TupleStore NameStore AttributeStore NameLoad attr Call AttributeLoad NameLoad attr NameLoad AttributeLoad NameLoad attr NameLoad If AttributeLoad NameLoad attr body Assign SubscriptStore NameLoad Slice SubscriptLoad NameLoad ExtSlice Ellipsis Index AttributeLoad NameLoad attr TryExcept body Expr Call AttributeLoad NameLoad attr NameLoad NameLoad TupleLoad Num Num Num Num handlers ExceptHandler body Print 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 AttributeStore NameLoad attr UnaryOpNot AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr decorator_list decorator_list If CompareEq NameLoad Str 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
N/A N/A 
Camshift tracker
================

This is a demo that shows mean-shift based tracking
You select a color objects such as your face and it tracks it.
This reads from video camera (0 by default, or the camera number the user enters)

http://www.robinhewitt.com/research/track/camshift.html

Usage:
------
    camshift.py [<video source>]

    To initialize tracking, select the object with mouse

Keys:
-----
    ESC   - exit
    b     - toggle back-projected probability visualization
 N/A numpy np N/A cv2 N/A video App N/A object N/A __init__ N/A N/A self video_src N/A N/A N/A N/A self cam N/A N/A video create_capture video_src N/A N/A ret N/A self frame N/A N/A N/A self cam read N/A N/A N/A cv2 namedWindow camshift N/A N/A N/A cv2 setMouseCallback camshift N/A self onmouse N/A N/A self selection None N/A N/A self drag_start None N/A N/A self tracking_state 0 N/A N/A self show_backproj False N/A onmouse N/A N/A self event x y flags param N/A N/A N/A N/A x y N/A N/A np int16 N/A x y N/A N/A event N/A cv2 EVENT_LBUTTONDOWN N/A N/A N/A self drag_start N/A x y N/A N/A self tracking_state 0 N/A N/A self drag_start N/A N/A N/A flags N/A cv2 EVENT_FLAG_LBUTTON N/A N/A N/A h w N/A N/A N/A self frame shape N/A 2 N/A N/A xo yo N/A self drag_start N/A N/A x0 y0 N/A N/A np maximum 0 N/A N/A np minimum N/A xo yo N/A x y N/A N/A x1 y1 N/A N/A np minimum N/A w h N/A N/A np maximum N/A xo yo N/A x y N/A N/A self selection None N/A N/A N/A N/A x1 x0 0 N/A N/A y1 y0 0 N/A N/A N/A self selection N/A x0 y0 x1 y1 N/A N/A N/A self drag_start None N/A N/A N/A self selection None N/A N/A N/A self tracking_state 1 N/A show_hist N/A N/A self N/A N/A N/A bin_count N/A N/A N/A self hist shape N/A 0 N/A bin_w 24 N/A img N/A N/A np zeros N/A 256 N/A bin_count bin_w 3 N/A np uint8 N/A i N/A xrange bin_count N/A N/A h N/A int N/A N/A self hist N/A i N/A N/A N/A cv2 rectangle img N/A N/A N/A i bin_w 2 255 N/A N/A N/A N/A i 1 bin_w 2 N/A 255 h N/A N/A int N/A N/A 180.0 i bin_count 255 255 -1 N/A img N/A N/A cv2 cvtColor img N/A cv2 COLOR_HSV2BGR N/A N/A N/A cv2 imshow hist img N/A run N/A N/A self N/A N/A N/A True N/A N/A N/A ret N/A self frame N/A N/A N/A self cam read N/A vis N/A N/A N/A self frame copy N/A hsv N/A N/A cv2 cvtColor N/A self frame N/A cv2 COLOR_BGR2HSV N/A mask N/A N/A cv2 inRange hsv N/A N/A np array N/A 0.0 60.0 32.0 N/A N/A np array N/A 180.0 255.0 255.0 N/A N/A self selection N/A N/A N/A x0 y0 x1 y1 N/A self selection N/A N/A self track_window N/A x0 y0 N/A x1 x0 N/A y1 y0 N/A hsv_roi N/A hsv N/A N/A y0 y1 N/A x0 x1 N/A mask_roi N/A mask N/A N/A y0 y1 N/A x0 x1 N/A hist N/A N/A cv2 calcHist N/A hsv_roi N/A 0 mask_roi N/A 16 N/A 0 180 N/A N/A N/A cv2 normalize hist hist 0 255 N/A cv2 NORM_MINMAX N/A N/A self hist N/A N/A hist reshape -1 N/A N/A N/A self show_hist N/A vis_roi N/A vis N/A N/A y0 y1 N/A x0 x1 N/A N/A N/A cv2 bitwise_not vis_roi vis_roi N/A N/A vis N/A N/A mask 0 0 N/A N/A N/A self tracking_state 1 N/A N/A N/A self selection None N/A prob N/A N/A cv2 calcBackProject N/A hsv N/A 0 N/A self hist N/A 0 180 1 N/A prob mask N/A term_crit N/A N/A N/A cv2 TERM_CRITERIA_EPS N/A cv2 TERM_CRITERIA_COUNT 10 1 N/A N/A track_box N/A self track_window N/A N/A cv2 CamShift prob N/A self track_window term_crit N/A N/A self show_backproj N/A N/A N/A vis N/A N/A prob N/A N/A N/A N/A np newaxis N/A N/A N/A N/A N/A cv2 ellipse vis track_box N/A 0 0 255 2 N/A N/A N/A N/A track_box N/A N/A N/A cv2 imshow camshift vis 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 b N/A N/A N/A self show_backproj N/A N/A self show_backproj N/A N/A N/A cv2 destroyAllWindows N/A N/A N/A N/A __name__ __main__ 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