# 3D Point Cloud - Gaussian Curvature

51 views (last 30 days)
RiHo on 25 Nov 2019
Commented: darova on 4 Dec 2019
Hello All.
I have a 3D point cloud data (X [m]; Y[m]; Z[m]). And I want to calculate the value of some curvature (e.g. gaussian) in every point of the point cloud. Based on these curvature information I would select the points, that may belong to some geometric shape in the point cloud (e. g. to some planes, spheres etc.).
Is there a built in function for it in Matlab, like normals() for normal vector estimation? Or does anyone know a way how to do this? It should be fast and dont need to be really precise, because it is only a pre-processing step.
Richard

darova on 26 Nov 2019
one way
clc,clear
% generate some data
r = 3;
t = linspace(0,10)';
x = r*cos(t);
y = r*sin(t);
z = sin(1*t);
t1 = t(2:end) - diff(t)/2;
dv = diff([x y z])./diff([t t t]); % first derivative at midpoints
d2v= diff(dv)./diff([t1 t1 t1]); % second derivative at points [2:end-1]
dv = 1/2*( dv(1:end-1,:) + dv(2:end,:) );% first derivative at points [2:end-1]
[dx,dy,dz] = deal( dv(:,1),dv(:,2),dv(:,3) );
[d2x,d2y,d2z] = deal( d2v(:,1),d2v(:,2),d2v(:,3) );
% curvature
kk = (d2z.*dy - d2y.*dz).^2 + (d2x.*dz - d2z.*dx).^2 + (d2y.*dx - d2x.*dy).^2;
kk = sqrt(kk) ./ (dx.^2+dy.^2+dz.^2).^(3/2);
RR1 = 1./kk;
plot(t(2:end-1),RR1)

darova on 4 Dec 2019
Can you create a surface from the point cloud? Can you use surfnorm?
RiHo on 4 Dec 2019
I dont think so, because scanned point clouds have really rugged surface, like when you imagine point cloud of complex objects like buildings and so on. There are lot of complicated surfaces.
That's why I'm fitting a local small plane in every point for point normal vector computation, like in pcnormals.
darova on 4 Dec 2019
If you can get normals for neighbouring points:
alpha = acos(dot(n1,n2));

R2019b

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!