繁体   English   中英

如何使用人体姿态估计生成骨架视图?

[英]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()

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM