Height and Weight

This forum is aimed at user contributions, in the form of assets, side projects, code patches and similar.

Moderator: joepal

Re: Height and Weight

Postby SaltyCowdawg » Mon Oct 07, 2013 2:55 pm

One random thought about height vs. age.

When I joined the US Navy in 1975 at the age of 19 I was measured at 5 foot 9 (175.26 cm) and today at 57 years of age I stand 5 foot 7 3/4 (172.085 cm) tall. Seems *some* of us lose height as we age. In my case I have damaged disks in my back that account for the loss in height.

Other folks might have other factors in losing height as we age.

At present if I am creating a human that I want that effect for I fake it out by just adjusting the slider.

Along the same vein I tried to deform a mesh for a human to emulate the affects of scoliosis. My failure I attribute to lack of skill on my part, but it was a flaming disaster.
Peter L. Berghold <peter@berghold.net> or <Salty.Cowdawg@gmail.com>
Retired IT with 30+ years in the business
User avatar
SaltyCowdawg
 
Posts: 458
Joined: Fri Aug 09, 2013 3:12 pm
Location: Ayden NC

Re: Height and Weight

Postby duststorm » Tue Oct 08, 2013 10:43 am

In MH the older morph does become a little smaller in height gradually, because the back bends forward.
But I guess big differences in height are not a general trend, and only happen in some individual cases.
MakeHuman™ developer
User avatar
duststorm
 
Posts: 2569
Joined: Fri Jan 27, 2012 11:57 am
Location: Belgium

Re: Height and Weight

Postby duststorm » Tue Oct 29, 2013 10:51 am

Just a mention that we have included volume and surface area calculation methods in MH.
They are in the shared/mesh_operations.py module.

You can test them out in the Python shell (Utilities > Shell tab) or in the Scripting tab, by importing mesh_operations and using its volume or surface methods.

This opens the road to experimenting with weight calculation formulas within MH.
MakeHuman™ developer
User avatar
duststorm
 
Posts: 2569
Joined: Fri Jan 27, 2012 11:57 am
Location: Belgium

Re: Height and Weight

Postby madcontra » Fri Dec 27, 2013 9:08 am

Forgive me, I'm not a programmer: how does one use the volume method in mesh_operations? When I go to scripting, import mesh_operations, type "calculateVolume()", and hit execute it throws an error that it takes at least one argument. Looking at the code, it seems to require a "mesh" argument but I can't for the life of me figure out what it wants here.

Thanks!
madcontra
 
Posts: 6
Joined: Sat Sep 28, 2013 6:03 pm

Re: Height and Weight

Postby duststorm » Sat Dec 28, 2013 12:43 am

It requires the mesh to calculate the volume of.
In your case, you probably want to pass it human.mesh
When using it for the human, you probably also want to pass it the face mask that filters out the helper geometry (I assume you are not interested in the volume of the human and the helpers)

That would give you:
Code: Select all
mesh_operations.calculateVolume(human.mesh, faceMask = human.getFaceMask())
MakeHuman™ developer
User avatar
duststorm
 
Posts: 2569
Joined: Fri Jan 27, 2012 11:57 am
Location: Belgium

Re: Height and Weight

Postby madcontra » Sat Dec 28, 2013 1:02 am

I got "name 'human' is not defined". ???
madcontra
 
Posts: 6
Joined: Sat Sep 28, 2013 6:03 pm

Re: Height and Weight

Postby duststorm » Sat Dec 28, 2013 1:10 am

I have a snippet that I can share, which was used for an experiment in collaboration with another researcher.
I am only sharing my own work, the complete plugin also includes a few approaches for approximating the mass of the human body. But I will have to ask first whether I can share that information.

This code gives you the height, surface and volume, you will have to add the rest.
This snippet is shared under the same license as MH.

Code: Select all
#!/usr/bin/python
# -*- coding: utf-8 -*-

"""
**Project Name:**      MakeHuman

**Product Home Page:** http://www.makehuman.org/

**Code Home Page:**    http://code.google.com/p/makehuman/

**Authors:**           Jonas Hauquier

**Copyright(c):**      MakeHuman Team 2001-2014

**Licensing:**         AGPL3 (see also http://www.makehuman.org/node/318)

    This file is part of MakeHuman (www.makehuman.org).

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Affero General Public License as
    published by the Free Software Foundation, either version 3 of the
    License, or (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.

**Coding Standards:**  See http://www.makehuman.org/node/165

Abstract
--------

Base template for weight calculation experiments

"""

import gui3d
import mh
import gui
import log
import numpy as np
import mesh_operations

class WeightTaskView(gui3d.TaskView):

    def __init__(self, category):
        """
        Constructor of the Body weight tab (in utilities category)
        """
        gui3d.TaskView.__init__(self, category, 'Body weight')

        self.human = gui3d.app.selectedHuman

        box = self.addLeftWidget(gui.GroupBox('Body weight'))
        self.volumeLabel = box.addWidget(gui.TextView(''))
        self.surfaceLabel = box.addWidget(gui.TextView(''))
        self.heightLabel = box.addWidget(gui.TextView(''))

        #self.calculateButton = box.addWidget(gui.Button('Calculate'))

        #@self.calculateButton.mhEvent
        #def onClicked(event):
        #    self.calculateWeight()

        self.calculateWeight()

    def onHumanChanged(self, event):
        """
        Update metrics when human mesh is modified
        """
        self.calculateWeight()

    def calculateWeight(self):
        """
        Calculate body metrics
        """
        humanMesh = self.human.meshData

        # Calculate height, body surface area and volume in m / m^2 / m^3
        height = self.human.getHeightCm()/100
        bsa = mesh_operations.calculateSurface(humanMesh, faceMask = self.human.getFaceMask())/100
        vol = mesh_operations.calculateVolume(humanMesh, faceMask = self.human.getFaceMask())/1000

        self.volumeLabel.setText('Volume %.2f m^3' % vol)
        self.surfaceLabel.setText('Surface: %.2f m^2' % bsa)
        self.heightLabel.setText('Height: %.2f m' % height)

def load(app):
    """
    Initialize plugin
    """
    category = app.getCategory('Utilities')
    taskview = category.addTask(WeightTaskView(category))

def unload(app):
    pass

MakeHuman™ developer
User avatar
duststorm
 
Posts: 2569
Joined: Fri Jan 27, 2012 11:57 am
Location: Belgium

Re: Height and Weight

Postby overweight » Tue Nov 04, 2014 2:54 pm

Dear Duststorm,
For scientific purposes, I need to calculate the weights (kg) for a large number of figures, differing in age and "weight" (as manipulated with the slider in MH). I am not a programmer and wonder about an easy way to access the program you published one year ago; for example, by using the Utilities. Should I first download that program?
overweight
 
Posts: 1
Joined: Tue Nov 04, 2014 12:37 pm

Re: Height and Weight

Postby duststorm » Tue Nov 04, 2014 4:04 pm

Copy it in a file with extension .py eg weight_estimation.py
and copy it in the plugins/ folder where makehuman is installed.
Then restart MH and it will be in the utilities tab
MakeHuman™ developer
User avatar
duststorm
 
Posts: 2569
Joined: Fri Jan 27, 2012 11:57 am
Location: Belgium

Re: Height and Weight

Postby SaltyCowdawg » Tue Nov 04, 2014 9:09 pm

Code: Select all

Could not load 9_estimate_weight
Traceback (most recent call last):
  File "./core/mhmain.py", line 498, in loadNextPlugin
    module.load(self)
  File "plugins/9_estimate_weight.py", line 82, in load
    taskview = category.addTask(WeightTaskView(category))
  File "plugins/9_estimate_weight.py", line 54, in __init__
    self.calculateWeight()
  File "plugins/9_estimate_weight.py", line 70, in calculateWeight
    bsa = mesh_operations.calculateSurface(humanMesh, faceMask = self.human.getFaceMask())/100
AttributeError: 'Human' object has no attribute 'getFaceMask'


Peter L. Berghold <peter@berghold.net> or <Salty.Cowdawg@gmail.com>
Retired IT with 30+ years in the business
User avatar
SaltyCowdawg
 
Posts: 458
Joined: Fri Aug 09, 2013 3:12 pm
Location: Ayden NC

PreviousNext

Return to User contributions

Who is online

Users browsing this forum: No registered users and 1 guest