OpenCV and your webcam can also track objects. This will be useful as you want your project to differentiate your hand from the background. OpenCV makes this amazingly simple by providing some high-level libraries that can help us with this task. To accomplish this, you'll edit a file to look something similar to what is shown in the following screenshot:
This code makes it possible to isolate your hand. Once you have created this file and saved it, you can run the program. Now take your target (in this case your hand) and move it into the frame. You should see something similar to what is shown in the following screenshot:
Note the white pixels in our threshold image showing where you hand is located. You can add more OpenCV code that gives the actual location and size of your hand. In the original image file of your hand, you can actually draw a rectangle around your hand as an indicator. Edit the file to look similar to the following screenshot: