From a0133e5c69e6ffbb7831f7fefda867bdbe0ee5af Mon Sep 17 00:00:00 2001 From: erdogant Date: Wed, 8 Jan 2025 01:29:42 +0100 Subject: [PATCH] testing with a opencv-python that is smaller in size --- clustimage/clustimage.py | 9 ++++++++- requirements.txt | 2 +- requirements_additional.txt | 1 + 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/clustimage/clustimage.py b/clustimage/clustimage.py index 51a9e36..a7d9272 100644 --- a/clustimage/clustimage.py +++ b/clustimage/clustimage.py @@ -25,7 +25,6 @@ import os import logging import fnmatch -import cv2 import matplotlib.pyplot as plt from matplotlib import offsetbox @@ -50,6 +49,14 @@ # Register HEIF opener for Pillow register_heif_opener() +try: + import cv2 +except ImportError: + raise ImportError( + "The 'opencv-python' library is not installed. Please install it using the following command:\n" + "pip install opencv-python") + + # Configure the logger logger = logging.getLogger('') [logger.removeHandler(handler) for handler in logger.handlers[:]] diff --git a/requirements.txt b/requirements.txt index 6714caf..b6a505a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,9 +11,9 @@ scikit-learn matplotlib scikit-image scipy -opencv-python pypickle imagehash pypickle ismember pillow-heif +opencv-python-headless diff --git a/requirements_additional.txt b/requirements_additional.txt index 685bedc..04d42cd 100644 --- a/requirements_additional.txt +++ b/requirements_additional.txt @@ -1,3 +1,4 @@ piexif geopy folium +opencv-python