如何修复getContext的错误?

时间:2017-04-25 07:37:22

标签: javascript html

enter image description here 我收到以下错误,无法识别getContext()。

1 个答案:

答案 0 :(得分:0)

你刚才写道:

train_set =[]
lbl_train=[]
for cl_ in range(50):
    for ex_ in range(15):
        cl = str("%02d" % (cl_+1,))
        ex = str("%02d" % (ex_+1,))
        img = Image.open('cropped_faces/'+'s'+str(cl)+'_'+str(ex)+'.jpg').convert('L')
        wpercent = (basewidth / float(img.size[0]))
        hsize = int((float(img.size[1]) * float(wpercent)))
        img = img.resize((basewidth, hsize), Image.ANTIALIAS)
        lbl_train.append(cl)
        mat = numpy.asarray(img,dtype=numpy.float)
        train_set.append(mat.reshape(len(mat),len(mat[0])))

print(numpy.asarray(train_set).shape)
print(numpy.asarray(train_set[0]).shape)

而不是:

canavas = document.getElementById('gameCanvas');

错误的名字。在提出问题之前尝试搜索一下