필터 지우기
필터 지우기

Changing color mapping when rotating a point cloud visualization

조회 수: 3 (최근 30일)
Yar Pyae Aung
Yar Pyae Aung 2023년 7월 8일
답변: Diwakar Diwakar 2023년 7월 8일
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, :);

답변 (1개)

Diwakar Diwakar
Diwakar Diwakar 2023년 7월 8일
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');

카테고리

Help CenterFile Exchange에서 Point Cloud Processing에 대해 자세히 알아보기

태그

제품


릴리스

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by