作为我之前问题的后续内容,我能够解决
import cv2
import libardrone.libardrone
我重新安装了opencv,我意识到文档不正确;应该是
import libardrone.ardrone
解决这两个问题让我能够尝试这里给出的track.py:https://github.com/JJLewis/ColorTracking-ARDrone2.0-Python。
即使我正确安装了ffmpeg,运行track.py也会出现以下错误。
WARNING:root:Connection to ardrone
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/track.py", line 180, in <module>
main()
File "/Library/Python/2.7/site-packages/track.py", line 19, in main
drone = libardrone.ARDrone(True, False)
File "/Library/Python/2.7/site-packages/libardrone/ardrone.py", line 108, in __init__
self.network_process = arnetwork.ARDroneNetworkProcess(com_pipe_other, is_ar_drone_2, self)
File "/Library/Python/2.7/site-packages/libardrone/arnetwork.py", line 51, in __init__
self.ar2video = ar2video.ARVideo2(self._drone, drone.debug)
File "/Library/Python/2.7/site-packages/libardrone/ar2video.py", line 37, in __init__
h264 = h264decoder.H264Decoder(self, drone.image_shape)
File "/Library/Python/2.7/site-packages/libardrone/h264decoder.py", line 82, in __init__
raise Exception("You need to install ffmpeg to be able to run ardrone")
Exception: You need to install ffmpeg to be able to run ardrone
>>> Exception in thread Thread-35:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 801, in __bootstrap_inner
self.run()
File "/Library/Python/2.7/site-packages/libardrone/arnetwork.py", line 86, in run
video_socket, nav_socket, control_socket = _connect()
File "/Library/Python/2.7/site-packages/libardrone/arnetwork.py", line 75, in _connect
control_socket.connect(('192.168.1.1', ARDRONE_CONTROL_PORT))
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 228, in meth
return getattr(self._sock,name)(*args)
error: [Errno 60] Operation timed out
作为初学者,我在解决这些问题时遇到了困难。我的规范如下:Mac 10.12,Python 2.7.14和OpenCV 3.3.0_3。