当我打电话
mahotas.features.zernike_moments
fv = mahotas.features.zernike_moments(mask, cv2.minEnclosingCircle(cnt)[1], degree=8)
File "C:\Users\admin\AppData\Local\Programs\Python\Python37\lib\site-packages\mahotas\features\zernike.py", line 59, in zernike_moments
c0,c1 = center_of_mass(im)
ValueError: too many values to unpack (expected 2)
penStrokes = np.array(penStrokes)
peri = cv2.arcLength(penStrokes, True)
approx = cv2.approxPolyDP(penStrokes, 0.02 * peri, True)
mask = np.zeros((frame.shape[0], frame.shape[1], 1), dtype='uint8')
cv2.drawContours(mask, [approx], -1, (255,), -1)
cnt = cv2.findContours(mask.copy(), cv2.RETR_LIST, cv2.CHAIN_APPROX_SIMPLE)[1][0]
cv2.imshow('mask', mask)
# Determine shape from zernike moments
fv = mahotas.features.zernike_moments(mask, cv2.minEnclosingCircle(cnt)[1], degree=8)
print(fv)
编辑