We use the Open Source Computer Vision Library OpenCV with Cascade Classifier features to detect and track the target.
-
Detect the host computer's OS, hostname and IP address.
-
Initialize NetworkTables client and stream server, then connect to the "vision" table.
-
Define the camera according to the OS and parameters.
-
Define the cascade classifier path. (The classifier we used is trained to detect FRC Power Ports, and can be downloaded from here)
-
while True:
- Read the image from the camera.
- Detect the target using the cascade_classifier.detectMultiScale() method.
- If the target is detected, draw a rectangle around it.
- Display the image.
- Send the target's position to the NetworkTables.
- Wait for the next frame.
-
Clone the repository.
git clone https://github.com/Scorpions-Robotics/vision-2021.git
-
Install the required dependencies.
pip install --upgrade -r requirements.txt
-
On Linux you have to install extra dependencies.
cd misc/bash/
chmod +x *
./install_os_dependencies.sh
-
Copy
settings.ini.template
and rename it tosettings.ini
. Then edit it to your needs. -
Run the
vision.py
file to start the vision processing.
-
Always make sure to run the file from the root directory of the project.
-
Always keep the dependencies up to date.
-
Always use the latest stable version of this project.
-
Instagram: https://instagram.com/scorpions7672
-
YouTube: https://www.youtube.com/channel/UCLsK3acedtyaD6dABW39g2Q
-
Discord Server: https://discord.gg/MqvbYPecgt
-
If you have any suggestions, or found any bugs, please open an issue or create a pull request.
-
Don't hesitate to open an issue if you have any questions about the code.
This project is licensed under the Apache-2.0 license. All rights reserved.