How to change the color of model obtained from pcfitsphere

Hello everyone,
I am beginner to Matlab and would like some suggestion on how to change the colour of the model (obtained form [model,inlierIndices,outlierIndices] = pcfitsphere(ptCloudIn,maxDistance)) as it is making the analysis of the point cloud and the sphere extremely difficult.
Thanks in advance

 Akzeptierte Antwort

Mehmed Saad
Mehmed Saad am 10 Mär. 2021
load('object3d.mat');
figure
pcshow(ptCloud)
xlabel('X(m)')
ylabel('Y(m)')
zlabel('Z(m)')
title('Original Point Cloud')
maxDistance = 0.01;
roi = [-inf,0.5,0.2,0.4,0.1,inf];
sampleIndices = findPointsInROI(ptCloud,roi);
[model,inlierIndices] = pcfitsphere(ptCloud,maxDistance,...
'SampleIndices',sampleIndices);
globe = select(ptCloud,inlierIndices);
hold on
plot(model)
Now if you want to change the color of figure and axis just wirte
i am setting it to white, you can chose your color
set(gcf,'Color','w')
set(gca,'Color','w')

4 Kommentare

Thanks. But I want to make the color of the sphere uniform from a multi-coloured sphere.
obj_1 = findobj(gca,'type','Surface')
obj_1 =
Surface with properties:
EdgeColor: [0 0 0]
LineStyle: '-'
FaceColor: 'flat'
FaceLighting: 'flat'
FaceAlpha: 1
XData: [31×31 single]
YData: [31×31 single]
ZData: [31×31 single]
CData: [31×31 single]
Show all properties
You can change its properties.
set(findobj(gca,'type','Surface'),'FaceColor','y')
Thanks. It worked

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by