TypeError: Image data can not convert to float

前端 未结 12 736
醉话见心
醉话见心 2020-12-17 07:45

I am trying to create a 16-bit image like so:

import skimage 
import random
from random import randint                        
xrow=raw_input("Enter the          


        
12条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-17 08:11

    This question comes up first in the Google search for this type error, but does not have a general answer about the cause of the error. The poster's unique problem was the use of an inappropriate object type as the main argument for plt.imshow(). A more general answer is that plt.imshow() wants an array of floats and if you don't specify a float, numpy, pandas, or whatever else, might infer a different data type somewhere along the line. You can avoid this by specifying a float for the dtype argument is the constructor of the object.

    See the Numpy documentation here.

    See the Pandas documentation here

提交回复
热议问题