Skip to content
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

Merged
merged 2 commits into from
Jul 4, 2024
Merged

支持中文路径 #23

merged 2 commits into from
Jul 4, 2024

Conversation

sunlingzhang
Copy link
Contributor

No description provided.

@GreatV
Copy link
Collaborator

GreatV commented Jul 2, 2024

please install pre-commit and run, to fix code style.

@GreatV GreatV self-requested a review July 2, 2024 05:02
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)
Copy link
Collaborator

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?

Copy link
Contributor Author

@sunlingzhang sunlingzhang Jul 2, 2024

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

Copy link
Collaborator

@Gmgge Gmgge Jul 4, 2024

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系统上对中文路径图像读写的能力。

@GreatV GreatV requested a review from Gmgge July 4, 2024 02:02
@sunlingzhang sunlingzhang requested a review from GreatV July 4, 2024 02:08
Copy link
Collaborator

@GreatV GreatV left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@GreatV GreatV merged commit 94cc9de into PFCCLab:main Jul 4, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants