Artifacts appear on my matlab image

조회 수: 4 (최근 30일)
Tina
Tina 2024년 8월 20일
댓글: Tina 2024년 8월 23일
Hello everyone,
I wrote a matlab program to process my data, the results and in the form of image of different colors. The color scale is a choice and this is the problem, because when I use a colormap with 3 different colors I don't have this artifact that appears but when I use the one with the rainbow colors the artifact appears. I'm attaching the image and the code snippet for the colormap. Do you have any idea why I'm having this problem? How can I fix it?
  댓글 수: 1
Cris LaPierre
Cris LaPierre 2024년 8월 20일
편집: Cris LaPierre 2024년 8월 20일
k = [0 0 0]; %# start
p = [1 0 1];
n = [0 0 1];
b = [0 1 1];
g = [0 1 0]; %# middle
y = [1 1 0];
r = [1 0 0];
z = [0 0 0];%# end
% Colormap de taille 64x3, dégradée en arc-en-ciel
cl = zeros (32,3); c2 = zeros (32,3); c3 = zeros (32,3); c4 = zeros (32,3);
c5 = zeros (32,3); c6 = zeros (32,3); c7 = zeros (32,3);
for i = 1:3
cl(:,i) = linspace (k(i), p(i), 32);
c2(:,i) = linspace (p(i), n(i), 32);
c3(:,i) = linspace (n(i), b(i), 32);
c4(:,i) = linspace (b(i), g(i), 32);
c5(:,i) = linspace (g(i), y(i), 32);
c6(:,i) = linspace (y(i), r(i), 32);
c7(:,i) = linspace (r(i), z(i), 32);
end
% Combinaison de toutes les parties sans doublons
c = [cl(1:end-1,:); c2(1:end-1,:); c3(1:end-1,:); c4(1:end-1,:); c5(1:end-1,:); c6(1:end-1,:); c7];
% Afficher la surface
surf (peaks), shading interp
caxis([-1 1])
colormap(c)
colorbar

댓글을 달려면 로그인하십시오.

답변 (1개)

Cris LaPierre
Cris LaPierre 2024년 8월 20일
We'd have to see your code for 3 colors to say for certain, but here, your colormap sets anything above or below abs(1) to [0 0 0], or black. We don't have your processed data, but it would appear the region of the artifact must contain absolute values >= 1.
  댓글 수: 14
Cris LaPierre
Cris LaPierre 2024년 8월 21일
Great to hear. I've edited your post so that your code runs here as well, showing no artifact.
Tina
Tina 2024년 8월 23일
Thank you very much for your invaluable help.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 White에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by