5. Gesture control car actions

1. Program Function Description

After the function is turned on, the camera captures images and recognizes relevant gestures to control the movement of the car.

Gesture number "5"Car stops
Gesture "yes"Car moves in a square
Gesture "ok"Car turns in a circle
Gesture "rock" (index finger and pinky finger are straight, and the others are bent)Car moves in an S shape
Gesture contempt (clenched fist, thumb extended, thumb facing down)Car moves forward

 

image-20240125161638937

2. Program code reference path

After entering the docker container, the source code of this function is located at,

3. Program startup

3.1. Startup command

Open a terminal and enter the following command to enter docker,

When the following interface appears, you have successfully entered docker

image-20240814152903441

Start chassis

Open a new terminal and enter the same docker. Change the following da8c4f47020a to the ID displayed in the actual terminal

After entering the docker container, enter in the terminal,

Turn on this function, then put your hand in front of the camera, the screen will draw the shape of your finger, and after the program recognizes the gesture, it will send the speed to the chassis, thereby controlling the movement of the car.image-20240125161902950

4. Core code

4.1. FingerCtrl.py

The implementation process here is also very simple. The main function opens the camera to obtain data and then passes it to the process function. It performs "detect palm" -> "get finger coordinates" -> "get gesture" in sequence, and then determines the action to be performed based on the gesture results.

4.2. Flowchart

image-20240201150220023