Skip to content

Instantly share code, notes, and snippets.

@mcarletti
Created January 29, 2020 10:06
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mcarletti/0b340d859abde948cd76efd68ef998cf to your computer and use it in GitHub Desktop.
Save mcarletti/0b340d859abde948cd76efd68ef998cf to your computer and use it in GitHub Desktop.
def load_nv12_as_bgr(filename, shape, dtype=np.uint8):
with open(filename, "rb") as fp:
data = fp.read()
image = np.frombuffer(data, dtype=dtype).reshape(shape)
image = cv2.cvtColor(image, cv2.COLOR_YUV2BGR_NV12)
return image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment