Skip to content

Instantly share code, notes, and snippets.

@lubosz
Created October 27, 2017 16:47
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 lubosz/900b224bf3b6d3ec1b4fd95d1f9ce2be to your computer and use it in GitHub Desktop.
Save lubosz/900b224bf3b6d3ec1b4fd95d1f9ce2be to your computer and use it in GitHub Desktop.
How to decode MS Mixed Reality headset IR camera signal
#!/usr/bin/env python3
# v4l2-ctl --device /dev/video1 --stream-mmap --stream-to=frame.raw --stream-count=1
import numpy as np
import os
import cv2
fd = open('frame.raw', 'rb')
cols = int(1280)
rows = int(481)
f = np.fromfile(fd, dtype=np.int8,count=rows*cols)
im = f.reshape((rows, cols))
fd.close()
cv2.imshow('Yo', im)
cv2.waitKey()
cv2.destroyAllWindows()
cv2.imwrite("frame.png", im)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment