@@ -61,6 +61,7 @@ def image_align(src_file,
61
61
)
62
62
return
63
63
img = PIL .Image .open (src_file )
64
+ img = img .convert ('RGB' )
64
65
65
66
# Shrink.
66
67
shrink = int (np .floor (qsize / output_size * 0.5 ))
@@ -180,8 +181,16 @@ def get_file(src, tgt):
180
181
python align_images.py /raw_images /aligned_images
181
182
"""
182
183
parser = ArgumentParser ()
183
- parser .add_argument ("-i" ,"--input_imgs_path" , type = str , default = "imgs" ,help = "input images directory path" )
184
- parser .add_argument ("-o" ,"--output_imgs_path" , type = str , default = "imgs_align" ,help = "output images directory path" )
184
+ parser .add_argument ("-i" ,
185
+ "--input_imgs_path" ,
186
+ type = str ,
187
+ default = "imgs" ,
188
+ help = "input images directory path" )
189
+ parser .add_argument ("-o" ,
190
+ "--output_imgs_path" ,
191
+ type = str ,
192
+ default = "imgs_align" ,
193
+ help = "output images directory path" )
185
194
186
195
args = parser .parse_args ()
187
196
@@ -193,10 +202,10 @@ def get_file(src, tgt):
193
202
194
203
# RAW_IMAGES_DIR = sys.argv[1]
195
204
# ALIGNED_IMAGES_DIR = sys.argv[2]
196
- RAW_IMAGES_DIR = args .input_imgs_path
205
+ RAW_IMAGES_DIR = args .input_imgs_path
197
206
ALIGNED_IMAGES_DIR = args .output_imgs_path
198
207
199
- if not osp .exists (ALIGNED_IMAGES_DIR ): os .makedirs (ALIGNED_IMAGES_DIR )
208
+ if not osp .exists (ALIGNED_IMAGES_DIR ): os .makedirs (ALIGNED_IMAGES_DIR )
200
209
201
210
files = os .listdir (RAW_IMAGES_DIR )
202
211
print (f'total img files { len (files )} ' )
0 commit comments