Clipping input data to the valid range for imshow with RGB data ([0..1] for floats or [0..255] for integers)

前端 未结 4 964
旧时难觅i
旧时难觅i 2020-12-14 07:02

I tried to run the graph cut algorithm for a slice of an MRI after converting it into PNG format. I keep encountering the following problem:



        
4条回答
  •  臣服心动
    2020-12-14 07:51

    Cast the image to np.uint8 after scaling [0, 255] range will dismiss this warning. It seems like a feature in matplotlib, as discussed in this issue.

    plt.imshow((out * 255).astype(np.uint8))
    

提交回复
热议问题