0

It seems if my file path or file name has unicode characters, I can't use opencv's imwrite method (no explicit error comes, but folders are empty).

I'm using Windows 7 and Python 3.6.

If I use non-unicode specific characters, the imwrite method will work fine.

The unicode-characters in question are greek letters:

C:\Users\Moondra\Desktop\TEMP\LRF Spinning Ένα διασκεδαστικό ψάρεμαδιάφορα ψάρια \image_459.jpg

Is there some argument I can use to allow imwrite with unicode characters?

Thank you.

Moondra
  • 4,399
  • 9
  • 46
  • 104
  • can you share code ? check if file path works as raw `r"filepath"` e.g . `r"C:\Users\Moondra\Desktop\TEMP\LRF Spinning Ένα διασκεδαστικό ψάρεμαδιάφορα ψάρια \image_459.jpg"` – Mahesh Karia Nov 04 '17 at 17:15
  • it is a well known problem of Opencv on Windows, look here for a solution: https://stackoverflow.com/q/24769623/4267439 – rok Nov 04 '17 at 17:31
  • @MaheshKaria Thanks. I will check if raw string works and get back to you (might take a bit as python is running a script). – Moondra Nov 04 '17 at 17:50
  • @rok I will check out those solutions. Thank you. – Moondra Nov 04 '17 at 17:50
  • The second dupe is for `imread`, but should help you for `imwrite` as well – Miki Nov 04 '17 at 19:10
  • @rok these are solutions for OpenCV C++, but it won't solve this problem which is OpenCV Python – MattS Jun 10 '19 at 15:20
  • @Miki, it is not straightforward from the proposed solutions, how to use imwrite (not imread) on python (not c++). OP Moondra, did you find a solution? – MattS Jun 10 '19 at 15:30
  • @MattS It's been a while but I don't think so. I think I remember just catching an exception and replacing the unicode characters with ascii characters – Moondra Jun 10 '19 at 16:13

0 Answers0