(trajectory)
| 1097 | assert avg_saturation_image < avg_saturation_ref_image, "The saturation of the image is not lower than the reference image." |
| 1098 | |
| 1099 | def test_task_97(trajectory): |
| 1100 | image_path = "./output/97.png" |
| 1101 | ref_path = "./data/97.jpeg" |
| 1102 | |
| 1103 | # 打开目标图像和参考图像 |
| 1104 | image = Image.open(image_path) |
| 1105 | ref_image = Image.open(ref_path) |
| 1106 | |
| 1107 | # 将图像转换为HSV颜色空间 |
| 1108 | hsv_image = image.convert('HSV') |
| 1109 | hsv_ref_image = ref_image.convert('HSV') |
| 1110 | |
| 1111 | # 将HSV图像转换为numpy数组 |
| 1112 | hsv_array = np.array(hsv_image) |
| 1113 | hsv_ref_array = np.array(hsv_ref_image) |
| 1114 | |
| 1115 | # 计算每个图像的平均饱和度(S通道的平均值) |
| 1116 | avg_saturation_image = np.mean(hsv_array[:, :, 1]) |
| 1117 | avg_saturation_ref_image = np.mean(hsv_ref_array[:, :, 1]) |
| 1118 | |
| 1119 | # 检查目标图像的饱和度是否低于参考图像的饱和度 |
| 1120 | assert avg_saturation_image > avg_saturation_ref_image, "The saturation of the image is not lower than the reference image." |
| 1121 | |
| 1122 | def test_task_98(trajectory): |
| 1123 | image_path = "./output/98.png" |
nothing calls this directly
no outgoing calls
no test coverage detected