longbone_Scaling
Scale triangular meshes stored in Wavefront OBJ format.
longbone_Scaling
scales a 3D model in filename to a specified
maximum distance in maxD and returns the scaling factor, while it
stores the coordinates of the points corresponding to the maximum distance in
a Meshlab PickedPoints file.
The function may be used for scaling a single mesh or batch scaling multiple meshes. When called with a single input argument, the function will scale the particular mesh defined in filename so that the scaled mesh will have a user-defined maximum distance. The function is primarily intended for scaling long bone triangular mesh models produced with 3D photogrammetry, hence the use of maximum distance as the target reference for scaling. Nevertheless, it can be used for scaling any triangular mesh of arbitrary shape according to its maximum distance, which can either be parsed as a second input argument maxD or when prompted by the function.
When called with no input arguments, the function will scan the working directory for all .obj files and will scale them iteratively in batch mode. For each available OBJ, the user will be prompted for the actual maximum distance of each corresponding long bone and it will subsequently scale the model to the real world dimensions with units in mm. Scaling is performed about the model’s barycentric coordinates, which are translated to origin.
Prior to scaling, when prompted for manual measurement value, the user may
examine the model’s maximum distance corresponding points by opening the
triangular mesh in Meshlab and utilizing the corresponding .pp
file,
which is created automatically by the present function. After scaling is
performed for a given triangular mesh, the user may re-examine the scaled
model by reloading the mesh and its respective .pp file, which is
automatically updated with the new points of its maximum distance.
scale = longbone_Scaling (…)
returns a cell array with
each 3D model’s filename and scale related measurements in the following
order: filename, ratio, old max distance, new max distance. If no output
argument is declared, the function will prompt the user to specify a CSV file
(new or existing, which will be overwritten) to save these measurements.
The first row, either in the CSV file or the scale cell array contains
the repsective column labels "filename"
, "ratio"
,
"oldMaxD"
, and "newMaxD"
.
See also: longbone_maxDistance
Source Code: longbone_Scaling