Skip to content

Instantly share code, notes, and snippets.

@hashware
Last active June 23, 2018 08:15
Show Gist options
  • Save hashware/188f00dcdb0db73c2d15b14b5e55f772 to your computer and use it in GitHub Desktop.
Save hashware/188f00dcdb0db73c2d15b14b5e55f772 to your computer and use it in GitHub Desktop.
# coding:utf-8

import cv2

img = cv2.imread(p)
img.dtype = 'uint8'
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
img.tofile(p + '.bin')
cv2.imwrite(p + '.jpg', img)

opencv读取图片采用的顺序是BGR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment