Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

sad as it is maybe, you can only apply ascii strings to imread().

as a workaround, you can load the file using native python methods (which can read unicode paths) and pass it to imdecode:

f = open(some_kyrillic_name, "rb");
bytes = f.read()
image = cv2.imdecode(bytes, cv2.IMREAD_COLOR)

sad as it is maybe, you can only apply ascii strings to imread().

as a workaround, you can load the file using native python methods (which can read unicode paths) and pass it to imdecode:

f = open(some_kyrillic_name, "rb");
bytes = f.read()
image = cv2.imdecode(bytes, cv2.imdecode(np.asarray(bytes, np.uint8), cv2.IMREAD_COLOR)