A python library for single-object tracking.
Project description
rbobjecttracking is based on an algorithm I invented called RBOT. it stands for ROI Based Object Tracking.
using rbobjecttracking, you can get around 50-70 FPS on a CPU
To use rbobjecttracking, first create your custom dataset using rbot.dataCollector.
from rbot.dataCollector import DataCollector # Import the DataCollector class
data_collector = DataCollector() # Create the DataCollector object
data_collector.collectData() # This will open a GUI window using customtkinter and opencv.
After filling in the text fields and collecting the image samples, train a small model using rbot.trainer.
from rbot.trainer import Trainer # Import the Trainer class
trainer = Trainer(dataset_path="<dataset name that you created>", img_size=(128, 128), model_path="<path you want to save your model>") # Create the Trainer object
trainer.train() # This will train and save the model to your specified model path
Training should usually take around 10seconds to a minute on your GPU depending on your dataset size, and image size.
After training, you can need to get the color mask of the object with rbot.colorExtractor.
from rbot.colorExtractor import ColorRangeSelector # import the ColorRangeSelector class
rangeSelector = ColorRangeSelector() # Create the class object
rangeSelector.select_color_range() # call the function to select your object's color range
This will open a GUI with the masked webcam, and some sliders. You need to adjust the sliders so that everything but your object turns black in the webcam view.
After selecting your object's color range, you can then start the object detection with rbot.rbot
from rbot.rbot import RBOT # Import the RBOT class
import cv2 # Import opencv for accessing the webcam
rbot = RBOT(hsvValues="<Your object's color range>", image_size=(128, 128), minimum_confidence=0.9) # Create the RBOT object
cap = cv2.VideoCapture(0) # Access the webcam
while True:
ret, frame = cap.read() # Get a frame from the webcam
processed_frame = rbot.track_object(frame=frame, color=(0, 255, 0), width=2) # Process the frame
cv2.imshow("processed frame", processed_frame) # Display the proccesed frame
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWindows()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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 rbobjecttracking-3.2.0.tar.gz.
File metadata
- Download URL: rbobjecttracking-3.2.0.tar.gz
- Upload date:
- Size: 6.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1277a8f4dedfa61e55aa760a6240e56ecd2ce5d7edce95c4c7e7005dad677524
|
|
| MD5 |
2f2e33fbe45522fd19528996337d0b92
|
|
| BLAKE2b-256 |
f8c350a78b7fba742561fecef102e62be992bc5e7625d2fec6178f6456688ab0
|
File details
Details for the file rbobjecttracking-3.2.0-py3-none-any.whl.
File metadata
- Download URL: rbobjecttracking-3.2.0-py3-none-any.whl
- Upload date:
- Size: 8.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4b5fc6d987eeef313d00f85d08da325dc869f9b82927a93ab460d3b979f189ef
|
|
| MD5 |
b9e25dcf79f4a44030c74d3b1f3eb6bc
|
|
| BLAKE2b-256 |
1fa5a86eacb5630ffbf9e0bb41bef07dc4109abdeec27e425b787ce05bf0eb38
|