def loadImgs(imgsfolder, rows, cols):
myfiles = glob.glob(imgsfolder+'*.jpg', 0)
nPics = len(myfiles)
X = np.zeros((nPics, rows, cols), dtype = 'uint8')
i = 0; imgNames = []
for filepath in myfiles:
sd = filepath.rfind('/'); ed = filepath.find('.'); filename = filepath[int(sd+1):int(ed)]
imgNames.append(filename)
temp = cv2.imread(filepath, 0)
if temp == None:
continue
elif temp.size < 1000:
continue
elif temp.shape == [rows, cols, 1]:
X[i,:,:] = temp
else:
X[i,:,:] = cv2.resize(temp,(cols, rows), interpolation = cv2.INTER_CUBIC)
i += 1
return X, imgNames
logoPredictor.py 文件源码
python
阅读 25
收藏 0
点赞 0
评论 0
评论列表
文章目录