title: How should I convert a float32 image to an uint8 image?
body: <p>I want to convert a <code>float32</code> image into <code>uint8</code> image in Python using the openCV library. I used the following code, but I do not know whether it is correct or not.</p>
  
  <p>Here <code>I</code> is the <code>float32</code> image.</p>
  
  <pre><code>J = I*255
  J = J.astype(np.uint8)
  </code></pre>
  
  <p>I really appreciate if can you help me.</p>