- Added `sv.ImageWindow`, a Tkinter/Pillow-based desktop image viewer with BGR, grayscale, and BGRA support, keyboard polling, left-click callbacks, context-manager usage, window-state checks, and clean close handling
- Added responsive image resizing with optional aspect-ratio preservation and correctly mapped mouse coordinates after scaling or letterboxing
- Updated compatible runnable examples to use `sv.ImageWindow`, while retaining OpenCV display APIs for worker-thread streaming examples that are incompatible with Tkinter
- Improved `sv.cv2_to_pillow` to support grayscale and BGRA images
- Updated webcam guidance to clarify capture ownership and explicit `VideoCapture` cleanup
- Fixed image-window event handling to prevent stale keypresses, ghost windows, close-time races, and blocked waits after the window closes
---------
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Codex <codex@openai.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* VideoInfo.fps returns float instead of int
Truncating the raw CAP_PROP_FPS value with int() causes timing drift for
non-integer frame rates (23.976, 29.97, 59.94). Over a long video this
accumulates into noticeable sync errors — e.g. 23 vs 23.976 drifts ~1s
per minute of footage.
Changes:
- VideoInfo.fps type annotation: int -> float
- from_video_path: int(video.get(CAP_PROP_FPS)) -> float(...)
- ByteTrack.frame_rate type annotation: int -> float (already converts
to int internally via max_time_lost = int(frame_rate / 30.0 * buffer))
- Tests: assert fps is float, add float_fps_video_path fixture at 23.976
* fix: update examples to cast float fps to int where required
* fix: wrap long docstring line in FPSBasedTimer (ruff E501)
* test: remove unused float_fps_video_path fixture
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Jirka Borovec <6035284+Borda@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* migrate YT video file download script to use `yt_dlp`; old script didn't work anymore
* RF-DETR file example works
* ultralytics stream example migrated to new inference
* migrate inference scripts to use RF-DETR-Medium
* RF-DETR naive stream example
* RF-DETR stream example
* updated README.md
* fix(pre_commit): 🎨 auto format pre-commit hooks
* Migrate `time_in_zone` examples to use `jsonargparse` and update `--classes` argument format to accept lists
* Add licensing details for `ultralytics` and `supervision` in `README.md`
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: jirka <6035284+Borda@users.noreply.github.com>
* refactor(time_in_zone): improve CLI argument handling
* Refactor examples with `jsonargparse` for improved CLI, rename `confidence` and `iou` arguments for consistency, and update documentation and requirements.
* fix(pre_commit): 🎨 auto format pre-commit hook
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- Updated type hints across multiple files to replace `Optional[X]` with `X | None` for better readability and consistency.
- Added `from __future__ import annotations` to files to enable postponed evaluation of type annotations.
- Adjusted function signatures and variable types in various modules including `polygon_zone.py`, `smoother.py`, `transformers.py`, `vlm.py`, and others.
- Ensured compatibility with Python 3.10+ type hinting features.
Signed-off-by: Onuralp SEZER <thunderbirdtr@gmail.com>
* No longer means 'has default value'. Removed where it meant that.
* `Optional[datatype]` is now used instead of `datatype, optional`
* Fixed a handful of incorrect type annotations
* initial commit
* initial stream processing script
* fix(pre_commit): 🎨 auto format pre-commit hooks
* work in progress
* fix(pre_commit): 🎨 auto format pre-commit hooks
* work in progress
* fix(pre_commit): 🎨 auto format pre-commit hooks
* ultralytics file and stream versions ready
* fix(pre_commit): 🎨 auto format pre-commit hooks
* ultralytics file and stream versions ready
* class based filtering
* fix(pre_commit): 🎨 auto format pre-commit hooks
* timer improvements
* inference static file processing script
* fix(pre_commit): 🎨 auto format pre-commit hooks
* inference stream processing script
* fix(pre_commit): 🎨 auto format pre-commit hooks
* all scripts are working
* fix(pre_commit): 🎨 auto format pre-commit hooks
* all video or stream processing scripts refactored
* fix(pre_commit): 🎨 auto format pre-commit hooks
* README.md update
* fix(pre_commit): 🎨 auto format pre-commit hooks
* initial version of draw ones script
* fix(pre_commit): 🎨 auto format pre-commit hooks
* loading image or video, drawing multiple polygons, quiting app, and aborting currently drawn polygon works.
* fix(pre_commit): 🎨 auto format pre-commit hooks
* loading image or video, drawing multiple polygons, quiting app, and aborting currently drawn polygon works.
* fix(pre_commit): 🎨 auto format pre-commit hooks
* Dynamic drawing of currently edited polygon.
* fix(pre_commit): 🎨 auto format pre-commit hooks
* Drawing tool is ready.
* fix(pre_commit): 🎨 auto format pre-commit hooks
* Final touches.
* fix(pre_commit): 🎨 auto format pre-commit hooks
* Update README.md
* fix(pre_commit): 🎨 auto format pre-commit hooks
* Update README.md
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>