A modular, interactive bounding box frame labeler with zoom and pan support.
Project description
DrawBox-CV
A modular, cross-platform, Tkinter-based interactive frame annotator for computer vision datasets.
DrawBox-CV provides a desktop-based, lightweight interactive labeling GUI (similar to a local Roboflow editor), enabling real-time frame-by-frame labeling with mouse zoom and pan, dynamic color mapping, unlimited custom classes, and multi-format labels export.
Key Features
- Pristine Tkinter GUI Engine: A clean, cross-platform desktop interface that natively supports resizing to fit any monitor resolution.
- Interactive Zoom & Pan:
- Zoom: Scroll mouse wheel (zoom is centered directly around your mouse cursor).
- Pan: Drag with Right-click to pan and move the canvas.
- Bounding Box Editing:
- Draw: Click and drag with Left-click on an empty area.
- Move: Drag inside an existing box with Left-click.
- Resize: Drag the white corner handles with Left-click.
- Select: Click a box with Ctrl + Left-click to select it and activate its label class.
- Visual Selection Indicators:
- Currently selected boxes are drawn with a Red outline.
- Hovering over any box highlights it in Gold.
- Automatically assigns unique HSV colors to your classes, strictly avoiding colors close to Red or Gold to prevent confusion.
- Instruction Collapsing: Click the
▼ Instructionsor▼ Classesheaders on the sidebars to hide/reveal panels instantly.
Installation
Ensure you have Python 3.8 or newer installed on your system.
1. Install System Prerequisites (Linux Only)
On Linux systems (e.g., Ubuntu/Debian), Tkinter requires system-level libraries. Install them via your package manager:
sudo apt update
sudo apt install python3-tk
(Windows and macOS include Tkinter by default during Python installation).
2. Install Package
You can install drawbox-cv using pip or uv:
Using pip:
pip install drawbox-cv
Using uv:
uv add drawbox-cv
How to Run
DrawBox-CV can be launched either via Python code or directly from your terminal.
1. Running via Python Code (API)
from drawbox import AnnotatorApp, AnnotatorConfig
# 1. Create a configuration for your labeling session
config = AnnotatorConfig(
frames_dir="path/to/your/images", # Required: Path to the folder containing your source images (.jpg, .png, etc.)
output_labels_dir="output", # Optional: Base directory where all label folders, classes.txt, and crops will be saved. Default is "output".
start_frame=0, # Optional: Frame index to start labeling from. Default is 0.
initial_label_file="", # Optional: Path to a file containing initial labels to load on startup. Default is "".
initial_label_format="tf", # Optional: Format of the initial labels file ("tf", "yolo", "coco", "voc"). Default is "tf".
formats=["yolo"], # Optional: List of formats to save simultaneously ("tf", "yolo", "coco", "voc"). Default is ["yolo"].
save_crops=False, # Optional: Crop the annotated bounding boxes and save them into separate subfolders. Default is False.
crops_out_dir=None, # Optional: Custom folder to save crop images. Defaults to output_labels_dir/crops.
carry_over_labels=False # Optional: Copy edited labels from the previous frame to the next frame automatically. Default is False.
)
# 2. Initialize the main Tkinter application with the configuration
app = AnnotatorApp(config)
# 3. Launch the graphical interface and start labeling!
app.mainloop()
2. Running via Terminal (CLI)
Once installed, you can launch the interactive CLI runner from any folder in your terminal simply by typing:
drawbox
Or, if running directly from the source directory:
python -m drawbox
The CLI will walk you through prompts to specify the input frames folder, output formats, and other options.
Configuration Parameter Options
Below are the details of all configuration parameters accepted by AnnotatorConfig:
| Parameter | Type | Default | Description | Options / Example |
|---|---|---|---|---|
frames_dir |
str |
Required | Path to the directory containing images to label. | "data/frames" |
output_labels_dir |
str |
"output" |
Path to the base directory where labels are exported. | "labels_output" |
start_frame |
int |
0 |
Starting frame index inside the directory. | 15 |
initial_label_file |
str |
"" |
Optional initial file with annotations to pre-populate labels. | "prelabels.json" |
initial_label_format |
str |
"tf" |
Format of the initial labels file. | "tf", "yolo", "coco", "voc" |
formats |
list[str] |
["yolo"] |
List of output formats to write concurrently upon saving. | ["yolo", "coco", "voc", "tf"] |
save_crops |
bool |
False |
Whether to crop and save the bounding boxes as PNG crops. | True, False |
crops_out_dir |
str |
None |
Custom output folder for crops (defaults to output_labels_dir/crops). |
"my_crops" |
carry_over_labels |
bool |
False |
Automatically carry over bounding boxes to subsequent frames. | True, False |
Output Directory Layout
Annotations are exported into organized subfolders matching each format inside the base output_labels_dir directory:
output_labels_dir/
├── classes.txt # Unique class ID mapped to class names (e.g. "0: car")
├── yolo/ # Normalized yolo coordinates: [class_id, x_center, y_center, width, height]
│ ├── frame_001.txt
│ └── frame_002.txt
├── voc/ # XML format files matching Pascal VOC standards
│ ├── frame_001.xml
│ └── frame_002.xml
├── tf/ # Normalized coordinate text files: [class_id, xmin, ymin, xmax, ymax]
│ ├── frame_001.txt
│ └── frame_002.txt
└── crops/ # categorised PNG crops for each class (if save_crops is Enabled)
└── 0_car/
├── 0.png
└── 1.png
Keyboard Shortcuts Map
| Key | Description |
|---|---|
s / S / Enter |
Save labels and move to Next frame |
k / K / Right Arrow / Down Arrow |
Skip current frame without saving, and move to Next frame |
a / A / Left Arrow / Up Arrow |
Move back to Previous frame |
f / F |
Center and fit the image to the window size |
Ctrl + Z |
Undo the last change |
Ctrl + Shift + Z |
Redo the last change |
r / R |
Copy previous frame's labels to current frame |
Ctrl + Left Click |
Select bounding box and its class label (allows drawing nested boxes) |
Delete / Backspace |
Delete the currently selected bounding box |
0 – 9 |
Quick-select corresponding class IDs |
q / Esc |
Close window and exit app |
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 drawbox_cv-0.1.1.tar.gz.
File metadata
- Download URL: drawbox_cv-0.1.1.tar.gz
- Upload date:
- Size: 79.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.6 {"installer":{"name":"uv","version":"0.10.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
58fa170078722ffd803cbe20c7865c76ed56315dd5c2776a645efe5d0e025e64
|
|
| MD5 |
dc42b371a06f794966d4cb8907f6ff8d
|
|
| BLAKE2b-256 |
817b88ea4a80295cee777f8a1cd8271eec44795376a6cefe4182bfa10aa23db9
|
File details
Details for the file drawbox_cv-0.1.1-py3-none-any.whl.
File metadata
- Download URL: drawbox_cv-0.1.1-py3-none-any.whl
- Upload date:
- Size: 31.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.6 {"installer":{"name":"uv","version":"0.10.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5306af61fe7b9ca6ac592bff0059a2ed44d822977f9c76915c228c1af1a95408
|
|
| MD5 |
2d2bf658051ec958b9e3a1a178c87d1d
|
|
| BLAKE2b-256 |
22fa344991936463ad6d8e8b7402caaeab475c9462fec411b8c19f12ec35ab80
|