title: How to display 16-bit 4096 intensity image in Python openCV?
body: <p>I have images encoded in grayscale 16-bit tiff format. They use a variant of 16-bit color depth where the max intensity is 4,096.</p>
  
  <p>I believe the default max intensity in openCV is 65,536, so my image shows up as black using the following code.</p>
  
  <pre><code>import cv2
  
  image = cv2.imread("test.tif", -1)
  
  cv2.imshow('tiff', image)
  cv2.waitKey(0)
  cv2.destroyAllWindows()
  print(image)
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/RjPGN.png" rel="noreferrer"><img src="https://i.stack.imgur.com/RjPGN.png" alt="enter image description here"></a></p>
  
  <p>I can use <code>vmin</code> and <code>vmax</code> in <code>matplotlib</code> to configure the color mapping:</p>
  
  <pre><code>import cv2
  import matplotlib.pyplot as plt 
  
  image = cv2.imread("test.tif", -1)
  plt.imshow(image, cmap="gray", vmin=0, vmax=4096)
  plt.show()
  </code></pre>
  
  <p>It shows the content of the image:</p>
  
  <p><a href="https://i.stack.imgur.com/82YaL.png" rel="noreferrer"><img src="https://i.stack.imgur.com/82YaL.png" alt="enter image description here"></a></p>
  
  <p>The reason why I want to stick with openCV is <code>matplotlib</code> doesn't support displaying 16-bit RGB images.</p>
  
  <p>The <a href="https://docs.opencv.org/3.4.1/df/d24/group__highgui__opengl.html#gaae7e90aa3415c68dba22a5ff2cefc25d" rel="noreferrer">documentation</a> of <code>cv2.imshow</code> is not really helpful. Are there ways to display 16-bit 4096 intensity images in Python openCV? </p>
  
  <p>The testing image <code>test.tif</code> can be found <a href="https://www.dropbox.com/s/ek31cxnmhbskdqm/test.tif?dl=0" rel="noreferrer">here</a>.</p>