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

Function test_task_94

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

Source from the content-addressed store, hash-verified

1028
1029
1030def test_task_94(trajectory):
1031 image_path = "./output/94.png"
1032 ref_path = "./data/94.jpeg"
1033
1034 # 打开目标图像和参考图像
1035 image = Image.open(image_path)
1036 ref_image = Image.open(ref_path)
1037
1038 # 将图像转换为灰度图
1039 gray_image = image.convert('L')
1040 gray_ref_image = ref_image.convert('L')
1041
1042 # 将灰度图转换为numpy数组
1043 gray_array = np.array(gray_image)
1044 gray_ref_array = np.array(gray_ref_image)
1045
1046 # 计算每个图像的对比度(标准差)
1047 contrast_image = np.std(gray_array)
1048 contrast_ref_image = np.std(gray_ref_array)
1049
1050 # 检查目标图像的对比度是否低于参考图像的对比度
1051 assert contrast_image < contrast_ref_image, "The contrast of the image is not lower than the reference image."
1052
1053def test_task_95(trajectory):
1054 image_path = "./output/95.png"

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected