Repository navigation
v1.0.0
v1.0.0
bbox-visualizer is now stable. The API in this release is the long-term
shape of the library: future 1.x releases will be bug fixes only, and any
breaking change would mean a 2.0.
Breaking changes
-
All functions are now pure. Every public function returns a new image
and never modifies the input. Previouslyadd_label,add_T_label, and
draw_flag_with_labeldrew on the input array in place. If you relied on
in-place mutation, keep the return value instead:
img = bbv.add_label(img, label, bbox). -
suppress_warningsandwarnings_suppressedremoved. Fallback
warnings now go through Python's standardloggingmodule. To silence
them:import logging logging.getLogger("bbox_visualizer").setLevel(logging.ERROR)
-
Python 3.10 is now the minimum supported version (3.9 is EOL).
New
-
Support for COCO and YOLO bounding box formats. All drawing functions
accept abbox_formatkeyword argument, so you can pass boxes straight
from your dataset or model without converting them yourself:img = bbv.draw_rectangle(img, [0.5, 0.5, 0.2, 0.3], bbox_format="yolo")
Supported formats:
"voc"([x_min, y_min, x_max, y_max]),"coco"
([x_min, y_min, width, height]), and"yolo"(normalized
[x_center, y_center, width, height]). VOC remains the default, so
existing code is unaffected. -
draw_multiple_boxes/draw_multiple_rectanglesaccept a sequence of
colors, one per box:bbox_color=[(0, 255, 0), (0, 0, 255)]. A single
tuple still applies to all boxes. -
Runnable example scripts in
examples/.
Fixed
-
Rectangle strokes are drawn inward so their outer edge lies exactly on
the bbox coordinates, aligning boxes with labels (previously the stroke
was centered on the coordinates and spilled outside the box). -
The multi-object functions now raise
ValueErrorwhenlabelsand
bboxeslengths differ, instead of silently ignoring extras. -
Label backgrounds are sized from the measured ink of the rendered text
(including flag and T-labels): largersize/thicknessvalues no
longer overflow the background, and padding is even on all sides
instead of bottom-heavy. -
The flag pole no longer pokes above the flag background, and it rises
at least 50px above the box (matching the T-label stem) so it stays
visible on small boxes. -
add_T_labelanddraw_flag_with_labelfallback paths now forward
size,thickness,draw_bg,text_bg_color, andtext_colorto
add_labelinstead of dropping them. -
The multi-object functions accept numpy arrays of bounding boxes
(previously raisedValueError: The truth value of an array is ambiguous). -
Colors may contain numpy integer channels, e.g. sampled straight from
image pixels (tuple(img[y, x])); they are normalized to built-in ints
before reaching OpenCV. -
Labels are placed above the box only when the full label background
fits in the frame, so small labels near the top edge fall back inside
the box instead of being clipped.
Security
- The minimum
opencv-pythonversion is now 4.8.1.78 (was 4.1.0.25).
Older opencv-python wheels bundle a libwebp vulnerable to
CVE-2023-4863, a
critical heap buffer overflow triggerable by decoding a malicious WebP
image. The new floor prevents installs from resolving those builds. If
you already run opencv-python 4.8.1.78 or newer (any release since
September 2023), nothing changes. - The release pipeline was hardened following a security audit: all GitHub
Actions are pinned to full commit SHAs, the publish workflow no longer
interpolates the tag name into shell (removing a script-injection
vector), and workflow token permissions are scoped to the jobs that need
them. Publishing continues to use PyPI trusted publishing (OIDC), with
no long-lived API tokens.
Internal
- CI consolidated into a single workflow running
make check(ruff + ty +
pytest) on Python 3.10, 3.12, and 3.14. - Dependabot security alerts and automated security updates are enabled on
the repository; there are deliberately no scheduled version-bump PRs.