필터 지우기
필터 지우기

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

조회 수: 7 (최근 30일)
Vignesh
Vignesh 2024년 2월 9일
댓글: Vignesh 2024년 2월 23일
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
Vignesh
Vignesh 2024년 2월 9일
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 2024년 2월 9일
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

댓글을 달려면 로그인하십시오.

채택된 답변

Arun
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:
  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.
  댓글 수: 1
Vignesh
Vignesh 2024년 2월 23일
Hi Arun,
Thanks for clarifying my doubts and answering the questions!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Point Cloud Processing에 대해 자세히 알아보기

제품


릴리스

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by