How to use isosurface to measure volume of the cone??
Ältere Kommentare anzeigen
Using code below , i have measure volume of a cone but i want to measure it using isosuface() i.e. using voxels. Can anyone help me please. I will be very thankful.
Thanks in advance for all help.
Regards
R = 10;
h = 20;
N = 10000;
% Generate points in cone
dx = (pi*R^2*h/3/N)^(1/3);
rvec = linspace(-R,R,ceil(2*R/dx));
hvec = linspace(0,h,ceil(h/dx));
[X,Y,Z] = ndgrid(rvec,rvec,hvec);
is_in_cone = (X.^2+Y.^2) <= (R/h*(h-Z)).^2;
x = X(is_in_cone);
y = Y(is_in_cone);
z = Z(is_in_cone);
% Estimate the volume of the 3D object assuming the object is convex
tri = delaunay(x,y,z);
trisurf(tri,x,y,z)
% indices of triangle
i1 = tri(:,1);
i2 = tri(:,2);
i3 = tri(:,3);
i4 = tri(:,4);
%Volume by summing tetrahedron
v1 = [x(i1)-x(i2) y(i1)-y(i2) z(i1)-z(i2)];
v2 = [x(i1)-x(i3) y(i1)-y(i3) z(i1)-z(i3)];
v3 = [x(i1)-x(i4) y(i1)-y(i4) z(i1)-z(i4)];
A = 1/2*cross(v1,v2,2); % surface of a triangle
V = 1/3*dot(A,v3,2); % volume of a tetrahedron
format long
V = sum(abs(V))
Akzeptierte Antwort
Weitere Antworten (1)
Walter Roberson
am 30 Aug. 2020
0 Stimmen
I absolutely positively would not use isosurface() to measure volumes. It makes the task into a Computer Vision task, requiring that you take screen captures of the surface from several different angles (6 different angles at absolute minimum), and use Stereo Vision techniques to try to reconstruct depths. It is too many unnecessary complications for too low an accuracy.
Do not do this. Find a different approach.
4 Kommentare
M.S. Khan
am 30 Aug. 2020
Bruno Luong
am 30 Aug. 2020
"I absolutely positively would not use isosurface() to measure volumes"
Never said never. The iso surface return an oriented boundary mesh that can be worked out. Just need to be careful about the implicit function that returns all the relevant faces and not extra faces.
"Thanks for reply. could you please suggest any different appraoch. i will be very thankful. "
I did show you 3 other ways of computing the volume: theoretical, convhull, tetrahedron (the code you copy above)... how many methods do you need?
M.S. Khan
am 31 Aug. 2020
M.S. Khan
am 31 Aug. 2020
Kategorien
Mehr zu Image Processing Toolbox finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!