Created
January 29, 2020 10:06
-
-
Save mcarletti/0b340d859abde948cd76efd68ef998cf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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