diff --git a/requirements.txt b/requirements.txt index 17c7ddd..fc2ab3f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,5 @@ imageio>=2.5 imageio-ffmpeg imgviz +opencv-python tqdm diff --git a/video_cli/cli/crop.py b/video_cli/cli/crop.py index 81ee926..ec0aaf2 100644 --- a/video_cli/cli/crop.py +++ b/video_cli/cli/crop.py @@ -2,7 +2,6 @@ import argparse import os.path as osp import pprint -import cv2 import imageio import tqdm @@ -10,6 +9,14 @@ from ..utils import get_macro_block_size def selectROI(img): + try: + import cv2 + except ImportError: + raise ImportError( + "interactive ROI selection needs opencv-python: " + "pip install opencv-python, or pass --roi y1 y2 x1 x2" + ) + height, width = img.shape[:2] max_height = 500