只需要在開頭加上一句即可
import numpy as np
np.set_printoptions(threshold=np.inf)
Python 輸出到文本中
參考:https://blog.csdn.net/u010624166/article/details/80140002
import sys
print " "#裏面爲你需要輸出的內容
output=sys.stdout
outputfile=open('output.txt', 'a')
sys.stdout=outputfile
若輸出中帶有中文,則添加
type=sys.getfilesystemencoding()#python編碼轉換到系統編碼輸出
整理關於Python讀取圖像的像素
參考:https://blog.csdn.net/search7/article/details/75528537
若用PIL(pillow)則
from PIL import Image
img=Image.open('0.png')
img_array=img.load()
然後就可以通過img_array[x,y]來讀取像素值了
另外img.size查看圖像的大小,也可以通過img_arrayx,y來設置RGB像素值
爲了想要看到所有的像素值,所以轉換成numpy格式如上讀取
import numpy as np
import cv2
img=cv2.imread('0.png', 'a')