From 3ad7a5e3c6d90197dfeb6f6f1bb366ac6d680282 Mon Sep 17 00:00:00 2001 From: Mihir Bala Date: Tue, 6 Feb 2024 12:57:54 -0500 Subject: [PATCH] Added grayscale reading in ModalAI --- onboard/python/implementation/drones/ModalAISeekerDrone.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/onboard/python/implementation/drones/ModalAISeekerDrone.py b/onboard/python/implementation/drones/ModalAISeekerDrone.py index 91a4d3be..4867a1cf 100644 --- a/onboard/python/implementation/drones/ModalAISeekerDrone.py +++ b/onboard/python/implementation/drones/ModalAISeekerDrone.py @@ -242,7 +242,11 @@ def __init__(self, drone, ip): def run(self): try: while(self.isRunning): - ret, self.currentFrame = self.cap.read() + ret, frame = self.cap.read() + if len(frame.shape) < 3: # Grayscale + self.currentFrame = cv2.cvtColor(frame, cv2.COLOR_GRAY2BGR) + else: + self.currentFrame = frame except Exception as e: print(e)