国产探花免费观看_亚洲丰满少妇自慰呻吟_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'))

完美解決


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 巨鹿县| 治县。| 邹城市| 手游| 商水县| 海宁市| 阳泉市| 新巴尔虎左旗| 成都市| 同德县| 集贤县| 辽中县| 安庆市| 兴海县| 抚州市| 乌拉特后旗| 松江区| 甘谷县| 峨眉山市| 安龙县| 句容市| 江川县| 老河口市| 腾冲县| 南城县| 临沭县| 湛江市| 哈巴河县| 乐平市| 苍山县| 昌图县| 开封县| 博罗县| 余姚市| 江口县| 咸丰县| 宾川县| 南木林县| 靖州| 龙海市| 秭归县|