First Version (#1)

Co-authored-by: Anujith Muraleedharan <140189296+AnujithM@users.noreply.github.com>
This commit is contained in:
Andrew Johnson
2025-03-22 16:06:45 +01:00
committed by GitHub
parent 81a42fde3c
commit 26b19a909f
51 changed files with 2348 additions and 1030 deletions

View File

@@ -0,0 +1,32 @@
from tello_sim.tello_sim_client import TelloSimClient
import cv2
# Create a Tello instance
tello = TelloSimClient()
# Desired window size
WINDOW_WIDTH = 640
WINDOW_HEIGHT = 360
# Connect to Tello
tello.connect()
tello.streamon()
# Create a normal, resizable window
cv2.namedWindow("frame", cv2.WINDOW_NORMAL)
cv2.resizeWindow("frame", WINDOW_WIDTH, WINDOW_HEIGHT)
try:
while True:
img = tello.get_frame_read().frame
if img is not None:
img_bgr = cv2.cvtColor(img, cv2.COLOR_RGB2BGR)
# Resize the image to fit the window size
img_resized = cv2.resize(img_bgr, (WINDOW_WIDTH, WINDOW_HEIGHT), interpolation=cv2.INTER_AREA)
cv2.imshow("frame", img_resized)
if cv2.waitKey(1) == ord('q'):
break
except KeyboardInterrupt:
pass
finally:
print("fin")
cv2.destroyAllWindows()