Skip to content

Instantly share code, notes, and snippets.

@mintisan
Created March 16, 2018 07:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mintisan/f42a77ddacb08d5bbd72c6721973306d to your computer and use it in GitHub Desktop.
Save mintisan/f42a77ddacb08d5bbd72c6721973306d to your computer and use it in GitHub Desktop.
Python 下 OpenCV 保存图片时包含中文路径
import cv2
import os
# ref. : http://blog.csdn.net/carryheart/article/details/61937872
# https://stackoverflow.com/questions/541390/extracting-extension-from-filename-in-python/
# image: image to be saved
# filename: filename with absolute path
cv2.imencode(os.path.splitext(filename)[1], image)[1].tofile(filename)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment