Borrar filtros
Borrar filtros

Changing color mapping when rotating a point cloud visualization

3 visualizaciones (últimos 30 días)
Yar Pyae Aung
Yar Pyae Aung el 8 de Jul. de 2023
Respondida: Diwakar Diwakar el 8 de Jul. de 2023
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, :);

Respuestas (1)

Diwakar Diwakar
Diwakar Diwakar el 8 de Jul. de 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');

Categorías

Más información sobre Point Cloud Processing en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by