def video_stream(): tello.streamon() while True: img = tello.get_frame_read().frame # get the #img = cv2.resize(img, (360,240)) cv2.imshow("Live Stream", img) cv2.waitKey(1)
def video_stream(): while True: # img = VIDEO_client_socket.recvfrom(BUFFERSIZE) img = tello.get_frame_read().frame # get the #img = cv2.resize(img, (360,240)) cv2.imshow("Live Stream", img) cv2.waitKey(1)
def face_recognition(): while True: img = tello.get_frame_read().frame img = cv2.resize(img, (360, 240)) cv2.waitKey(1) frame = img rgb_frame = frame[:, :, ::-1] face_locations = fr.face_locations(rgb_frame) face_encodings = fr.face_encodings(rgb_frame, face_locations) for (top, right, bottom, left), face_encoding in zip(face_locations, face_encodings): matches = fr.compare_faces(known_face_encondings, face_encoding) name = 'Unknown' face_distances = fr.face_distance(known_face_encondings, face_encoding) best_match_index = np.argmin(face_distances) if matches[best_match_index]: name = known_face_names[best_match_index] speak(f'Hello {name}') # cv2.rectangle(frame=frame, left=left, top=top, right=right, bottom=bottom, name=name) # cv2.imwrite(f'people/') if name == 'George': # cv2.imwrite(f'people/george/george.jpg', frame) print('Hello George') speak('Would you like to fly the drone?') if name == 'Voula': speak('Can you please make the cookie dough?') if name == 'Dimitri': speak('Hi') if name == 'Dylan': speak("You're a clown") if name == 'Kai': speak('Chess game?') if name == 'Salvati': speak('Hello!') try: frame = cv2.resize(frame, (360, 240)) except: pass try: cv2.putText(frame, f'Hello {name}', (50, 50), cv2.FONT_HERSHEY_SIMPLEX, 1, (255, 0, 0), 2) except: pass cv2.imshow('Which person am I?', frame)
def udp_video(data, addr): tello.streamon() data_stream = True while data_stream: img = tello.get_frame_read().frame # get the #img = cv2.resize(img, (360,240)) cv2.imshow("Live Stream", img) cv2.waitKey(1)
yv = -speed elif keyboard.is_pressed('right'): yv = speed # Landing if keyboard.is_pressed('l'): tello.land() # Takeoff if keyboard.is_pressed('q'): tello.takeoff() # Flip Forward if keyboard.is_pressed('f'): tello.flip_forward() return [lr, fb, ud, yv] tello.streamoff() tello.streamon() while True: vals = get_keyboard_input() tello.send_rc_control(vals[0], vals[1], vals[2], vals[3]) time.sleep(0.05) img = tello.get_frame_read().frame img = cv2.resize(img, (360, 240)) cv2.imshow('Image', img) cv2.waitKey(1)