-
-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Any documentation on the depth frame format? #7
Comments
Follow up question - what are the .conf files for? Are there some docs on this I've overlooked? |
Hello Andy, import numpy as np
import cv2
import liblzfse # https://pypi.org/project/pyliblzfse/
def load_depth(filepath):
with open(filepath, 'rb') as depth_fh:
raw_bytes = depth_fh.read()
decompressed_bytes = liblzfse.decompress(raw_bytes)
depth_img = np.frombuffer(decompressed_bytes, dtype=np.float32)
depth_img = depth_img.reshape((640, 480)) # For a FaceID camera 3D Video
# depth_img = depth_img.reshape((256, 192)) # For a LiDAR 3D Video
return depth_img
if __name__ == '__main__':
depth_filepath = '/tmp/depth_0.lzfse'
depth_img = load_depth(depth_filepath)
cv2.imshow('Depth', depth_img)
cv2.waitKey(0) As you wrote, the decompressed The I think this answers your question, so I am closing this issue, but feel free to ask follow-up questions. |
(thanks! the above was really helpful for me. However - will anyone else find it easily as it is in a closed github issue? Part of my reason for opening this was to suggest that something like the above would be a great addition to the docs) |
You are right, thanks for reminding me that. I added link to this Issue into the Wiki. |
Had the same confusion and found this issue before going to the Wiki. Also on a related note - is it possible to get distance in meters from an exported RGBD video? |
OK, I will mention the Wiki in the Readme the next time I will push an update. As for getting the distance in meters from exported RGBD videos: yes, it is possible. I described how to do it in the Readme of this demo. |
got it, thank you for a great app and library! |
Thank you for the suggestion, noted! I will include landscape mode in a future update. |
Two follow-up questions:
|
To answer your questions:
|
Hi,
Is the above correct?
Thank you very much! |
Addition on this issue regarding Apple ARKIT depth confidence map: From https://developer.apple.com/documentation/arkit/arconfidencelevel, there are only three levels of confidence map values.
Hope it helps future users to understand why confidence map is only consist of 0, 1, 2 ! |
I've exported a recording in the native r3d format and I'm attempting to read the depth data
>>> pth = 'winhome/Documents/3D Scans/2020-10-28--15-01-03/rgbd/1.depth'
>>> fh = open(pth, "rb")
>>> compressed = fh.read()
>>> decompressed = liblzfse.decompress(compressed)
But then I'm not sure what to do with the decompressed data. Is it just a case of reading each 4 bytes, unpacking them to a single precision float? The jpgs are 192x256 and doing the maths on that seems to add up: 192 x 256 x 4 = 196608 and len(decompressed) gives me 196608.
So this looks right:
>>> f = [struct.unpack('f', d[x:x+4]) for x in range(0,len(d),4)]
Then I guess I can just write f into any image format that supports floating point (.hdr or .exr maybe)
Am I on the right lines? Are the values linear distances from the camera?
If so - it would be nice to add this to the docs.
The text was updated successfully, but these errors were encountered: