opencv / opencv/opencv-python

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

Open
#969 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
5.4k
Forks
1k
Avg merge
22h 17m
Merged PRs (30d)
3

Description

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")

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the opencv-python repository README and its stated packaging scope, then reproduce the Windows 11 behavior with opencv-python 4.9 using the provided imread and imshow examples. Done would require identifying whether the issue belongs in this build toolchain and defining a validated fix for both Unicode file paths and window titles.

Written by the indexing model from the issue text.

Assessment

Tech stack
opencv, python
Domain
computer-vision
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
15/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.