如何解决不绘制关键点 OpenCV
我的感受: 未调用 draw_keypoints 函数。 请帮帮我我不知道出了什么问题 我知道这可能是功能范围外的问题,但仍然如此。
代码:
plt.imshow(frame)
cap = cv2.VideoCapture(0)
while cap.isOpened():
ret,frame = cap.read()
#Reshape Image
img = frame.copy()
img = tf.image.resize_with_pad(np.expand_dims(img,axis=0),256,256)
input_image= tf.cast(img,dtype=tf.float32)
#setup input and output
input_details = interpreter.get_input_details()
output_details = interpreter.get_output_details()
interpreter.set_tensor(input_details[0]['index'],np.array(input_image))
interpreter.invoke
keypoints_with_scores = interpreter.get_tensor(output_details[0]['index'])
draw_keypoints(frame,keypoints_with_scores,0.4)
cv2.imshow('MoveNet Thunder',frame)
if cv2.waitKey(10) & 0xFF==ord('q'):
break
cap.release()
cv2.destroyAllWindows()
def draw_keypoints(frame,keypoints,confidence_threshold):
cv2.circle(frame,(200,200),7,(0,255,0),3)
y,x,c = frame.shape
shaped = np.squeeze(np.multiply(keypoints,[y,1]))
for kp in shaped:
kx,ky,kc = kp
if kc > confidence_threshold:
cv2.circle(frame,(int(kx),int(ky)),3)
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。