绘制点云数据的图表

时间:2016-08-30 14:37:58

标签: matlab plot point-clouds

(示例)点云数据

考虑矩阵N x 36,其中N是点云数据(3D对象)中的点数,36列表示提取的最后3列为(x,y)的特征,z)每个点的坐标值。

现在我希望在这方面进行特征分析我想知道如何在计算它们的(x,y,z)坐标上绘制/表示/描述f1,f2,...f33的每个特征? (了解特征的行为)

这可能吗?怎么样?如果没有,有什么替代方案?

例如:找到包含NX5的2个要素文件bunny_example,其中N是点数,1st2nd列是要素1f1,f21和{ {1}} 3rd列为5th个坐标值。

1 个答案:

答案 0 :(得分:0)

此代码可以帮助您:

ClassLoader

备注:

  1. 您可以根据需要更改% Provided example data features = [2.0684e-05 7.5750e-06 3.8389e-05 1.0346e-05 -8.3302e-06; 0.0002 -1.7019e-05 -0.0002 -3.8879e-05 8.1841e-05; -2.3888e-05 -3.5798e-05 2.0476e-05 -4.7382e-05 3.8213e-05; 7.7594e-06 2.9854e-06 3.0756e-05 -1.9135e-06 1.3463e-05; 3.4250e-05 5.6627e-06 7.3759e-06 -8.1303e-05 -1.5577e-05; 4.7731e-06 4.9014e-06 2.5750e-05 2.3827e-06 6.2936e-06; 2.4317e-05 0.0007 3.1783e-05 0.0001 -0.0001; 2.6632e-05 0.0009 0.0001 0.0001 -0.0005; -1.9714e-05 -1.2456e-06 5.5657e-06 1.8092e-05 1.3787e-05]; points = [-0.6011 -0.9712 0.3268; -0.5721 -0.9712 0.3379; -0.5721 -0.9854 0.32794; -0.5817 -0.948 0.3298; 0.0708 -0.583 -0.2528; -0.5721 -0.9429 0.32794; -0.312 -0.9940 0.4074; -0.286 -0.994 0.4174; -0.0864 0.4534 -0.7729]; % To create the colormap - like heatmap initial_hsv = [0 1 1]; % red final_hsv = [2/3 1 1]; % blue point_size = 10; max_hsv = max([initial_hsv; final_hsv]); min_hsv = min([initial_hsv; final_hsv]); dif_hsv = max_hsv - min_hsv; % For each feature for f = 1 : size(features, 2) f_max = max(features(:, f)); f_min = min(features(:, f)); c_data = zeros(size(points, 1), 3); % For each point for p = 1 : size(points, 1) for hsv_comp = 1:3 if dif_hsv(hsv_comp) != 0 % Logaritmic mapping c_data(p, hsv_comp) = (1 - ((log(features(p, f)+abs(f_min)+1) - log(f_min+abs(f_min)+1)) / (log(f_max+abs(f_min)+1) - log(f_min+abs(f_min)+1)))) * dif_hsv(hsv_comp) + min_hsv(hsv_comp); else c_data(p, hsv_comp) = min_hsv(hsv_comp); end end end % Converting to HSV c_data(:,:) = hsv2rgb(c_data(:,:)); % Creating a figure for each feature str = sprintf('Feature number %d' , f); figure scatter3(points(:,1), points(:,2), points(:,3), point_size*ones(size(points,1),1), c_data); title(str) end inital_hsvfinal_hsv的值。
  2. 也可以更改计算point_size的方式(在此示例中使用的是logaritmic mapping),以便根据您的要素数据进行更平滑的颜色转换。