-
Notifications
You must be signed in to change notification settings - Fork 6
Description
Title:
[Bug] OpenCV imread fails on Windows with Chinese/Unicode file paths
Describe the bug
When processing images or videos located in directories containing Chinese (or other Unicode) characters or special symbols (e.g. 空格, (), []), SafeVision fails to load the file. The processing log shows an OpenCV error:
[ WARN:0@0.411] global loadsave.cpp:275 cv::findDecoder imread_('Q:\共享文件夹\X_025_沖田凛花Rinka\课件_014\课件_164\沖田凜花Rinka NO.146 Police Rinka[47P 1V 531.7M]\1 (11).jpg'): can't open/read file: check file path/integrity
Traceback (most recent call last):
...
AttributeError: 'NoneType' object has no attribute 'shape'
To Reproduce
Steps to reproduce the behavior:
-
Place an image in a directory with Chinese characters and/or special symbols, e.g.
Q:\共享文件夹\X_025_沖田凛花Rinka\课件_014\课件_164\沖田凜花Rinka NO.146 Police Rinka[47P 1V 531.7M]\1 (11).jpg -
Load this file into SafeVision.
-
Click Start Processing.
Expected behavior
The software should be able to handle Unicode/long paths on Windows and successfully process the file (like PIL.Image.open does). Ideally, SafeVision should automatically normalize or copy files into a safe working directory to bypass OpenCV’s imread limitations.
Screenshots / Logs
-
Screenshot of the UI and error log (attached).
-
Key error:
AttributeError: 'NoneType' object has no attribute 'shape'
Environment (please complete the following information):
- OS: Windows 10/11
- SafeVision version: v2.0
- Python/OpenCV backend (if relevant): OpenCV 4.x (from bundled exe)
- Input file system: Network drive
Q:(SMB) with Chinese/Unicode characters in path
Additional context
-
The issue seems to be due to OpenCV’s
cv::imreadnot supporting non-ASCII/long paths on Windows. -
Possible solutions:
- Use
PIL.Image.openorcv::imdecodewithnp.fromfileto support Unicode paths. - Provide an option in Settings to copy input files to a safe temp folder with ASCII names before processing.
- Use
-
Workaround: moving files into a pure-English path (e.g.
C:\SV\in\) allows processing to succeed.
