MATLAB Answers


How to create point cloud with colour

Asked by Ryan
on 7 Mar 2014
Latest activity Commented on by Anirban Roy on 28 Aug 2015


I am trying to export a pointcloud as a .ply or .wrl to view in another program such as Meshlab. I have two arrays of equal size (vertices and colors(RGB)) . I can create a mesh using the vertices array, but when viewing the pointcloud it is monochrome. So, my question is how do I add the colour values to the vertices, to end up with a color appropriate pointcloud? I've looked into texture mapping, but I have not been successful with the surf and mesh functions. Any help is appreciated.

  1 Comment


1. " pointCloud": This makes a point cloud from 3D points and texture

ptCloud = pointCloud(xyzPoints, 'Color', alignedColorImage); % 3D colored point cloud

Then use

2. " pcwrite": This exports the point cloud as a PLY file with color informatoion

pcwrite(ptCloud,'Ply_file_name','PLYFormat','binary'); % Convert to .PLY format

Hope this helps


Log in to comment.


No products are associated with this question.

1 Answer

Answer by Walter Roberson
on 7 Mar 2014

patch() allows you to assign vertex color.

Or, more directly, scatter3(x, y, z, pointsize, color)


Walter, thanks for the quick reply, I ended up using fscatter3 to add colour to the pointcloud, the values get saved as a 1x256 matrix. But now, how can I export it as a .wrl, .ply, or even .stl for use in another program?

Hi Ryan, do you find a way to export as ply/wrl the colored mesh ? VBR

Log in to comment.

Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!