title: What's the proper way to colorize a 16-bit depth image?
body: <p>I have a depth image from an ifm 3D camera which utilizes a time-of-flight concept to capture depth images. The camera comes with a software which showcases the image as seen below:
  <a href="https://i.stack.imgur.com/DcwPe.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DcwPe.png" alt="Depth image of 12 randomly arranged tills" /></a></p>
  <p>I could extract the depth data from the camera and have been trying to recreate their representation, but I've been unsuccessful. No matter how I try to normalize the data range or change the data type format, I always end up with an image that is &quot;darker&quot; in the center and gets lighter as it moves away. The color range doesn't match either for some reason. Here's the main code I tried:</p>
  <pre><code>gray_dist = cv2.imread(dist_path, cv2.IMREAD_ANYDEPTH)
  
  # cv2.normalize(dist, dist, 0, 65535, cv2.NORM_MINMAX)
  # cv2.normalize(dist, dist, 0, 255, cv2.NORM_MINMAX)
  cv2.normalize(dist, dist, 1440, 1580, cv2.NORM_MINMAX)
  
  dist = dist.astype(np.uint8)
  dist = cv2.applyColorMap(dist, cv2.COLORMAP_HSV)
  # dist = cv2.cvtColor(dist, cv2.COLOR_HSV2BGR)
  
  cv2.imshow(&quot;out&quot;, dist)
  cv2.waitKey(0)
  </code></pre>
  <p>Which gets me the following image:</p>
  <p><a href="https://i.stack.imgur.com/WIMpm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WIMpm.png" alt="HSV color map" /></a></p>
  <p>I've tried other combinations and also to write my own normalization and colorize functions but I get the same result. I'm not sure at this point if I'm doing something wrong or if it's a limitation of the openCV window viewer or something else.</p>
  <p>I've also uploaded the depth image file in case it's helpful:
  <a href="http://www.filedropper.com/distimg" rel="nofollow noreferrer">depth_image</a></p>
  <p>Any help with this would be greatly appreciated.</p>