Fix up structure and README

This commit is contained in:
Andrew Johnson
2025-04-03 20:31:10 +02:00
parent 1480a75a61
commit 3b5ab2f7cd
19 changed files with 7 additions and 1 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()