'Convert RGB human body to a pose template for human pose estimation

I have datasets with 9081 256x256 RGB images containing 5 peoples with three possible actions: forward/backward, wave hands, and forward bend.

Based on my application, I want to convert different human bodies into human pose template to achieve something like this: Transformation

(web: https://reurl.cc/Y9LvRD)

Namely, I don't need too many features such as colors and face, which will affect my neural network.

May i have some suggestions? Any help is much appreciated:)

Some sample of my RGB images: enter image description here enter image description here



Solution 1:[1]

EDIT :This only works for the example that was shown in the original post, the edited post is much more challenging than that !

You can select the area that is not white and set it to gray this way :

import skimage.io
import numpy as np


img = skimage.io.imread('themaninred.png')
tol= 50 #tolerance for the whiteness of white
img[np.sum(img, axis = 2) <255*3-tol] = [128,128,128]

skimage.io.imsave('themaninredbutgray.png', img )

enter image description here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1