Changing color mapping when rotating a point cloud visualization
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi.
I am facing an issue of the changing color mapping when rotating a point cloud visualization in MATLAB. The below codes are a part of my system, which is showing the color maping for visualization. Please help me how to fix this one.
numLevels = 5;
cmap = jet(numLevels);
normalizedY = (distance-min(distance)) / (max(distance)-min(distance));
colorIndices = ceil(numLevels * normalizedY);
colorIndices(colorIndices < 1) = 1;
colorIndices(colorIndices > numLevels) = numLevels;
colors = cmap(colorIndices, :);
0 Kommentare
Antworten (1)
Diwakar Diwakar
am 8 Jul. 2023
The issue you're facing with changing color mapping when rotating a point cloud visualization in MATLAB is likely due to the fact that the color mapping is based on the distance values, which may change as the point cloud rotates. This can cause the colors to appear different or inconsistent.
To address this issue, you can consider mapping the colors directly to the point cloud vertices instead of relying on the distance values. This way, the colors will remain fixed to the vertices regardless of their position or orientation.
May be this code will help you:
numLevels = 5;
cmap = jet(numLevels);
normalizedY = (distance - min(distance)) / (max(distance) - min(distance));
colorIndices = ceil(numLevels * normalizedY);
colorIndices(colorIndices < 1) = 1;
colorIndices(colorIndices > numLevels) = numLevels;
colors = cmap(colorIndices, :);
% Assuming you have a point cloud represented by vertices
% Assign colors to the vertices
verticesColor = colors;
% Plot the point cloud with colored vertices
scatter3(vertices(:, 1), vertices(:, 2), vertices(:, 3), 10, verticesColor, 'filled');
0 Kommentare
Siehe auch
Kategorien
Mehr zu Point Cloud Processing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!