marek-simonik / record3d

Accompanying library for the Record3D iOS app (https://record3d.app/). Allows you to receive RGBD stream from iOS devices with TrueDepth camera(s).
https://record3d.app/
GNU Lesser General Public License v2.1
379 stars 55 forks source link

Possibility to acquire the depth information from the r3d file? #60

Closed t19cs008 closed 1 year ago

t19cs008 commented 1 year ago

Hi,

Previously, I have created an issues regarding to my project, which is Possibility to acquire the camera position from the r3d file? #59

I would like to recap on my projects usability: In my project, I would like to use the record3d app as part of it. I would like to obtain this information: RGB frame, depth frame, and camera position. Therefore, in my use case, I will record the object using the record3d app and save the file in iPad local file. Next, I would like to export the saved file for further processing.

As in issues #59, I have inquiry on the camera positions. Meanwhile, for this issues I would like to inquiry regarding the depth information. How would it be possible to acquire this information from .depth file?

Below is my finding on your project that might need your help and clarification:

  1. I saw your code and confirmed .depth file is lzfse file. I think I can decode it using https://github.com/lzfse/lzfse and load decoded file as bytes. However, how can I change it to depth frame.
  2. In order to change to depth frame, I have tried implementation with the following:
    • In my project, I use Python3 and ubuntu 20.04.
    • This is bash part. 0.depth is decoded by lzfse and 0.depth.byte is saved.
      $ git clone https://github.com/lzfse/lzfse.git
      $ cd lzfse
      $ make install INSTALL_PREFIX=/tmp/lzfse.dst/usr/local
      $ lzfse -decode -i 0.depth -o 0.depth.byte
import numpy as np

# read
filename = "0.depth.byte"
depth_row = None
with open(filename, "rb") as f:
    depth_row = f.read()

height = 640 # this is correct??

depth = np.frombuffer(depth_row, dtype="uint8")
depth = depth.reshape(height, -1)
print(depth.shape)


So, I would like to ask on the about steps, is there anything I have missed and end up with the errors. 
marek-simonik commented 1 year ago

See this issue https://github.com/marek-simonik/record3d/issues/7#issuecomment-736573410 — and especially the commented line of code in the Python sample; the size of LiDAR depth maps is 256x192 px, so height in your code should be 256 instead of 640.