v03 update 02

This commit is contained in:
13339479676 2022-01-16 07:07:34 +08:00
parent 69cb42b27b
commit f05e7def7f
3 changed files with 7 additions and 4 deletions

View File

@ -106,7 +106,7 @@ def webcam_opencv(device_index=0, quit_key="q", pause_key="p", is_autoSaveFrame=
wait_key = cv2.waitKey(20) & 0xFF # 键盘监听
ret, frame = cap.read() # 捕获画面
frame_num += 1 # 帧计数
print(f'帧ID{frame_num}') # 输出信息
print(f'帧ID{frame_num}') # 输出帧ID信息
cv2.imshow(ows_version, frame) # 显示画面
if (is_autoSaveFrame): # 自动保存
@ -140,7 +140,8 @@ def webcam_opencv(device_index=0, quit_key="q", pause_key="p", is_autoSaveFrame=
# ------------------程序结束------------------
print(f'程序结束!')
e_time = time.time() # 终止时间
outTimeMsg = f'用时:{round((e_time - s_time), 3)}秒, {round((e_time - s_time)/60, 3)}分, {round((e_time - s_time)/3600, 3)}小时'
total_time = e_time - s_time # 程序用时
outTimeMsg = f'用时:{round(total_time, 3)}秒, {round(total_time/60, 3)}分, {round(total_time/3600, 3)}小时'
print(outTimeMsg)
log_management(f'{outTimeMsg}\n', logName, logMode) # 记录用时

View File

@ -4,6 +4,8 @@
import sys
ROOT_PATH = sys.path[0] # 项目根目录
# 检查日志格式
def is_logSuffix(logName):
@ -16,6 +18,5 @@ def is_logSuffix(logName):
# 日志管理
def log_management(logContent, logName, logSaveMode):
ROOT_PATH = sys.path[0] # 项目根目录
logFile = open(f'{ROOT_PATH}/{logName}', logSaveMode) # 日志文件
logFile.write(logContent) # 日志写入

3
v03.md
View File

@ -14,4 +14,5 @@
### BUG修复
- 优化部分代码结构
- 优化部分代码结构
- 完善部分注释