How can I *programatically * find the tip of the nose ?

MakeHuman python API, python plugins, etc

Moderator: joepal

How can I *programatically * find the tip of the nose ?

Postby dma2017 » Thu Jun 29, 2017 9:16 am

Hi All,
I am trying to automate a few things to help create characters (as a hobby project), but to go further, I would have to programatically find the coordinates of a few features on the model beeing edited, such as the tip of the nose, the corner of the mouth etc...
Any hints on how I could do that ?
Thanks

-David
dma2017
 
Posts: 10
Joined: Mon Jun 26, 2017 9:43 pm

Re: How can I *programatically * find the tip of the nose ?

Postby joepal » Thu Jun 29, 2017 12:28 pm

Vertices are always in the same order. So if you figure out the vertex number for the points in question, you can simply read their coordinates.

In blender we can see that an unmodified base mesh (loaded from MakeTarget) has the nose tip at 0, 6.9385, 1.6798

vertex1.png


Grepping for that in makehuman/data/3dobjs/base.obj we find:

Code: Select all
...
v -0.0334 6.9424 1.6716
v -0.0648 6.9440 1.6586
v 0.0000 6.9385 1.6798  <--- This line seems to match
...


... ie, those coordinates are on line 5083. However, the first 29 lines of text in the files are comments, so the actual vertex number is 5054.

In MHAPI (see https://github.com/makehumancommunity/c ... cs/mesh.md) you can find a call getVertexCoordinates(), which returns an array with the coordinates of all vertices. Unless my logic is wrong here somwehere, the nose tip is at position 5054 in that array.
Joel Palmius (LinkedIn)
MakeHuman Infrastructure Manager
http://www.palmius.com/joel
joepal
 
Posts: 3507
Joined: Wed Jun 04, 2008 11:20 am

Re: How can I *programatically * find the tip of the nose ?

Postby blindsaypatten » Thu Jun 29, 2017 2:51 pm

dma2017 wrote:Hi All,
I am trying to automate a few things to help create characters (as a hobby project), but to go further, I would have to programatically find the coordinates of a few features on the model beeing edited, such as the tip of the nose, the corner of the mouth etc...
Any hints on how I could do that ?
Thanks

-David

You don't specify whether your code will be running in Blender, in MH, or in a separate program.
blindsaypatten
 
Posts: 586
Joined: Tue Mar 14, 2017 11:16 pm

Re: How can I *programatically * find the tip of the nose ?

Postby dma2017 » Tue Jul 04, 2017 5:57 am

@joepal Thanks very much for taking the time to make such a detailed answer. Exactly what I needed.
-David
dma2017
 
Posts: 10
Joined: Mon Jun 26, 2017 9:43 pm


Return to Python scripts

Who is online

Users browsing this forum: No registered users and 1 guest

cron