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.
How to select points in Point Cloud based on rows and columns?
조회 수: 4 (최근 30일)
이전 댓글 표시
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
채택된 답변
Arun
2024년 2월 20일
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");
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:
- 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.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Point Cloud Processing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!