Filter löschen
Filter löschen

Turn a X Y Z matrix into a point cloud

55 Ansichten (letzte 30 Tage)
Sushmitha Kudari
Sushmitha Kudari am 21 Feb. 2020
Kommentiert: Adam Danz am 12 Jan. 2021
I have a matrix as follows for example where the first column is X coordinate, second column is the Y coordinate and third column is the Z coordinate. How can i turn this matrix into a point cloud with pcwrite and pcshow? It has to be in a point cloud format.
[1 8 9; 2 3 4; 9 8 6]
  1 Kommentar
Adam Danz
Adam Danz am 12 Jan. 2021
xyz = [1 8 9; 2 3 4; 9 8 6];
ptCloud = pointCloud(xyz)
ptCloud =
pointCloud with properties: Location: [3×3 double] Count: 3 XLimits: [1 9] YLimits: [3 8] ZLimits: [4 9] Color: [] Normal: [] Intensity: []
pcshow(ptCloud,'MarkerSize',1000)

Melden Sie sich an, um zu kommentieren.

Antworten (3)

Image Analyst
Image Analyst am 21 Feb. 2020
Try
plot3(x, y, z);
or
scatter3(x, y, z);
or, if you have a surface rather than a cloud
surf(x, y, z);
  2 Kommentare
Sushmitha Kudari
Sushmitha Kudari am 21 Feb. 2020
I have to have it in a point cloud format for when I export it.
Image Analyst
Image Analyst am 22 Feb. 2020
I never heard of it but I guess Hiroki has and it seems there is a function to put it into that class. Then you can export it somehow, like using save() to put it into a .mat file. What program are you exporting it for? What program will use this data that you exported? Does that program know how to read in .mat files? If not, what formats does that program know about?

Melden Sie sich an, um zu kommentieren.


the cyclist
the cyclist am 21 Feb. 2020
xyzPoints = [1 8 9; 2 3 4; 9 8 6];
ptCloud = pointCloud(xyzPoints);
  3 Kommentare
Hiroki Okawa
Hiroki Okawa am 21 Feb. 2020
can you please show the error messages?
Sushmitha Kudari
Sushmitha Kudari am 21 Feb. 2020
There is no error message but the plot is a linear line which is incorrect. It is supposed to be topography map.

Melden Sie sich an, um zu kommentieren.


Hiroki Okawa
Hiroki Okawa am 21 Feb. 2020
Bearbeitet: Hiroki Okawa am 21 Feb. 2020
I think that pcshow function will woks
pcshow([1 8 9; 2 3 4; 9 8 6])
By the way, you can convert xyz matrix into point cloud format by pointCloud function
ptCloud = pointCloud(xyzPoints)
in this case,
ptCloud = pointCloud([1 8 9; 2 3 4; 9 8 6])

Community Treasure Hunt

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

Start Hunting!

Translated by