In this project, we are going to demonstrate how you can drive a car simply by detecting gestures on the steering wheel. Let’s say a requirement is something like this —
- If the driver wants to start the car, put both hands on the steering wheel.
- If someone who has no hands on the steering wheel, it means that the vehicle’s brakes will be applied slowly.
- If one hand is found on the steering wheel, it means that he / she can drive the vehicle up to a certain limit for safety reasons.
- If someone keeps both hands on the steering wheel, it means that he / she can move at any speed, because according to our system you are safe and can safely drive with both hands.
For this project we need to import two Python libraries — OpenCV and numpy . How to install these two libraries.
1) pip install opencv-python 2) pip install numpy
Below is the implementation:
Code # 1:
We imported two libraries named opencv and numpy st rong>. Then in the next line we use the
VideoCapture (0) opencv function and the
VideoCapture (0) parameter as 0 because your laptop’s webcam supports port 0 for using the camera. Now use the
CascadeClassifier (& # 39; hand.xml & # 39;) function and pass the xml file as a parameter. Save the hand.xml file in the same directory as the Python file.
Code # 2:
In this section of code we use a counter that can help us start the car engine, and after starting car we use contour counting on the steering wheel.
GitHub project link — Click here