opencv-python icon indicating copy to clipboard operation
opencv-python copied to clipboard

The imread function for reading images and the imshow function for setting image titles should support Chinese characters

Open loli0123456789 opened this issue 10 months ago • 0 comments

Expected behaviour

The functions imread for reading images and imshow for setting image titles can support Chinese characters

Actual behaviour

1.When using the imread function to read an image with a path that includes Chinese characters, the function returns None. 2.When using the imshow function to display an image with a Chinese title set, the displayed title appears as corrupted text.

After reviewing the relevant documentation, I remain unclear on how to resolve the issue.

Steps to reproduce

  • example code

`import cv2

def read_img(img_path): img = cv2.imread(img_path) return img

def show_img(img,title): cv2.imshow(title,img) cv2.waitKey()

img=read_img(r'D:\测试\lenna.png') print(img) # the result is None

img=read_img(r'D:\Test\lenna.png') show_img(img,'测试')`

  • operating system windows 11
  • architecture (e.g. x86) x64
  • opencv-python version 4.9
Issue submission checklist
  • [ ] This is not a generic OpenCV usage question (looking for help for coding, other usage questions, homework etc.)

  • [ ] I have read the README of this repository and understand that this repository provides only an automated build toolchain for OpenCV Python packages (there is no actual OpenCV code here)

  • [ ] The issue is related to the build scripts in this repository, to the pre-built binaries or is a feature request (such as "please enable this additional dependency")

  • [x] I'm using the latest version of opencv-python

loli0123456789 avatar Apr 02 '24 03:04 loli0123456789