国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > Python > 正文

python讀取圖像時遇到的奇怪問題

2019-11-08 01:32:11
字體:
來源:轉載
供稿:網友

最近用python載入自己的圖像數據時,遇到了一個奇怪的問題。 我的程序如下,想要把一張圖片載入到data中:

from PIL import Imagefrom scipy.misc import imread, imresizedata = np.zeros((10,278,278,3))img = Image.open('kitten.JPEG')arr = np.array(img)arr = imresize(arr, (278, 278))data[0,:,:,:] = arrplt.subplot(1,2,1)plt.imshow(arr)plt.subplot(1,2,2)plt.imshow(data[0,:,:,:])

結果在顯示結果時,圖片莫名其妙變成了下圖所示 這里寫圖片描述 弄了好久,查了imshow的手冊,終于搞明白了

If your grayscale image is single or double, the default display range is [0 1]. If your image’s data range is much larger or smaller than the default display range, you may need to experiment with setting the display range to see features in the image that would not be visible using the default display range. For all grayscale images having integer types, the default display range is [intmin(class(I)) intmax(class(I))].

搞了半天原來是imshow搞鬼

plt.imshow(data[0,:,:,:].astype('uint8'))

完美解決


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 澄江县| 淳安县| 东港市| 福鼎市| 微博| 芦山县| 喀什市| 宜兰县| 隆回县| 乐业县| 阳信县| 格尔木市| 游戏| 马龙县| 余江县| 贺兰县| 道孚县| 德江县| 无极县| 溧阳市| 永清县| 彩票| 双鸭山市| 德清县| 凌海市| 瓮安县| 赫章县| 广德县| 志丹县| 泸定县| 鹤山市| 永州市| 新民市| 邹平县| 武宣县| 永川市| 郸城县| 丹凤县| 廊坊市| 临泽县| 庄浪县|