Commit 36a9975b authored by Gilberto Astolfi's avatar Gilberto Astolfi
Browse files

Manutenção na leitura de imagens

parent 88544226
......@@ -17,6 +17,14 @@ class DataAugmentation:
root = et.parse(xml_file).getroot()
image_path = root.find("path").text
image = cv2.imread(image_path, cv2.IMREAD_COLOR)
try:
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
except:
name, extension = os.path.splitext(image_path)
if extension == '.jpg': extension = '.JPG'
else: extension = '.jpg'
image_path = name + extension
image = cv2.imread(image_path, cv2.IMREAD_COLOR)
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
return image
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment