## 3D mesh transform using sparse control points

version 1.0.0.0 (4.11 KB) by
Performs a 3D non-rigid deformation using irregularly placed transformation vectors

Updated 06 Oct 2014

Written by Daniel Markel 2014
this function performs a non-rigid deformation based on a 3D interpretation of the algorithm described by
Wang Y., Lee O., "Use of two-dimensional deformable mesh structures for video coding, part 1 - the synthesis problem: mesh-based function approximation and mapping", IEEE transactions on circuits and systems for video technology, Vol. 6, No. 6 (1996).
This does not require the transformation vectors to be regularly spaced as is the case with every version of the interp3 function. Currently using Matlab2014a the code takes about 5.6 seconds to run on a 136x301x91 sized volume. If anyone wishes to try and improve the performance using mex or CUDA by all means give it a shot. The current code does not run on the GPU. I'm putting this up simply because this function does not exist for Matlab elsewhere as far as I've seen.
Inputs
im -- the 3D volume being transformed
bold -- a 3xn matrix describing the initial (x,y,z) coordinates of the
control points where n is the number of control points
bnew -- a 3xn matrix describing the final (x,y,z) coordinates of the
control points
tmesh -- a mx4 matrix of the connectivity structure for each tetrahedron
connecting the control points, see delaunay for the output.
X,Y,Z -- coordinate matrices output from meshgrid for the size of im.

Outputs
imT -- the warped image
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
acknowledgements -- code makes heavy use of the inhull function written by
John D'Errico (2006). Special thanks to Piotr Pater
for assistance in improving the efficiency of the code.

### Cite As

Daniel Markel (2022). 3D mesh transform using sparse control points (https://www.mathworks.com/matlabcentral/fileexchange/48044-3d-mesh-transform-using-sparse-control-points), MATLAB Central File Exchange. Retrieved .

##### MATLAB Release Compatibility
Created with R2014a
Compatible with any release
##### Platform Compatibility
Windows macOS Linux