I have a set of 3D points specifying points on a surface of an object. From these points, i need to construct a 3D logical mask. How can I solve this with matlab? Hope to get some insights.
If you have the "Curve Fitting Toolbox" you could fit a surface formula to the data. And if you now the exact type (like a ball, cone, ...) you can define that as formular to fit to.
Maybe you can provide some example data.
% parameters
num_coordinates = 100;
max_coordinate = 20;
% generate random coordinate
x = sort(randi(max_coordinate, [num_coordinates, 1]));
y = sort(randi(max_coordinate, [num_coordinates, 1]));
z = sort(randi(max_coordinate, [num_coordinates, 1]));
% create the mask
mask = false(max_coordinate, max_coordinate, max_coordinate);
for k = 1 : length(x)
mask(x(k), y(k), z(k)) = true;
end
If speed is important, I suppose there is a faster solution.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.