How to format surface data into XYZ point cloud?

I have a .csv data set that is 10x22 surface data and i'd like to convert it to XYZ point cloud. What is the best way to do this in Matlab?

댓글 수: 3

Luna
Luna 2019년 1월 4일
Could you please share your .csv file and what have you done so far?
Walter Roberson
Walter Roberson 2019년 1월 4일
편집: Walter Roberson 2019년 1월 5일
to confirm you want a 3d pointcloud with 220 points ?
do you have the marginal coordinates , 10 y and 22 x?
What determines Z in your surface?

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

 채택된 답변

Walter Roberson
Walter Roberson 2019년 1월 5일

2 개 추천

vector_of_x = as appropriate
vector_of_y = as appropriate
[X, Y] = meshgrid(vector_of_x, vector_of_y);
points = [X(:), Y(:), z(:)];
ptCloud = pointcloud(points);

댓글 수: 3

z = csvread('Example data.csv');
vector_of_x = 1:size(z,2);
vector_of_y = 1:size(z,1);
[X, Y] = meshgrid(vector_of_x, vector_of_y);
points = [X(:), Y(:), z(:)];
ptCloud = pointCloud(points);
Hi,
I need to do the exact same thing but I don't have the Image Processing Toolbox. Is there a 'vanilla' way of doing this?
pointCloud is part of the Computer Vision Toolbox
pointCloud() is a particular data type in MATLAB. If you do not have Computer Vision, then you cannot create the datatype, so it is not clear what you want to do? If you just want an array of three columns, X, Y, Z, and you are starting from a 2D array, then use the code I posted but stop after the assignment to points

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

추가 답변 (2개)

Cris LaPierre
Cris LaPierre 2019년 1월 4일

0 개 추천

If you can successfully create a surface with your data using surf(X,Y,Z), the best way to create an X,Y,Z point cloud is to use scatter3(X,Y,Z).

댓글 수: 4

surf permits vector x and y with array z. scatter3 requires vector x and y and z. If you have the marginal values then meshgrid or ndgrid to get array X and array Y and then work with X(:) Y(:) z(:)
Good point!
I create a surface from the data i have. How to get the Z value of the surface with using only random x and y cordinates
Don jaya, could you describe what your available inputs are, and what outputs you want?

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

flemingtb
flemingtb 2019년 1월 7일

0 개 추천

I've attached the data file. I need to convert this format to XYZ columns.
All that i have done so far is to get size data to know how many rows and columns the data sets have, i don't know how to format the data based on it's location in the point map though.

댓글 수: 3

We can help you format it, but can you describe your data? How would you create a point cloud from your CSV data? Specifically, what would you X, Y and Z data be? Is your CSV the Z values and the column number your X and the row number your Y?
Yes that is correct, column number is (X), Row number is (Y) and (Z) data. Maybe i didn't call it the correct thing.
See walter's answer.

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

카테고리

태그

질문:

2019년 1월 4일

댓글:

2020년 5월 12일

Community Treasure Hunt

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

Start Hunting!

Translated by