1.两种方式:array.dtype=np.uint8 或是 array=array.astype( np.uint8 )
2.使用array=array.astype( np.uint8 )的时候必须astype后赋值,只是用array.astype( np.uint8 ) 是不会改变数据类型的,必须写成array=array.astype( np.uint8 )。
1.两种方式:array.dtype=np.uint8 或是 array=array.astype( np.uint8 )
2.使用array=array.astype( np.uint8 )的时候必须astype后赋值,只是用array.astype( np.uint8 ) 是不会改变数据类型的,必须写成array=array.astype( np.uint8 )。