(f, filename)
| 1068 | |
| 1069 | def hist(output_dir): |
| 1070 | def process_image(f, filename): |
| 1071 | image = cv2.imread(f, cv2.IMREAD_GRAYSCALE) |
| 1072 | if image is not None: |
| 1073 | plt.hist(image.ravel(), bins=256, range=[0, 256]) |
| 1074 | plt.title("Histogram") |
| 1075 | plt.savefig(os.path.join(hist_dir, f"{filename}_histogram.png")) |
| 1076 | plt.close() |
| 1077 | prGreen(f"[HIST] Saved histogram for {filename}") |
| 1078 | |
| 1079 | hist_dir = os.path.join(results_folder, "hist") |
| 1080 | os.makedirs(hist_dir, exist_ok=True) |