[Python] How do I read an image from a path with Unicode characters?

Discussão em 'Python' iniciado por Stack, Dezembro 9, 2024.

  1. Stack

    Stack Membro Participativo

    I have the following code and it fails, because it cannot read the file from disk. The image is always None.

    # -*- coding: utf-8 -*-
    import cv2
    import numpy

    bgrImage = cv2.imread(u'D:\\ö\\handschuh.jpg')


    Note: my file is already saved as UTF-8 with BOM. I verified with Notepad++.

    In Process Monitor, I see that Python is acccessing the file from a wrong path:

    [​IMG]

    I have read about:


    Continue reading...

Compartilhe esta Página