If you have better ideas, welcome to propose them!! Please kindly star ⭐ this project if it helps you
This project now keeps both implementations:
legacy: the original motion-overlay method based on frame differencing against the first frameimproved: an optional hybrid mode that keeps the original overlay effect and adds a smoothed tracked trajectory line on top
The original implementation still exists and is not replaced. The improved result is only a selectable mode.
- GUI now supports explicit mode switching between
legacyandimproved - improved mode exposes selectable line colors, line thickness, and glow strength
- GUI shows status and failure messages directly inside the window instead of relying on terminal output
- built-in recommended parameter presets are available for both modes
Still shot videos:
Although sometimes it can be wrong, this tool works well in certain circumstances. If you are looking for higher quality images, you may need to do it manually!
-
Added a UI interface for more intuitive display
-
Optimized the generation logic

PS: the video is come from composite_image
-
Added an optional improved visualization mode:
- preserve the original
legacyoutput - track the drone trajectory with a lightweight rule-based tracker
- smooth the trajectory and draw a clean highlight line on top of the original overlay
- support CLI export for
legacy,improved, and comparison outputs
- preserve the original
Improved hybrid output:
Legacy vs improved comparison:
作用:每隔多少帧进行一次处理(间隔越大,计算越快,但可能导致轨迹不连续)。 默认值:10(每10帧进行一次分析)。
作用:用于二值化处理,设置像素差值的阈值(数值越低,检测的运动更灵敏)。 默认值:30(像素差大于30的部分视为运动)。
作用:对检测到的运动区域进行膨胀,以去除噪声(数值越大,运动区域轮廓越平滑)。 默认值:15(15×15的核进行膨胀)。
作用:决定运动区域最初的透明度(0.0 完全透明,1.0 不透明)。 默认值:0.2(运动区域初始时 20% 透明)。
作用:控制运动区域的最终透明度(在处理过程中逐渐增加)。 默认值:1.0(最终完全不透明)。
This project is also very good
Please manually select the appropriate parameters according to your own video
If the speed of the drone changes in the video, the trajectory may not be good.
If the background moves, such as lighting changes or pedestrian movement, the superposition may be incorrect.
Export the original implementation (legacy):
python3 visualize_uav_trajectory.py \
--video example_video.mp4 \
--method legacy \
--output images/example_legacy.pngExport the optional improved result:
python3 visualize_uav_trajectory.py \
--video example_video.mp4 \
--method improved \
--output images/example_improved.pngExport a side-by-side comparison image:
python3 visualize_uav_trajectory.py \
--video example_video.mp4 \
--compare \
--output images/example_comparison.pngIf you omit --video, the script starts the Tkinter GUI. The original implementation remains available in code as the legacy mode, and the improved mode is an extra option for CLI export and further extension.
Note: the images/ directory is ignored by git. For repository examples shown in this README, the exported result images are copied into example/ before commit.
The code is split to make future maintenance easier:
visualize_uav_trajectory.py: thin entry pointuav_vis/config.py: shared constants and style definitionsuav_vis/core.py: legacy rendering, improved tracking, and image generation logicuav_vis/gui.py: Tkinter GUI and in-window status handlinguav_vis/cli.py: CLI parser and command execution flow





