Skip to content

Commit 32d9d5d

Browse files
committed
新增拍照功能
1 parent 7b9fa42 commit 32d9d5d

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
setuptools.setup(
77
name='tello-python',
8-
version='1.0.3',
8+
version='1.0.4',
99
author='C灵C',
1010
author_email='c0c@cocpy.com',
1111
description='Control DJI Tello drone with Python 3',

tello_python/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
__author__ = 'C灵C'
33
__liscence__ = 'MIT'
44
__copyright__ = 'Copyright 2020 C灵C'
5-
__version__ = '1.0.3'
5+
__version__ = '1.0.4'
66
__all__ = ['tello', 'stats']
77

88
from .tello import Tello

tello_python/tello.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ def __init__(self, te_ip: str = '192.168.10.1', debug: bool = True):
2929

3030
# 本项目运行时选项
3131
self.stream_state = False
32+
self.camera_state = False
3233
self.MAX_TIME_OUT = 15.0
3334
self.debug = debug
3435

@@ -82,9 +83,10 @@ def _video_thread(self):
8283
break
8384

8485
# 如果按F1键,截图到当前位置
85-
if k == 0:
86+
if k == 0 or self.camera_state:
8687
png_name = datetime.datetime.now().strftime('%Y%m%d_%H%M%S') + '.png'
8788
cv2.imwrite(png_name, frame)
89+
self.camera_state = False
8890
cap.release()
8991
cv2.destroyAllWindows()
9092

@@ -101,6 +103,10 @@ def wait(self, delay: float):
101103
def get_log(self):
102104
return self.log
103105

106+
def take_picture(self):
107+
"""拍照"""
108+
self.camera_state = True
109+
104110
# 以下命令强烈建议配合官方SDK食用
105111
# https://www.ryzerobotics.com/cn/tello/downloads
106112

0 commit comments

Comments
 (0)