Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录
切换导航
U
ubains-module-test
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
郑晓兵
ubains-module-test
Commits
339c4532
提交
339c4532
authored
12月 31, 2024
作者:
陈泽健
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
处理优化调用。
上级
0e55beae
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
49 行增加
和
41 行删除
+49
-41
app_base.py
预定系统/Base/app_base.py
+24
-37
captured_frame2.jpg
预定系统/Base/captured_frame2.jpg
+0
-0
README.md
预定系统/README.md
+2
-2
__st__.py
预定系统/cases/展厅巡检/00展厅中控屏/__st__.py
+5
-2
展厅中控屏.py
预定系统/cases/展厅巡检/00展厅中控屏/展厅中控屏.py
+18
-0
没有找到文件。
预定系统/Base/app_base.py
浏览文件 @
339c4532
...
...
@@ -51,7 +51,7 @@ import logging
logging
.
basicConfig
(
level
=
logging
.
INFO
,
format
=
'
%(asctime)
s -
%(levelname)
s -
%(message)
s'
)
def
compare_brightness
(
light_down_path
,
light_on_path
,
threshold
=
50
):
def
compare_brightness
(
light_down_path
,
light_on_path
,
threshold
=
1
):
"""
对比两张图片的亮度,返回亮度是否增加的布尔值。
light_on_path:传入暗色的图片
...
...
@@ -84,8 +84,8 @@ def compare_brightness(light_down_path, light_on_path, threshold=50):
# if __name__ == '__main__':
# logging.info("开始对比亮度")
#
# image1_path = r'D:\GithubData\自动化\ubains-module-test\预定系统\Base\
暗图
.jpg'
# image2_path = r'D:\GithubData\自动化\ubains-module-test\预定系统\Base\
亮图
.jpg'
# image1_path = r'D:\GithubData\自动化\ubains-module-test\预定系统\Base\
captured_frame2
.jpg'
# image2_path = r'D:\GithubData\自动化\ubains-module-test\预定系统\Base\
captured_frame
.jpg'
#
# # 检查图片路径是否存在
# if not os.path.exists(image1_path):
...
...
@@ -142,25 +142,25 @@ def compare_images_feature_matching(image1_path, image2_path):
return
False
if
__name__
==
'__main__'
:
logging
.
basicConfig
(
level
=
logging
.
INFO
,
format
=
'
%(asctime)
s -
%(levelname)
s -
%(message)
s'
)
logging
.
info
(
"开始对比图片"
)
image1_path
=
r'D:\GithubData\自动化\ubains-module-test\预定系统\Base\暗图
.jpg'
image2_path
=
r'D:\GithubData\自动化\ubains-module-test\预定系统\Base\亮图
.jpg'
if
not
os
.
path
.
exists
(
image1_path
):
logging
.
error
(
f
"图片 {image1_path} 不存在"
)
exit
(
1
)
if
not
os
.
path
.
exists
(
image2_path
):
logging
.
error
(
f
"图片 {image2_path} 不存在"
)
exit
(
1
)
# 对比两张截图的相似度
if
compare_images_feature_matching
(
image1_path
,
image2_path
):
logging
.
info
(
"图片相同"
)
else
:
logging
.
error
(
"图片不同"
)
#
if __name__ == '__main__':
#
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
#
logging.info("开始对比图片")
#
# image1_path = r'D:\GithubData\自动化\ubains-module-test\预定系统\Base\captured_frame2
.jpg'
# image2_path = r'D:\GithubData\自动化\ubains-module-test\预定系统\Base\captured_frame
.jpg'
#
#
if not os.path.exists(image1_path):
#
logging.error(f"图片 {image1_path} 不存在")
#
exit(1)
#
if not os.path.exists(image2_path):
#
logging.error(f"图片 {image2_path} 不存在")
#
exit(1)
#
#
# 对比两张截图的相似度
#
if compare_images_feature_matching(image1_path, image2_path):
#
logging.info("图片相同")
#
else:
#
logging.error("图片不同")
def
capture_frame_from_rtsp
(
rtsp_url
,
output_path
):
"""
...
...
@@ -191,17 +191,4 @@ def capture_frame_from_rtsp(rtsp_url, output_path):
return
True
except
Exception
as
e
:
logging
.
error
(
f
"捕获帧时发生错误: {e}"
,
exc_info
=
True
)
return
False
if
__name__
==
'__main__'
:
logging
.
basicConfig
(
level
=
logging
.
INFO
,
format
=
'
%(asctime)
s -
%(levelname)
s -
%(message)
s'
)
logging
.
info
(
"开始捕获RTSP流中的帧"
)
rtsp_url
=
"rtsp://admin:huawei@123@192.168.4.15/LiveMedia/ch1/Media2"
# 替换为你的RTSP流地址
output_path
=
"captured_frame.jpg"
# 保存帧的路径
if
capture_frame_from_rtsp
(
rtsp_url
,
output_path
):
logging
.
info
(
"帧捕获成功"
)
else
:
logging
.
error
(
"帧捕获失败"
)
\ No newline at end of file
return
False
\ No newline at end of file
预定系统/Base/captured_frame2.jpg
0 → 100644
浏览文件 @
339c4532
76.6 KB
预定系统/README.md
浏览文件 @
339c4532
...
...
@@ -145,4 +145,4 @@
30.
2024-12-30
-
封装亮度判断的compare_brightness函数处理,后续通过亮度判断灯光是否正确打开。
31.
2024-12-31
-
补充对于rtsp流抓取一帧保存为图片,然后再进行对应的亮度判断。
\ No newline at end of file
-
补充对于rtsp流抓取一帧保存为图片,然后再进行对应的亮度判断。处理优化调用。
\ No newline at end of file
预定系统/cases/展厅巡检/00展厅中控屏/__st__.py
浏览文件 @
339c4532
...
...
@@ -25,8 +25,12 @@ def suite_setup():
wd
=
GSTORE
[
'wd'
]
admin_login
(
"Test02"
,
"ubains@123"
)
sleep
(
5
)
INFO
(
"请检查灯光开启的状态是否正常"
)
# 这是灯光开启前的截图
SELENIUM_LOG_SCREEN
(
wd
,
"50
%
"
,
"Exhibit_Inspect"
,
"Control_Manage"
,
"light_down"
)
# 这是灯光开启后的截图
SELENIUM_LOG_SCREEN
(
wd
,
"50
%
"
,
"Exhibit_Inspect"
,
"Control_Manage"
,
"light_on"
)
SELENIUM_LOG_SCREEN
(
wd
,
"50
%
"
,
"Exhibit_Inspect"
,
"Tx_meeting"
,
"会场画面截屏"
)
def
suite_teardown
():
browser_quit
()
\ No newline at end of file
预定系统/cases/展厅巡检/00展厅中控屏/展厅中控屏.py
浏览文件 @
339c4532
...
...
@@ -36,6 +36,15 @@ class Exhibition_hall_Control_000x:
air_button
.
click
()
sleep
(
20
)
# 先截取当前空间的灯光状态图片
rtsp_url
=
"rtsp://admin:huawei@123@192.168.4.15/LiveMedia/ch1/Media2"
# 替换为你的RTSP流地址
output_path
=
r"D:\GithubData\自动化\ubains-module-test\预定系统\reports\imgs\Control_Manage\light_down.png"
# 保存帧的路径
logging
.
info
(
"开始捕获RTSP流中的帧"
)
if
capture_frame_from_rtsp
(
rtsp_url
,
output_path
):
logging
.
info
(
"帧捕获成功"
)
else
:
logging
.
error
(
"帧捕获失败"
)
# 定位灯光控制按钮元素,并点击按钮
logging
.
info
(
"尝试定位【灯光控制】按钮元素,并点击按钮"
)
light_button
=
app_drive
.
find_element
(
AppiumBy
.
XPATH
,
...
...
@@ -95,6 +104,15 @@ class Exhibition_hall_Control_000x:
light_training_room_button
.
click
()
sleep
(
2
)
# 先截取当前空间的灯光状态图片
rtsp_url
=
"rtsp://admin:huawei@123@192.168.4.15/LiveMedia/ch1/Media2"
# 替换为你的RTSP流地址
output_path
=
r"D:\GithubData\自动化\ubains-module-test\预定系统\reports\imgs\Control_Manage\light_on.png"
# 保存帧的路径
logging
.
info
(
"开始捕获RTSP流中的帧"
)
if
capture_frame_from_rtsp
(
rtsp_url
,
output_path
):
logging
.
info
(
"帧捕获成功"
)
else
:
logging
.
error
(
"帧捕获失败"
)
# 切换至窗帘控制界面
logging
.
info
(
"尝试定位【窗帘控制】按钮元素,并点击按钮"
)
curtain_button
=
app_drive
.
find_element
(
AppiumBy
.
XPATH
,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论