v05 some update

This commit is contained in:
13339479676 2022-01-30 15:51:58 +08:00
parent fa374ab31c
commit 757e61a6ee
10 changed files with 20 additions and 35 deletions

View File

@ -6,5 +6,5 @@ fi
cd ./fonts
# 下载宋体
wget -c -t 0 https://github.com/Haixing-Hu/latex-chinese-fonts/raw/master/chinese/%E5%AE%8B%E4%BD%93/SimSun.ttc
# 下载新罗马
# 下载新罗马字体
wget -c -t 0 https://github.com/Haixing-Hu/latex-chinese-fonts/raw/master/english/Serif/TimesNewRoman.ttf

View File

@ -3,11 +3,11 @@
# 创建时间2022-01-25
import cv2
from pathlib import Path
import sys
import argparse
import time
from pathlib import Path
from datetime import datetime
import sys
from utils.ows_path import increment_path
from utils.hotkey import hotkey_judge
from utils.frame_opt import frame_opt

View File

@ -12,4 +12,5 @@ ROOT_PATH = sys.path[0] # 项目根目录
# 脚本参数
def argsYaml(args):
with open(f'{ROOT_PATH}/args.yaml', 'w') as f:
yaml.safe_dump(vars(args), f, sort_keys=False) # 脚本参数yaml保存
# 脚本参数yaml保存
yaml.safe_dump(vars(args), f, sort_keys=False)

View File

@ -2,12 +2,12 @@
# 创建人:曾逸夫
# 创建时间2022-01-19
import os
import sys
import time
import zipfile
import tarfile
import sys
import os
from tqdm import tqdm
import time
from pathlib import Path
from utils.time_format import time_format
from utils.ows_path import increment_path

View File

@ -28,7 +28,6 @@ def is_fonts(fonts_dir):
if (i not in f_list):
# 字体不存在
fonts_flag = 1
if (fonts_flag == 1):
# 字体不存在
print(f'字体不存在,正在加载。。。')

View File

@ -3,7 +3,6 @@
# 创建时间2022-01-14
import sys
import re
ROOT_PATH = sys.path[0] # 项目根目录

View File

@ -1,6 +1,6 @@
from pathlib import Path
import glob
import re
from pathlib import Path
# 保存路径管理

View File

@ -2,14 +2,13 @@
# 创建人:曾逸夫
# 创建时间2022-01-27
import matplotlib.pyplot as plt
from matplotlib import font_manager
from matplotlib.ticker import MaxNLocator
import sys
import csv
import time
import os
import matplotlib.pyplot as plt
from matplotlib import font_manager
from matplotlib.ticker import MaxNLocator
from utils.time_format import time_format
@ -33,7 +32,7 @@ def createLineChart(frames_y, date_list, time_list):
# -----------作图开始-----------
# 画布尺寸
plt.figure(figsize=(8, 4))
# 线型
# 设置线型
plt.plot(time_list, frames_y, color=COLOR_LIST[0], marker='o',
label='时间点', markerfacecolor=COLOR_LIST[0], markersize=5)
@ -41,12 +40,11 @@ def createLineChart(frames_y, date_list, time_list):
plt.gca().yaxis.set_major_locator(MaxNLocator(integer=True)) # 纵坐标设置为整数
plt.grid(axis="y", ls='--') # 横向网格线
# 设置上边和右边无边框
ax = plt.gca()
ax.spines['right'].set_color('none')
ax.spines['top'].set_color('none')
ax.spines['right'].set_color('none') # 消除有边框
ax.spines['top'].set_color('none') # 消除上边框
# 标签
# 显示点值
for a, b in zip(time_list, frames_y):
plt.text(a, b, b, ha='center', va='bottom', fontsize=10.5)
@ -83,7 +81,7 @@ def csv2chart(csv_path):
t_list = [] # 时间列表
frames_list = [] # 时间列表
tmp_date = f_list[0][0].split(' ')[0]
tmp_date = f_list[0][0].split(' ')[0] # 临时日期
for i in range(len(f_list)):
date_item = f_list[i][0].split(' ')[0] # 日期
time_item = f_list[i][0].split(' ')[1] # 时间
@ -91,7 +89,7 @@ def csv2chart(csv_path):
if (tmp_date != date_item):
createLineChart(frames_list, d_list, t_list) # 创建日期-帧数图
tmp_date = date_item # 替换
# 清空列表
# -----------清空列表-----------
d_list = []
t_list = []
frames_list = []
@ -101,4 +99,4 @@ def csv2chart(csv_path):
frames_list.append(int(f_list[i][1])) # 帧数
if (i == len(f_list)-1):
# 最后一组
createLineChart(frames_list, d_list, t_list)
createLineChart(frames_list, d_list, t_list) # 创建日期-帧数图

View File

@ -22,31 +22,18 @@ def time_format(preTime):
if (0 < s < 1):
time_str = f'{s:.3f}'
# print(time_str)
return time_str
elif (h == 0 and m == 0 and s >= 1):
time_str = f'{s:.3f}'
# print(time_str)
return time_str
elif (h == 0 and m > 0):
time_str = f'{m}{s:.3f}'
# print(time_str)
return time_str
elif (h > 0):
if (h >= 24):
h = int(h / 24)
time_str = f'{h}{m}{s:.3f}'
# print(time_str)
return time_str
else:
print(f'时间格式化失败!程序结束!')
sys.exit()
# if __name__ == '__main__':
# time_format(0.52362)
# time_format(50.52362)
# time_format(90.52362)
# time_format(5000.52362)
# time_format(3600*24 + 1000.52362)

1
v05.md
View File

@ -28,6 +28,7 @@
- 优化README外观
- 修复摄像头连接异常情况下的程序问题
- 优化部分markdown文件外观
- 优化Jupyter版界面
<h4 align="center">日期-帧数图</h4>