Question
OpenCv for Python: Tracking an object Steps to do it properly..... 1 Capture live video from Webcam 2 Display live video 3 convert BGR to
OpenCv for Python:
Tracking an object
Steps to do it properly.....
1 Capture live video from Webcam
2 Display live video
3 convert BGR to HSV
4 Display the HSV video
5 Click on HSV video and capture the HSV values at the location clicked, and a few other local values of the item you are going to track.
A. use a MouseCallback to print the HSV values.
6 Using Sliders create scalers for the min and max values you want to track
A. a Scalar will be a numpy array (np.array) that takes 3 values for minH, minS, and minV.......then a second scalar to catch the other three Max values
B. create 6 trackbars, createTrackbar with callback methods to set your six variables
7 Us the OpenCV inRange method to find the values between the scalars from HSV image and the result will go to a grayscale image (make it a binary image, white/black).
8 Dilate, erode the grayscale image to get a better representation of the object you are tracking.
9 Display the original image and the binary image where everything is black except for the object you are tracking. The tracked object will be white.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started