Convert disparity image to depth image

Hi, I am using the Isaac ROS DNN Stereo Depth package along with Isaacsim. I want to convert the output of the package, which is a disparity image, into a depth image and save it to an npy file. Here is my code snippet:

 # Convert ROS image to OpenCV format
  bridge = CvBridge()
  disparity_image = bridge.imgmsg_to_cv2(disparity_msg.image, desired_encoding="32FC1")

  # Extract camera parameters
  focal_length = disparity_msg.f
  baseline = disparity_msg.t

  # Create empty depth image
  depth_image = np.zeros_like(disparity_image)

  # Calculate depth for each pixel (excluding invalid regions)
  valid_window = disparity_msg.valid_window
  for y in range(valid_window.y_offset, valid_window.y_offset + valid_window.height):
    for x in range(valid_window.x_offset, valid_window.x_offset + valid_window.width):
      disparity = disparity_image[y, x]
      # Handle potential division by zero
      if disparity != 0:
        depth_image[y, x] = (focal_length * baseline) / disparity

  return depth_image

# Assuming you have a subscriber to receive disparity messages
def callback(disparity_msg):
  depth_image = convert_disparity_to_depth(disparity_msg)

However, the resulting npy files are either entirely black or normal. Did I make any mistakes in any steps?
left image:

right image: