Source code for payloadcomputerdroneprojekt.camera.abstract_class
from abc import ABC, abstractmethod
[docs]
class AbstractCamera(ABC):
"""
Abstract base class for camera implementations.
This class defines the interface for camera operations such as starting,
capturing frames, and stopping the camera.
"""
def __init__(self, config):
super().__init__()
self._config = config
self._camera = None
self.is_active = False
[docs]
@abstractmethod
def start_camera(self, config=None):
"""
Start the camera with the given configuration.
:param config: Optional configuration for the camera.
"""
pass
[docs]
@abstractmethod
def get_current_frame(self):
"""
Capture the current frame from the camera.
:return: The captured frame.
"""
pass
[docs]
@abstractmethod
def stop_camera(self):
"""
Stop the camera.
"""
pass