Make sure you have the installations from the first steps of the facial recognition example.
You need to get the HSB values of some parts of your object. There are tools on the internet to get these numbers, but even easier is a Python script below.
Run this code and adjust the sliders to isolate your object: object_detect_part1.py
Drag the sliders until only your object is white. Everything else should be black.
Write down the number in front of the slash, next to each slider.
In this example, the numbers are:
53, 179, 138, 255, 52, 255
Lower numbers: 53, 138, 52
Upper numbers: 179, 255, 255
Use this code to track and light an LED when the object is seen.
BEFORE you run this code: Add your upper and lower bound numbers to lines 25 and 26.
# Define the lower and upper bounds for the HSV mask
lower_range = np.array([167, 100, 100], dtype=np.uint8) # every "Lower" number goes here
upper_range = np.array([187, 255, 255], dtype=np.uint8) # every "Upper" number goes here
Add an LED to pin 21 (short leg to GND) you will see a light turn on when your object is seen by the camera.