Skip to content

Commit

Permalink
handle unicode image paths for Python 2.7
Browse files Browse the repository at this point in the history
  • Loading branch information
duhaime committed Jun 17, 2018
1 parent d101eca commit e3b7c28
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion image_match/goldberg.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from cairosvg import svg2png
except ImportError:
pass
from six import string_types, text_type
from io import BytesIO
import numpy as np
import xml.etree
Expand Down Expand Up @@ -233,7 +234,8 @@ def preprocess_image(image_or_path, bytestream=False, handle_mpo=False):
raise CorruptImageError()
img = img.convert('RGB')
return rgb2gray(np.asarray(img, dtype=np.uint8))
elif type(image_or_path) is str:
elif type(image_or_path) in string_types or \
type(image_or_path) is text_type:
return imread(image_or_path, as_grey=True)
elif type(image_or_path) is bytes:
try:
Expand Down

0 comments on commit e3b7c28

Please sign in to comment.