Do not import cv2 in camera.__init__ unless we specify a video_type that needs to be expanded. Otherwise we introduce the OpenCV dependency also for the camera.pi plugin
This commit is contained in:
parent
e9c7104242
commit
a43508a743
1 changed files with 5 additions and 3 deletions
|
@ -110,15 +110,17 @@ class CameraPlugin(Plugin):
|
||||||
:type flip: int
|
:type flip: int
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import cv2
|
|
||||||
super().__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
|
|
||||||
self._default_frames_dir = os.path.join(Config.get('workdir'), 'camera', 'frames')
|
self._default_frames_dir = os.path.join(Config.get('workdir'), 'camera', 'frames')
|
||||||
self.default_device_id = device_id
|
self.default_device_id = device_id
|
||||||
self.frames_dir = os.path.abspath(os.path.expanduser(frames_dir or self._default_frames_dir))
|
self.frames_dir = os.path.abspath(os.path.expanduser(frames_dir or self._default_frames_dir))
|
||||||
self.warmup_frames = warmup_frames
|
self.warmup_frames = warmup_frames
|
||||||
self.video_type = cv2.VideoWriter_fourcc(*video_type) \
|
self.video_type = video_type
|
||||||
if isinstance(video_type, str) else video_type
|
|
||||||
|
if isinstance(video_type, str):
|
||||||
|
import cv2
|
||||||
|
self.video_type = cv2.VideoWriter_fourcc(*video_type)
|
||||||
|
|
||||||
self.sleep_between_frames = sleep_between_frames
|
self.sleep_between_frames = sleep_between_frames
|
||||||
self.max_stored_frames = max_stored_frames
|
self.max_stored_frames = max_stored_frames
|
||||||
|
|
Loading…
Reference in a new issue