Computer Vision Robot
Library for computer vision code in Google Colab and Raspberry Pi. Uses Yolo v3 with OpenCV.
Config:
Place the following files in the same directory as your script to configure.
- CONFIG_CV_SERVER.py - runs in server mode
- CONFIG_CV_ROBOT.py - runs in server mode on robot
- CONFIG_CV_LIVE_IMG.py - replaces server preview with matplotlib window
By default, the code will not use cameras (great for Google Colab!)
Example:
#Imports
from CV_Robot import robot
from CV_Robot import vision
from time import sleep
#Example - find objects in an image
img = vision.load_image("sample_images/sample_005.png")
vision.show_image(img)
vision.show_objects(img, pause=True)
print(vision.find_objects(img))
#Example - drive forward until a STOP_SIGN is found
robot.forward()
vision.activate_camera()
while True:
img = vision.get_camera_image()
if img is None: #This is good practice - it will stop the loop if the video ends / the camera fails
break
vision.show_objects(img)
if vision.Objects.STOP_SIGN in vision.find_objects(img):
break
sleep(0.1)
robot.stop()
Data Sources
https://github.com/nandinib1999/object-detection-yolo-opencv
#Download some sample videos + images for testing
wget https://github.com/nandinib1999/object-detection-yolo-opencv/raw/master/videos/pedestrians.mp4
wget https://github.com/nandinib1999/object-detection-yolo-opencv/raw/master/videos/car_on_road.mp4
wget -O sample_images.zip https://github.com/RobertJN64/CV_Robot/raw/master/Examples/Samples/100samples.zip
unzip sample_images.zip -d sample_images
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
cv_robot-0.4.6.tar.gz
(8.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cv_robot-0.4.6.tar.gz.
File metadata
- Download URL: cv_robot-0.4.6.tar.gz
- Upload date:
- Size: 8.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.9.23
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
57578c25870adfc145a12f0942fc97f8749ee94fb67f703c2d0e285dc8c2242d
|
|
| MD5 |
c45cc868ccb9ec2a44743ff986aeb04b
|
|
| BLAKE2b-256 |
f401ea5f452692f89301090cf3ee7ada692fcdc30f4ff34b101623742a9428b2
|
File details
Details for the file cv_robot-0.4.6-py3-none-any.whl.
File metadata
- Download URL: cv_robot-0.4.6-py3-none-any.whl
- Upload date:
- Size: 9.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.9.23
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3e0f55453b158cbd154ebe6212c26a27b0e9c6f2037d3661757118ffe48f4048
|
|
| MD5 |
a54625bbcf0b1d3fddd16dedc0cd2f80
|
|
| BLAKE2b-256 |
4bd2ed434786ac77cfd57cf7bd827ac52a6fff05689360c6c403e04282c5ef06
|