(trajectory)
| 1028 | |
| 1029 | |
| 1030 | def 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 | |
| 1053 | def test_task_95(trajectory): |
| 1054 | image_path = "./output/95.png" |
nothing calls this directly
no outgoing calls
no test coverage detected