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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!