From ed273fd162a9a957ab6c475c9d4503dc7ce5dbea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Agust=C3=ADn=20Castro?= Date: Mon, 26 Feb 2024 17:43:57 -0300 Subject: [PATCH] Use the Dummy opencv to return an error if opencv not installed --- norfair/drawing/fixed_camera.py | 7 ++++++- norfair/drawing/path.py | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/norfair/drawing/fixed_camera.py b/norfair/drawing/fixed_camera.py index 3e74d8bd..28f4f791 100644 --- a/norfair/drawing/fixed_camera.py +++ b/norfair/drawing/fixed_camera.py @@ -1,6 +1,11 @@ from typing import Union -import cv2 +try: + import cv2 +except ImportError: + from norfair.utils import DummyOpenCVImport + + cv2 = DummyOpenCVImport() import numpy as np from norfair.camera_motion import HomographyTransformation, TranslationTransformation diff --git a/norfair/drawing/path.py b/norfair/drawing/path.py index 0b607062..b871389c 100644 --- a/norfair/drawing/path.py +++ b/norfair/drawing/path.py @@ -1,7 +1,12 @@ from collections import defaultdict from typing import Callable, Optional, Sequence, Tuple -import cv2 +try: + import cv2 +except ImportError: + from norfair.utils import DummyOpenCVImport + + cv2 = DummyOpenCVImport() import numpy as np from norfair.camera_motion import HomographyTransformation, TranslationTransformation