-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
支持中文路径 #23
支持中文路径 #23
Conversation
please install pre-commit and run, to fix code style. |
PPOCRLabel.py
Outdated
@@ -1248,7 +1248,7 @@ def createPolygon(self): | |||
|
|||
def rotateImg(self, filename, k, _value): | |||
self.actions.rotateRight.setEnabled(_value) | |||
pix = cv2.imread(filename) | |||
pix = cv2.imdecode(np.fromfile(filename, dtype=np.uint8), cv2.IMREAD_COLOR) | |||
pix = np.rot90(pix, k) | |||
cv2.imwrite(filename, pix) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is cv2.imwrite
affected by Chinese paths?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, for the Chinese path, cv2.imwrite(file_name, img)
should be modified to cv2.imencode(".jpg", img)[1].tofile(file_name)
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
根据linux(centos7.9),windows系统(win10)测试,以及opencv仓库下的 issue 4292确认,在windows下,imread、imwrite不兼容中文路径。
因此该提交可以增加在windows系统上对中文路径图像读写的能力。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
No description provided.