2/13/2024 0 Comments Bouncing red ball animated gifIf you don’t already have imutils installed on your system, you can grab the source from GitHub or just use pip to install it: $ pip install -upgrade imutilsįrom there, Lines 11-16 handle parsing our command line arguments. We’ll also be using imutils, my collection of OpenCV convenience functions to make a few basic tasks (like resizing) much easier. Maintaining such a queue allows us to draw the “contrail” of the ball as its being tracked. We’ll be using deque, a list-like data structure with super fast appends and pops to maintain a list of the past N (x, y)-locations of the ball in our video stream. Lines 2-8 handle importing our necessary packages. Help="path to the (optional) video file")Īp.add_argument("-b", "-buffer", type=int, default=64, # construct the argument parse and parse the arguments Open up a new file, name it ball_tracking.py, and we’ll get coding: # import the necessary packages Looking for the source code to this post? Jump Right To The Downloads Section Ball tracking with OpenCV
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |