I'm currently working with Intel's Real Sense depth camera (to be more specific, D435i).
Here are the pictures. First ones are the real pictures, but only the first color channel (you can clearly see waves): top view on a table side view on a table
This is an example picture: surface normals
I'm using this config for depth camera:
config.enable_stream(rs.stream.depth, 1280, 720, rs.format.z16, 30)
depth_sensor = profile.get_device().first_depth_sensor()
depth_sensor.set_option(rs.option.exposure, 1000)
depth_sensor.set_option(rs.option.laser_power, 100)
Here is a code that I use for calculating surface normals:
depthIntrinsics = profile.get_stream(rs.stream.depth).as_video_stream_profile().get_intrinsics()
frames = pipeline.wait_for_frames()
alignedFrames = rs.align(rs.stream.color).process(frames)
depthImage = np.asanyarray(alignedFrames.get_depth_frame().get_data())
depthImage = cv2.resize(depthImage, depthImageReducedSize)
fx, fy = depthIntrinsics.fx, depthIntrinsics.fy
dz_dv, dz_du = np.gradient(depthImage)
du_dx = fx / depthImage
dv_dy = fy / depthImage
dz_dx = dz_du * du_dx
dz_dy = dz_dv * dv_dy
normal_cross = np.dstack((-dz_dx, -dz_dy, np.ones_like(depthImage)))
normals = normal_cross / np.linalg.norm(normal_cross, axis=2, keepdims=True)
# set default normal to [0, 0, 1]
normals[~np.isfinite(normals).all(2)] = [0, 1, 0]
normals = np.uint8((normals + 1) / 2 * 255)[..., ::-1]
After running this code I get a pretty decent picture, but with weird "wavy" noise. Do you know what this might be related to? How can I get rid of it? If have any suggestions regarding camera config I'd like to read them too.