3D Binary Mask from Points
7 views (last 30 days)
Show older comments
I'm trying to create a binary mask (1 inside the object and 0 outside the object) from some Collada files. This file https://www.mathworks.com/matlabcentral/fileexchange/45687-colladaparser helped me convert the actual .dae files into "tri - contains a 3xNumTri list of vertices that form triangles" and "vertex - contains a list vertices used (Nvertices x 3)."
Now I need to create a binary mask (that is maybe 100 x 250 x 100), or something of that magnitude) where the value of the logical matrix is 1 inside and 0 outside the 3d object created by these points and faces (with the ultimate goal of creating a signed distance function whose zero level set represents the 3d object). Does anyone have any ideas how to create the binary mask or even just the signed distance function itself?
Note that I wouldn't mind using a different 3d object file format (like .obj or .3ds), but I still need to end up with a signed distance function. And the packages I've tried for .obj and .3ds do not work.
0 Comments
Answers (1)
Walter Roberson
on 28 Sep 2016
2 Comments
Walter Roberson
on 29 Sep 2016
The general case is:
sets = {x, y, z}; %adjust this for situation
nset = length(sets);
[T1{1:nset] = ndgrid(sets{:});
output = zeros(numel(T1{1}), nset, class(T1{1}));
for K = 1 : nset
output(:,K) = reshape(T1{K}, [], 1);
end
clear T1
For the 3D case you can use
[T1, T2, T3] = ndgrid(x, y, z);
output = [T1(:), T2(:), T3(:)];
clear T1 T2 T3
See Also
Categories
Find more on Migrate GUIDE Apps in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!