From 6477410f06e34f8510702adc988d6ed5cf53dcce Mon Sep 17 00:00:00 2001 From: deeppomf Date: Mon, 26 Feb 2018 21:07:01 -0500 Subject: [PATCH] remove alpha channel --- training_data/to_npy.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/training_data/to_npy.py b/training_data/to_npy.py index ca4f892..b848b77 100644 --- a/training_data/to_npy.py +++ b/training_data/to_npy.py @@ -16,6 +16,9 @@ for path in paths: #img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) #x.append(img) temp = Image.open(path) + #remove alpha channel + if temp.mode=='RGBA': + temp = im.convert('RGB') keep = temp.copy() keep = np.array(keep) x.append(keep)