MCPcopy Create free account
hub / github.com/Mercury7353/PyBench / test_task_96

Function test_task_96

data/unit_test/tests.py:1076–1097  ·  view source on GitHub ↗
(trajectory)

Source from the content-addressed store, hash-verified

1074 assert contrast_image > contrast_ref_image, "The contrast of the image is not lower than the reference image."
1075
1076def test_task_96(trajectory):
1077 image_path = "./output/96.png"
1078 ref_path = "./data/96.jpeg"
1079
1080 # 打开目标图像和参考图像
1081 image = Image.open(image_path)
1082 ref_image = Image.open(ref_path)
1083
1084 # 将图像转换为HSV颜色空间
1085 hsv_image = image.convert('HSV')
1086 hsv_ref_image = ref_image.convert('HSV')
1087
1088 # 将HSV图像转换为numpy数组
1089 hsv_array = np.array(hsv_image)
1090 hsv_ref_array = np.array(hsv_ref_image)
1091
1092 # 计算每个图像的平均饱和度(S通道的平均值)
1093 avg_saturation_image = np.mean(hsv_array[:, :, 1])
1094 avg_saturation_ref_image = np.mean(hsv_ref_array[:, :, 1])
1095
1096 # 检查目标图像的饱和度是否低于参考图像的饱和度
1097 assert avg_saturation_image < avg_saturation_ref_image, "The saturation of the image is not lower than the reference image."
1098
1099def test_task_97(trajectory):
1100 image_path = "./output/97.png"

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected