运行了人家的代码,结果中间多了一行'''的注释就出现这个行不匹配的问题,还是经同学想到才发现的= =
注意中间的'''注释''',删了就解决
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