Hi fellas, the lockdown is boring AF isn't it?
Personally for me it is so boring that I got time for my hobbies. In my small town, it is normal when sometimes internet is down, so only entertainment I have during this time - dinosaur game.
Recently, I was hanging on Instagram and saw an interesting project here. This project inspired me to create an analog of it. However, I did not have sensors as it was in the video, so I just did it with the things what I had - camera and programming skills.
In addition to this, something had to hold the camera in the right position. So, custom mini-manipulator, which I forgot to finish a long time ago was very handful. If you are interested what the manipulator is - here is the link to the tutorial and schematics.
The bonus of my project is that it is done with Machine Learning. To be more detailed, OpenCv (Open Source Computer Vision Library) is an open source computer vision and machine learning software library, was used in the project to manipulate with the camera. Camera detects the movement of the cactus and when it is close to the dinosaur it triggers the keyboard. The movement detection was implemented with the help of OpenCv, by the background substraction method. As the cactus is detected and it it close to our beloved dino, we have to implement how to escape from the hazard. It is done with the pynput - the Python package that allows monitoring and manipulating input devices.
Instructions to run the code:
- Clone the repository
git clone https://github.com/IslomK/dinosaur_opencv
- Install the Python 3.6 from the tutorial - link
- Create a virtual environment
python -m venv .env
- Install all the dependencies
pip install -r requirements.txt
- Place the camera to the dinosaur game, so it captures only the playfield.
- Run the code
python dinosaur.py
After successful implementation, here is the result:GitHub repository - https://github.com/IslomK/dinosaur_opencvVideo:
Comments
Please log in or sign up to comment.