JETANK AI Kit-Color Tracking

From Waveshare Wiki
Jump to: navigation, search

Color Tracking

This tutorial will identify the different colors by getting the HSV value of a block of pixels in the screen by the camera.

  • Type in the address bar of your browser http://<jetbot_ip_address>:8888, connect to the cart and open /Notebooks/JETANK_5_ColorTracking/ on the left side. Open the file JETANK_5_ColorTracking_en.ipynb. The program provides Chinese and English versions, where the CN suffix is a Chinese comment and EN is an English comment.
  • Similarly, the program first initializes the camera and creates a widget to display the camera screen.

JETANK AI Kit Manual 20.png

  • Initialize ID 1 and ID 5 servos and define various functions for camera operation. ID 1 servos control the horizontal left-right movement of the robot arm and ID 5 servos control the online movement of the camera. The combination of the two servos can control the camera's up, down, left, and right movement to track the color.

JETANK AI Kit Manual 21.png

  • The default recognition color is yellow, if you want to recognize other colors you need to modify them here.

JETANK AI Kit Manual 22.png

  • Run the above program to start color tracking, the program will control the movement of the servo so that the camera always tracks the identified color. Pay attention to whether there are fragile objects within the range of motion of the servo and keep them away from children.

JETANK AI Kit Manual 23.png JETANK AI Kit Manual 24.gif

  • The program finally closes the image processing function and turns off the camera.

JETANK AI Kit Manual 25.png