Azzera filtri
Azzera filtri

How to select points in Point Cloud based on rows and columns?

7 visualizzazioni (ultimi 30 giorni)
Hi,
I want to select points in pointcloud based from row 49 to 58 (three columns - corresponding to xyz values of points in point cloud). I have tried using ptCloudOut = select(ptCloudsp,row,column) as ptCloudOut = select(ptCloudsp,50:98,1:3). But it does not work (Error: The input point cloud must be organized (M-by-N-by-3)) . Please let me know how to store points based on rows and columns in point cloud.
Thanks,
Vignesh
  2 Commenti
Vignesh
Vignesh il 9 Feb 2024
In my case, I believe I have unorganised point cloud as it is M by 3 array. M - No. of points and array provides xyz position.
Vignesh
Vignesh il 9 Feb 2024
Please find the csv file which has the locations of points which I convert to pointcloud in matlab. I want to create points with z = 0 (I dont want z = -0.5 and 0.5 in my new point cloud). Please let me know how to create new pointcloud omitting the points with z = -.05 and z =0.5

Accedi per commentare.

Risposta accettata

Arun
Arun il 20 Feb 2024
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:
  1. Option-1: Using the index values.
  2. Option-2: Using the specified condition.
data = readtable("ptCloudsp1.csv");
x = data.Var1;
y = data.Var2;
z = data.Var3;
points = [x y z];
ptCloud = pointCloud(points);
%option 1
ptCloudOut1 = select(ptCloud,50:98);
%option 2
pointsToKeep = (ptCloud.Location(:, 3) ~= 0.5 & ptCloud.Location(:, 3) ~= -0.5);
filteredPoints = ptCloud.Location(pointsToKeep,:);
ptCloudOut2 = pointCloud(filteredPoints);
% Plot the pointCloud data.
figure;
pcshow(ptCloud, 'MarkerSize', 50);
title('Point Cloud Visualization');
xlabel('X');
ylabel('Y');
zlabel('Z');
figure;
pcshow(ptCloudOut1,'MarkerSize', 100 );
title('Point Cloud Visualization-Option1');
xlabel('X');
ylabel('Y');
zlabel('Z');
figure;
pcshow(ptCloudOut2, 'MarkerSize', 200 );
title('Point Cloud Visualization-Option2');
xlabel('X');
ylabel('Y');
zlabel('Z');
For more information, please refer the MATLAB documentation link:
  1. What are organized and Unorganized Point Clouds: https://www.mathworks.com/help/lidar/gs/organized-and-unorganized-point-clouds.html
  2. “select function: https://www.mathworks.com/help/vision/ref/pointcloud.select.html
I Hope this helps you to get the required cloud point.

Più risposte (0)

Prodotti


Release

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by