tags: Drone Barcode Tello Scan code
I have always want to play drones, and I have rented a big found for flying. Fortunately, TELLO has been found recently, I have bought an addiction. By the way, the integrated barcode scan function is tried. Now there are many warehousing management to use drones to scan the code inventory.

DJI's official GitHub warehouse has already put sample codedji-sdk/Tello-Python. However, this code can only support Python 2.7, and it is also no longer maintenance. To run this code on Python 3, you need to make some modifications.
First get the source code:
git clone https://github.com/dji-sdk/Tello-Python.git
Open the project in VSCode, replace the following sections through the global search:
# 2.7
import Tkinter
# 3.7
import tkinter
# 2.7
print ""
# 3.7
print()
# 2.7
packet_data = ""
# 3.7
packet_data = bytes()
In addition, the H264 decoding library needs to be recompiled into the version of Python 3. My environment is Windows, first download compilationvcpkg:
git clone https://github.com/microsoft/vcpkg
cd vcpkg
bootstrap-vcpkg.bat
Then install vcpkgffmpeg:
vcpkg.exe install ffmpeg:x64-windows
Next, compile the Python module of the H264 decoder:
git clone https://github.com/DaWelter/h264decoder.git
cd h264decoder
python setup.py build_ext --cmake-args="-DCMAKE_TOOLCHAIN_FILE=[path to vcpkg]/scripts/buildsystems/vcpkg.cmake"
You can now run TELLO sample code using Python 3:
python3 main.py
Barcode recognition will occupy the CPU. If you run in the python thread, because Python's GIL will cause video stream carton. Use the DynamSoft Python barcode to identify SDK to avoid this. Since the supplied video stream decoding interface is running on the C / C ++ thread:
Install Python Barcode SDK:
pip install dbr
intello.pyCreated in the fileBarcodeReaderObject:
from dbr import *
self.reader = BarcodeReader()
self.reader.init_license('LICENSE-KEY') # Get license: https://www.dynamsoft.com/customer/license/triallicense
Set parameters and callback functions:
parameters = self.reader.init_frame_decoding_parameters()
self.frameWidth = 640 # max: 960
self.frameHeight = 480 # max: 720
self.results = None
parameters.image_pixel_format = EnumImagePixelFormat.IPF_RGB_888
parameters.max_queue_length = 2
parameters.max_result_queue_length = 2
parameters.width = self.frameWidth
parameters.height = self.frameHeight
parameters.stride = self.frameWidth * 3
parameters.auto_filter = 1
self.reader.start_video_mode(parameters, self.on_barcode_result)
Tello's camera is known to be 720p. I am ready to narrow the resulting image to 640x480.
Save the result in the callback function for UI draw:
def on_barcode_result(self, data):
self.results = data
Find a video stream receiver function_receive_video_thread(). Reduce the frames and put them in the decoding queue:
for frame in self._h264_decode(packet_data):
self.frame = cv2.resize(frame, (self.frameWidth, self.frameHeight))
try:
ret = self.reader.append_video_frame(self.frame)
except:
pass
Finally, in the destructorstop_video_mode():
def __del__(self):
self.reader.stop_video_mode()
I did test in the office. From the display effect, it is not very ideal. In an environment in which the light is poor, the image is not focus:

In addition, there will be problems with hovering. The TELLO drone hovered in the office drift.
Why is the barcode scanner too close to the barcode to scan? I believe that many users will encounter this situation when using barcode scanners. Many new users will think that there is something wron...
Level: ★★☆☆☆ Tags: "iOS native scan" "AVCaptureSession" "AVCaptureDevice" "rectOfInterest" OF:Xs·H Review:QiShare team Recently IoT project, in the proce...
To generate barcode plug-in is a lot, but the dot matrix printer can print on the appropriate form, and can be frequently used scanning laser scanner out of the demo to not very much. , The code of th...
Attach barcode reference documentAdd link description There is a big advantage in using it: it can quickly and easily call the device's camera for barcode scanning and recognition, without the need to...
Flutter scan barcode, QR code barcode_scan Official link Android configuration 1.pubspec.yaml 2. Open the root directory\android\app\src\main\res\ AndroidManifest.xml Add on <application 3. Open th...
Several things collected by the media. What needs to be understood here is that in this process, there will be several objects: -AVCaptureDevice. This represents an abstract hardware device. -AVCaptur...
Apple itself has a scanning QR code and a barcode API, directly calling the system API. This is not introduced here, how does this API don't know ^. ^. Will use it. Guild Phases Import Avfoundation.fr...
Recent project has a function, you need to implement the scan bar code, start thinking about using html5, found that HTML5 has a getUserMedia property, you can call the phone's camera, but there is a ...
The scan identification of the barcode is required in the project, and the information on the Internet is found, most people are used.Zxing However, it is not very satisfactory to the interfaces of th...
1. Statement and precautions The code needs to deploy the server where the server is located requires HTTPS; otherwise the function will not be realized NPM package required:@ericblade/quagga2,jsqr 2....