運行了人家的代碼,結果中間多了一行'''的註釋就出現這個行不匹配的問題,還是經同學想到才發現的= =
注意中間的'''註釋''',刪了就解決
def PILMat_to_cvMat(image):
'''
Change the matrix from the format of PIL to openCV.
'''
mat =[]
for l in image:
x=[]
for l2 in l:
r,g,b = l2[0],l2[1],l2[2]
x.append([b,g,r])
mat.append(x)
new_image = np.asarray(mat)
return new_image