gpt4 book ai didi

python - 如何使用人体姿势估计生成骨骼 View ?

转载 作者:行者123 更新时间:2023-12-02 17:21:20 26 4
gpt4 key购买 nike

我正在尝试通过keras实现使用人体姿势估计。我正在使用此源https://github.com/michalfaber/keras_Realtime_Multi-Person_Pose_Estimation。我的问题是如何生成以下图像的骨架 View ,即左侧的图像?但是,我可以在正确的部分生成一个。

enter image description here
**来源图片来自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()

关于python - 如何使用人体姿势估计生成骨骼 View ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62067694/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com