I have a XYZRGB
-formatted point cloud data. The file size is huge and it consists of hundreds of thousands of points. How can I decrease the density of points? Say for each 10 neighbors, I want to have a single point average of all other points (both XYZ and RGB). Any piece of code in Java or Matlab is welcome. Here is a sample .ply point cloud file you can work on: https://drive.google.com/open?id=0B667VfPLdu3_RVpKV1liZ0ktRVU
I was trying some interpolation in Matlab as below. But this is not what I want. I need to decrease density.
% Load Point Cloud:
Point_Cloud = importdata(‘Point_Cloud_1.txt')
x = Point_Cloud(1,:)';
y = Point_Cloud(2,:)';
z = Point_Cloud(3,:)';
% Interpolate inspection points:
Density = 300;
[X,Y] = meshgrid(linspace(min(x), max(x), Density), linspace(min(y), max(y), Density));
F = scatteredInterpolant(x, y, z, 'natural','linear');
Z = F(X,Y);
Int_PC = [reshape(X,Density^2,1) reshape(Y,Density^2,1) reshape(Z,Density^2,1)];
Int_PC(any(isnan(Int_PC{i}),2),:) = [];
% Plot results:
scatter3(x, y, z, 20, 'r', 'fill'); % Original data
hold on;
scatter3(Int_PC(:,1), Int_PC(:,2), Int_PC(:,3), 20, 'r', 'fill'); % Interpolated data