Functions to control measurement modifiers

MakeHuman python API, python plugins, etc

Moderator: joepal

Functions to control measurement modifiers

Postby Deepfreeze » Mon Feb 09, 2015 3:30 pm

Hi,

I'm using the headless MakeHuman script that can be found online.
In this way, i'm able to control the macro parameters of the body and
return the meshdata of this body.

Now I would like to control the measurement modifiers, so I've started
to try and change the waist of the model. By using:

Code: Select all
Measurerer = (__import__("0_modeling_a_measurement"))

ruler = Measurerer.Ruler()
print 'waist [cm]: ',ruler.getMeasure(human,'measure/measure-waist-decrease|increase','metric')


I can measure the waist perimeter. But now the big questions, which functions should I
use to change the waist perimeter. I've followed the code for slidermodifier, but can't
get a complete understanding on how the mesh coordinates are updated by a different
waist size.

Please show a small example on how I could update the waist size in python code.
Deepfreeze
 
Posts: 4
Joined: Mon Feb 09, 2015 3:05 pm

Re: Functions to control measurement modifiers

Postby duststorm » Mon Feb 09, 2015 8:52 pm

The thing is, there is no link between real life (measured) units, and MH units.
The only thing you can do, and what the Measurement plugin does. is increase the value of a single modifier in incremental steps, and measure the length each time. Then just stop if the desired length is reached. You could make it refine the result by using an O(log) recursive search.
The real improvement would be if you could do these calculations offline, and store a big matrix of all modifier combinations, and their effect on lengths (storing min and max length for each combination is enough, since it can be interpolated between linearly). That will give you a huge matrix in which you can reverse search: lookup the desired lengths, and pass back the MH modifier value.
This thing does not exist yet and has to be programmed.
MakeHuman™ developer
User avatar
duststorm
 
Posts: 2569
Joined: Fri Jan 27, 2012 11:57 am
Location: Belgium

Re: Functions to control measurement modifiers

Postby Deepfreeze » Tue Feb 10, 2015 10:30 am

Ok thanks for the feedback and idea's.

I just found how I can change the model using the measurement modifiers:

Code: Select all
humanmodifier.loadModifiers(getpath.getSysDataPath('modifiers/measurement_modifiers.json'), human)
   
ruler = Measurerer.Ruler()
print 'waist [cm]: ',ruler.getMeasure(human,'measure/measure-waist-decrease|increase','metric')

human.getModifier('measure/measure-waist-decrease|increase').setValue(-2.0)
human.applyAllTargets()   
print 'waist [cm], -2.0: ',ruler.getMeasure(human,'measure/measure-waist-decrease|increase','metric')


In order to make the -2.0 work, I commented out clampValue in:
humanmodifier -> ManagedTargetModifier -> setValue

I can now make a function for each modifier based on 2 points, such that:
setValue = a * desiredValueCm + b

In this way I can fill the desiredValueCm, get the setValue and apply this setValue to the human model.
Deepfreeze
 
Posts: 4
Joined: Mon Feb 09, 2015 3:05 pm

Re: Functions to control measurement modifiers

Postby duststorm » Wed Feb 11, 2015 9:04 am

Targets are not supposed to be applied outside the [-1,1] or [0,1] (depending on modifier) range, or you might get deformed monsters instead of humans.
MakeHuman™ developer
User avatar
duststorm
 
Posts: 2569
Joined: Fri Jan 27, 2012 11:57 am
Location: Belgium

Re: Functions to control measurement modifiers

Postby Deepfreeze » Mon Feb 16, 2015 10:43 am

I understand. But now I'm responsible for giving a correct desiredValueCm and not limit by the MakeHuman ranges.
Deepfreeze
 
Posts: 4
Joined: Mon Feb 09, 2015 3:05 pm

Re: Functions to control measurement modifiers

Postby duststorm » Mon Feb 16, 2015 1:06 pm

Deepfreeze wrote:I understand. But now I'm responsible for giving a correct desiredValueCm and not limit by the MakeHuman ranges.


Even so, there's hundreds of modifiers in MakeHuman that could help you achieve the desired measurement. You probably don't need to push a few modifiers over their boundaries to achieve it, and get a mediocre result.
I believe that the ranges of body dimensions that MH covers, if modifiers are sensibly combined, spans 99% of the population. It would be interesting if we had a tool to formally prove this statement.
MakeHuman™ developer
User avatar
duststorm
 
Posts: 2569
Joined: Fri Jan 27, 2012 11:57 am
Location: Belgium

Re: Functions to control measurement modifiers

Postby Deepfreeze » Wed Feb 18, 2015 10:21 am

Perhaps the following url can help you with this. It has quite some population size data.
http://dined.io.tudelft.nl/dined/full
Deepfreeze
 
Posts: 4
Joined: Mon Feb 09, 2015 3:05 pm

Re: Functions to control measurement modifiers

Postby duststorm » Wed Feb 18, 2015 11:43 am

That might help, but it'd be necessary to calculate and store all proportions available in MH first. Then the results could be compared to such data.
MakeHuman™ developer
User avatar
duststorm
 
Posts: 2569
Joined: Fri Jan 27, 2012 11:57 am
Location: Belgium

Re: Functions to control measurement modifiers

Postby Ryans_emporium » Mon May 25, 2015 10:46 pm

The method for both anthropometric and ergonomic calculations is to set 'fit' curves that are trained off human data tables, then curves plotted against that data. Store those curve look up charts and quickly get your dimension for any metric in realtime across many metrics.

In the past I have plotted all 72 standard anthropometric dimensions across 4,000 human sample scans and built fit curves that classify the basic height, weight and body shape first then serve up dimensional array of candidates distributed across x,y matrix. Then you simply plot the intersection of each 'fit' curve. It simple and foolproof method, as it allows you to determine human hybrid dimensions accurate to known metrics.

You also don't want the MH vertex and loop line dimensions - those are not usable, you need another proxy mesh with all the loop-lines sitting exactly where the traditional 72 anthropometric dimensions are taken from, along with landmark points. The landmark points will also slide on the base mesh relative to body shape change - so using one mesh is anthropometric nonsense ... body landmarks are based on skeletal & muscles points and these will differ according to body mass and muscle tone. In other words you need to set the base mesh according to the 72 measurement landmarks and then 4,000 baseline body scan shapes - to get your fit curves. Once you have these you can generate hybrid mesh shapes between data.

Have done this before ... you just seemed to be wildly off track.
Katey
Ryans_emporium
 
Posts: 3
Joined: Sat Nov 29, 2014 12:53 am

Re: Functions to control measurement modifiers

Postby rajataggarwal91 » Thu Jun 25, 2015 1:34 pm

Hi Ryans_emporium,
Do you want to say that using Makehuman to create accurate body measurements is not the correct way. This post has confused me even more about the mathematical basis makehuman is deforming its vertex on.
Is there any public document about your work, I would like to read it, if you may.

Thanks.
rajataggarwal91
 
Posts: 11
Joined: Fri Jun 19, 2015 3:25 am

Next

Return to Python scripts

Who is online

Users browsing this forum: No registered users and 1 guest