run-youngjoo / SC-FEGAN

SC-FEGAN : Face Editing Generative Adversarial Network with User's Sketch and Color (ICCV2019)
Other
3.35k stars 530 forks source link

Cyrillic symbols in filName #13

Open Shooshpanchik opened 5 years ago

Shooshpanchik commented 5 years ago

This code don't crush program if fileName contains Cyrillic symbols

stream = open(fileName, "rb") bytes = bytearray(stream.read()) numpyarray = np.asarray(bytes, dtype=np.uint8) stream.close() image = QPixmap(fileName)

mat_img = cv2.imread(fileName)

mat_img = cv2.imdecode(numpyarray, cv2.IMREAD_UNCHANGED) if image.isNull(): QMessageBox.information(self, "Image Viewer", "Cannot load %s." % fileName) return

run-youngjoo commented 5 years ago

Hello, Shooshpanchik.

I tested your suggestion on 'demo.py' of function 'open' and it works! But i don't understand the difference between 'cv2.imread' and 'cv2.imdecode'.

Could you explain it? why it prevent the crush? And I think your comment seems to be more appropriate for 'Pull requests'.

Shooshpanchik commented 5 years ago

https://stackoverflow.com/questions/43185605/how-do-i-read-an-image-from-a-path-with-unicode-characters git

run-youngjoo commented 5 years ago

Thanks! I learn one thing. I will update the 'open' function.