如何使用人体姿势估计生成骨架视图?
How to generate skeleton view using human pose estimation?
我正在尝试通过 keras 实现来使用人体姿势估计。我正在使用这个来源 https://github.com/michalfaber/keras_Realtime_Multi-Person_Pose_Estimation。我的问题是如何生成下图左侧部分的骨架视图?但是,我可以在右侧生成一个。
** 源照片取自 Pexels
下面是我用来实现此目的的代码。
# vgg normalization (subtracting mean) on input images
model = get_testing_model()
model.load_weights(keras_weights_file)
# load config
params, model_params = config_reader()
input_image = cv2.imread(image_path) # B,G,R order
body_parts, all_peaks, subset, candidate = extract_parts(input_image, params, model, model_params)
canvas = draw(input_image, all_peaks, subset, candidate)
toc = time.time()
print('processing time is %.5f' % (toc - tic))
cv2.imwrite(output, canvas)
cv2.destroyAllWindows()
您需要绘制黑色图像而不是输入图像以满足您的要求。下面是更新的代码。
# vgg normalization (subtracting mean) on input images
model = get_testing_model()
model.load_weights(keras_weights_file)
# load config
params, model_params = config_reader()
input_image = cv2.imread(image_path) # B,G,R order
body_parts, all_peaks, subset, candidate = extract_parts(input_image, params, model, model_params)
black_img = np.zeros_like(input_image, np.uint8)
canvas = draw(black_img, all_peaks, subset, candidate)
toc = time.time()
print('processing time is %.5f' % (toc - tic))
cv2.imwrite(output, canvas)
cv2.destroyAllWindows()
我正在尝试通过 keras 实现来使用人体姿势估计。我正在使用这个来源 https://github.com/michalfaber/keras_Realtime_Multi-Person_Pose_Estimation。我的问题是如何生成下图左侧部分的骨架视图?但是,我可以在右侧生成一个。
下面是我用来实现此目的的代码。
# vgg normalization (subtracting mean) on input images
model = get_testing_model()
model.load_weights(keras_weights_file)
# load config
params, model_params = config_reader()
input_image = cv2.imread(image_path) # B,G,R order
body_parts, all_peaks, subset, candidate = extract_parts(input_image, params, model, model_params)
canvas = draw(input_image, all_peaks, subset, candidate)
toc = time.time()
print('processing time is %.5f' % (toc - tic))
cv2.imwrite(output, canvas)
cv2.destroyAllWindows()
您需要绘制黑色图像而不是输入图像以满足您的要求。下面是更新的代码。
# vgg normalization (subtracting mean) on input images
model = get_testing_model()
model.load_weights(keras_weights_file)
# load config
params, model_params = config_reader()
input_image = cv2.imread(image_path) # B,G,R order
body_parts, all_peaks, subset, candidate = extract_parts(input_image, params, model, model_params)
black_img = np.zeros_like(input_image, np.uint8)
canvas = draw(black_img, all_peaks, subset, candidate)
toc = time.time()
print('processing time is %.5f' % (toc - tic))
cv2.imwrite(output, canvas)
cv2.destroyAllWindows()