Delete python_script.py
Browse files- python_script.py +0 -17
python_script.py
DELETED
@@ -1,17 +0,0 @@
|
|
1 |
-
import cv2
|
2 |
-
import numpy as np
|
3 |
-
import os
|
4 |
-
|
5 |
-
image_folder = "masked_loss_training_data/images"
|
6 |
-
mask_folder = "masked_loss_training_data/conditioning"
|
7 |
-
|
8 |
-
image_files = os.listdir(image_folder)
|
9 |
-
jpg_files = [f for f in image_files if f.endswith('.jpg')]
|
10 |
-
|
11 |
-
for file_name in jpg_files:
|
12 |
-
img = cv2.imread(os.path.join(image_folder, file_name), cv2.IMREAD_GRAYSCALE)
|
13 |
-
_, bw_mask = cv2.threshold(img, 127, 255, cv2.THRESH_BINARY)
|
14 |
-
output_file_path = os.path.join(mask_folder, os.path.splitext(file_name)[0] + '.png')
|
15 |
-
cv2.imwrite(output_file_path, bw_mask)
|
16 |
-
|
17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|