Hi Vignesh,
I realize that you are encountering error while attempting to create a new point cloud, by excluding points with z = -0.5 and z = 0.5.
Upon analysing the data shared, it is evident that the point cloud is unorganised. To clarify, an organized point cloud is structured as a 2-D array of points, whereas an unorganized cloud’s memory layout resembles that of a 1-D array. In this case, you will need to use the “select” function, which operates with linear indices.
Below is a sample code that processes the data you provided and transforms it into a point cloud that meets the specified criteria, presented by two different methods:
- Option-1: Using the index values.
- Option-2: Using the specified condition.
data = readtable("ptCloudsp1.csv");
ptCloud = pointCloud(points);
ptCloudOut1 = select(ptCloud,50:98);
pointsToKeep = (ptCloud.Location(:, 3) ~= 0.5 & ptCloud.Location(:, 3) ~= -0.5);
filteredPoints = ptCloud.Location(pointsToKeep,:);
ptCloudOut2 = pointCloud(filteredPoints);
pcshow(ptCloud, 'MarkerSize', 50);
title('Point Cloud Visualization');
pcshow(ptCloudOut1,'MarkerSize', 100 );
title('Point Cloud Visualization-Option1');
pcshow(ptCloudOut2, 'MarkerSize', 200 );
title('Point Cloud Visualization-Option2');
For more information, please refer the MATLAB documentation link:
- What are organized and Unorganized Point Clouds: https://www.mathworks.com/help/lidar/gs/organized-and-unorganized-point-clouds.html
- “select” function: https://www.mathworks.com/help/vision/ref/pointcloud.select.html
I Hope this helps you to get the required cloud point.