K-近鄰算法之手寫數字識別系統

定義將圖像轉換爲向量函數 # 導入程序所需要的模塊 import numpy as np import operator from os import listdir 讀取文件 def img2vector(filename): returnVect = np.zeros((1, 1024)) # 存儲圖片像素的向量維度是1x1024 fr = open(filename)
相關文章
相關標籤/搜索