How can I draw a human skeleton based on joint angles and segment lengths?

131 views Asked by At

I'm working on a project where I need to represent a human skeleton using only angles between segments and the length of those segments. I have detailed information about the angles at the joints and the lengths of the bones (segments). I would like to know if there's an efficient way to draw this human skeleton using this information.

I've tried searching for specific libraries or algorithms that can help me create accurate visualizations of the human skeleton based on this data, but so far, I haven't been successful. I would appreciate any guidance, algorithm suggestions, or libraries in Python.

Thank you in advance for any help you can provide!

Additional information:

The segment lengths that i use are the next ones: hip to hip, trunk, upper leg, lower leg, upper arm, forearm and shoulders.

Based on the angles of this or any other skeleton: enter image description here

, i.e. a dictionary like the following:

{(12, 14, 16): 168.54785591626595,
 (14, 12, 24): 172.77150681015084,
 (24, 12, 11): 54.37272304423055,
 (12, 11, 23): 117.01615512185863,
 (11, 23, 24): 108.6334963772736,
 (23, 11, 13): 45.915788777620314,
 (11, 13, 15): 177.83453548133326,
 (23, 24, 12): 79.97762545663724,
 (26, 24, 23): 163.4421588161629,
 (24, 23, 25): 145.8882059820918,
 (28, 26, 24): 103.70318526501839,
 (23, 25, 27): 178.10520631231438

and the following segment lengths in cm:

{'hip': 20.4,
 'trunk': 49.3,
 'shoulders': 34.0,
 'forearm': 27.2,
 'upper arm': 29.409999999999997,
 'upper leg': 42.33,
 'lower leg': 42.5}

I want to draw only the skeleton like this I have tried: enter image description here.

However, the method I am using now is not feasible, since for each new pose I need to manually recalculate the relationship of the joint angles with the X-axis (mainly for those joints whose segments do not intersect with the hip segment).

To facilitate the task I am assuming that the left hip is the origin of coordinates and that it has no angle relative to the X-axis.

1

There are 1 answers

0
S. Huber On

Your question is quite under-specified. First, if you take your drawing, move it around and rotate it arbitrarily then your segment lengths and angles did not change. So unless you add more specifications, you cannot draw it in a unique fashion.

Assumption. I guess the triples, like (12, 14, 16), denote triples of node IDs. Like for angle 10, the lower leg stands on 28, 26 is the knee, 24 is at the hip, see the picture below. Furthermore, all angles seem to be given in clockwise-direction, i.e., the angle (a, b, c) means the angle on the "right" side of the arrow from a to b.

enter image description here

Then we can make the following mathematical observations:

Observation: If two nodes of a specified angle have known positions then the third is uniquely determined.

I think the following algorithm should do the job given your description:

while not all nodes placed:
  if there is an angle with two nodes placed:
    place the third # can be done in a unique fashion
  else:
    # the solution is not unique and we have to place some nodes

    if there is an angle with one node placed:
      place a second one at the given distance
    else:
      # all remaining angles have no nodes placed
      pick a random angle and place a node somewhere

At least this algorithm is correct if your entire skeleton can be swept in the following fashion: If not all nodes have placed yet then there is an angle with two nodes placed, which determines a next node, so that the node placing continues in a uniquely specified fashion.

Rigidity theory. Now, problems may arise when your specifications do not fulfill the above property. Then the problem becomes more interesting and the greedy algorithm above may be insufficient, but I have not thought about it too much.

One can do some more serious math with these type of problems. This is the field of structural rigidity. Note that for every given angle the length of each side of the resulting triangle is known, so you can think of adding it to your skeleton graph. Then the question is whether the resulting graph is actually rigid.