3D Binary Mask from Points
조회 수: 7 (최근 30일)
이전 댓글 표시
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
답변 (1개)
Walter Roberson
2016년 9월 28일
댓글 수: 2
Walter Roberson
2016년 9월 29일
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!