-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Make OpenCV an optional dependency to support contrib variants #2139
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from 3 commits
9518918
45c9402
4d9133b
b4b3422
b7aba15
63524a5
a59d3c2
e04444b
fa05b19
f88b612
2b67b3d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,19 @@ | ||
| # Changelog | ||
|
|
||
| ### 0.28.0rc0 <small>Unreleased</small> | ||
|
|
||
| !!! breaking "Breaking Change" | ||
| **OpenCV is now an optional dependency.** To ensure compatibility with different OpenCV variants (standard, contrib, headless), `opencv-python` has been removed from the core dependencies. Users must now explicitly choose their preferred OpenCV package: | ||
|
|
||
| - `pip install supervision[headless]` - Installs `opencv-python-headless` (recommended for servers) | ||
| - `pip install supervision[desktop]` - Installs `opencv-python` (includes GUI support) | ||
| - `pip install supervision[desktop-contrib]` - Installs `opencv-contrib-python` (extra modules + GUI) | ||
| - `pip install supervision[headless-contrib]` - Installs `opencv-contrib-python-headless` (extra modules, no GUI) | ||
|
|
||
| If you already have OpenCV installed, you can install supervision without extras: `pip install supervision` | ||
|
|
||
| This change resolves conflicts where `opencv-python` would override `opencv-contrib-python`, preventing access to extra modules like CSRT tracker. | ||
|
||
|
|
||
| ### 0.27.0 <small>Nov 16, 2025</small> | ||
|
|
||
| - Added [#2008](https://github.com/roboflow/supervision/pull/2008): [`sv.filter_segments_by_distance`](https://supervision.roboflow.com/0.27.0/detection/utils/masks/#supervision.detection.utils.masks.filter_segments_by_distance) to keep the largest connected component and nearby components within an absolute or relative distance threshold. Useful for cleaning segmentation predictions from models such as SAM, SAM2, YOLO segmentation, and RF-DETR segmentation. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,6 +48,30 @@ You can install `supervision` in a | |
| [](../LICENSE.md) | ||
| [](https://badge.fury.io/py/supervision) | ||
|
|
||
| Supervision requires OpenCV. Choose the variant that best fits your needs: | ||
|
|
||
| ```bash | ||
| # Recommended for servers (no GUI) | ||
| pip install supervision[headless] | ||
| ``` | ||
|
|
||
| ```bash | ||
| # For desktop applications (includes GUI support) | ||
| pip install supervision[desktop] | ||
| ``` | ||
|
|
||
| ```bash | ||
| # For desktop with extra modules (e.g., CSRT tracker) | ||
| pip install supervision[desktop-contrib] | ||
| ``` | ||
|
|
||
| ```bash | ||
| # For servers with extra modules (no GUI) | ||
| pip install supervision[headless-contrib] | ||
| ``` | ||
|
|
||
| If you already have OpenCV installed: | ||
|
|
||
| ```bash | ||
| pip install supervision | ||
| ``` | ||
|
Comment on lines
+51
to
79
|
||
|
|
@@ -60,7 +84,13 @@ You can install `supervision` in a | |
| [](https://badge.fury.io/py/supervision) | ||
|
|
||
| ```bash | ||
| poetry add supervision | ||
| # With headless OpenCV (recommended for servers) | ||
| poetry add supervision[headless] | ||
| ``` | ||
|
|
||
| ```bash | ||
| # With desktop OpenCV (includes GUI) | ||
| poetry add supervision[desktop] | ||
| ``` | ||
|
|
||
Borda marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| === "uv" | ||
|
|
@@ -71,13 +101,14 @@ You can install `supervision` in a | |
| [](https://badge.fury.io/py/supervision) | ||
|
|
||
| ```bash | ||
| uv pip install supervision | ||
| # With headless OpenCV (recommended for servers) | ||
| uv pip install supervision[headless] | ||
| ``` | ||
|
|
||
| For uv projects: | ||
|
|
||
| ```bash | ||
| uv add supervision | ||
| uv add supervision --extra headless | ||
| ``` | ||
|
Comment on lines
115
to
145
|
||
|
|
||
| === "rye" | ||
|
|
@@ -88,7 +119,7 @@ You can install `supervision` in a | |
| [](https://badge.fury.io/py/supervision) | ||
|
|
||
| ```bash | ||
| rye add supervision | ||
| rye add supervision --features headless | ||
| ``` | ||
|
Comment on lines
154
to
157
|
||
|
|
||
| !!! example "conda/mamba install" | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.