Tello-Python icon indicating copy to clipboard operation
Tello-Python copied to clipboard

采用deltelopy这个库连接tello上传在电脑上的视频呈现蓝色,应该如何解决

Open 1411734304 opened this issue 1 year ago • 2 comments

视频传输的问题如何解决,并且我已经安装了ffmpeg了,另外有人知道如何将yolo与tello结合么

1411734304 avatar Apr 07 '24 02:04 1411734304

Hi

If you're having trouble getting video, try this: https://github.com/dji-sdk/Tello-Python/issues/98

if you want to use YOLOv8, here is a sample: (It's a bit simplified and not practical.)

from ultralytics import YOLO
import cv2
cap=cv2.VideoCapture(0) # use webcam 
model=YOLO("yolov8n.pt") # you can also use yolov8s.pt, yolov8s-seg.pt, yolov8s-pose.pt, etc...
while True:
    frame=cap.read()[1]
    results=model(frame)
    for i in range(len(results[0].boxes.xyxy)):
        xyxy=results[0].boxes.xyxy[i].tolist()
        cv2.rectangle(frame,(  int(xyxy[0]),int(xyxy[1])  ),(  int(xyxy[2]),int(xyxy[3])  ),(0,0,255),2)
    cv2.imshow("window",frame)
    cv2.waitKey(1)

nobu835 avatar Oct 07 '24 23:10 nobu835

For problems that turn blue, try this:

frame = drone.read()
frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)

nobu835 avatar Oct 08 '24 01:10 nobu835