def test(path):
cap = cv2.VideoCapture(path_video)
testing=[]
while(True):
ret, frame = cap.read()
res=cv2.resize(frame,(250,250))
gray_image = cv2.cvtColor(res, cv2.COLOR_BGR2GRAY)
xarr=np.squeeze(np.array(gray_image).astype(np.float32))
m,v=cv2.PCACompute(xarr)
arr= np.array(v)
flat_arr= arr.ravel()
testing.append(flat_arr)
#cv2.imshow('frame', frame)
#if cv2.waitKey(1) & 0xFF == ord("q"):
# break
#cap.release()
#cv2.destroyAllWindows()
logos=svm.predict(testing)
uniqlogos=list(set(logos))
for i in uniqlogos:
print(i)
评论列表
文章目录