ankurhanda / simkinect

Simulating Kinect Noise: adding noise to clean depth-maps rendered with a graphics engine.
76 stars 10 forks source link

add_noise script does not work for my synthetic depth images #3

Open Me817 opened 2 years ago

Me817 commented 2 years ago

Hey,

thank you for the great code to add noise to depth images. I tried the add_noise.py script with some depth images I generated with Unity but I always run into the following error:

python add_noise.py
Traceback (most recent call last):
  File "add_noise.py", line 130, in <module>
    h, w = depth_uint16.shape
ValueError: too many values to unpack (expected 2)
libpng warning: iCCP: known incorrect sRGB profile

Here you can see my depth image: test1_depth (Resolution: 640x576, NFOV Unbinned von Azure Kinect)

Is there a specific format for the depth images? Could you help to solve this problem?

Thank you in advance. Best, Me817

fishbotics commented 2 years ago

@Me817 : if you're still interested in this (I know it's been a year), the issue is that your depth image is stored with three channels (similar to a regular image). But, it looks like all three channels have the same value. You can recover the depth image in the format required by the code by using this line to load the image (remember to change the file path)

depth_uint16 = cv2.imread(FILE_PATH, cv2.IMREAD_UNCHANGED)[:, :, 0]