Skip to content

Commit

Permalink
[WIP] Setup ImageAnalysisDelegate
Browse files Browse the repository at this point in the history
  • Loading branch information
PossiblyAShrub committed Jan 18, 2024
1 parent b8f5e04 commit 22187a9
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/modules/imaging/analysis.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
from typing import Optional

from deps.labeller.benchmarks.detector import LandingPadDetector, BoundingBox
from .camera import CameraProvider


class ImageAnalysisDelegate:
"""
Responsible for capturing pictures regularly, detecting any landing pads in
those pictures and then providing the most recent estimate of the landing
pad location from the camera's perspective.
TODO: geolocate the landing pad using the drone's location.
"""

def __init__(self, camera_provider: CameraProvider, detector: LandingPadDetector):
self.camera_provider = camera_provider
self.detector = detector

def locate_landing_pad(self) -> Optional[BoundingBox]:
"""
Capture an image and then locate a landing pad, if any, from that
image. Returns None if no landing pad was found.
"""
image = self.camera_provider.capture()
return self.detector.predict(image)

0 comments on commit 22187a9

Please sign in to comment.