基于python3的数据可视化脚本参考

这篇博客分享了一个Python3脚本,用于动态可视化txt文件中的数据,并能生成mp4回放。脚本可能需要根据具体数据格式进行调整,作者提供了测试数据的txt文件供下载,有兴趣的读者可以在终端运行`visualization.py`进行测试。
摘要由CSDN通过智能技术生成

I'll record my first python3 visualization script here.

This script is able to visualize the formatted datas in txt file dynamically and record the process by generating a mp4 file for recalling. It may not adaptable for your own data format while only for reference. Or you can modify the code construction to adapt your data format.

If there is any problem please message me.


我将在这里录制我的第一个python3可视化脚本。

该脚本能够动态地可视化txt文件中的格式化数据,并通过生成用于调用的mp4文件来记录过程。它可能不适合您自己的数据格式,而仅用于参考。也可以修改代码结构以适应数据格式。

如果有任何问题,请给我留言。


:如果有兴趣可以在这里下载测试用的txt数据:下载地址

(该脚本提供三个对外参数:
               必要参数:<测试数据>.txt
               非必要参数:<预测数据>.txt

                                     <对应帧图片folder>


由于一些项目内数据不便展示,因此这里只给出测试数据的txt,敬请谅解!


在终端下运行测试:

$  python3 visualization.py -l test1.txt

visualization.py

# _*_ coding: utf-8 _*_
# @Author : Mingquan
# @File: line_visualization.py
# @Information: *Using this file to visualize the lanes line fitting
#               *INPUT: <lane_data.txt>/<pred_data.txt>/<image_source/>
#               *OUTPUT: <lane_fitting.mp4>

from os import write
import sys
import importlib
importlib.reload(sys)

# import time
import math
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import json
import argparse
import matplotlib.image as mpimg
from matplotlib.animation import FFMpegWriter
matplotlib.use('TkAgg')


class VisualizationTool:
    lane_data = None
    pred_data = None
    img_folder = None
    lane_type = None
    pred_type = None
    data_l
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值