Azimuth data: Colormap wrapping when performing interpolation
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
William Thielicke
el 18 de Feb. de 2019
Respondida: William Thielicke
el 21 de Feb. de 2019
Hello,
I have a problem with interpolating a colormap for azimuth / circular data... Please check the attached images: The colormap (HSV) represents the direction of the vectors (ranging from -180 to +180 degrees). Red is left, cyan ist right, greenish is up and purple is down.
For several reasons, I would like to create a smooothed graphical output. That is why I upscale the dataset using the function 'imresize'.
But the result gives a strong line when the direction changes from -180 to +180 (for reasons that I understand, but I can't think of a workaround...).
Does someone have an idea how to prevent this colormap wrapping...? Thanks!!
0 comentarios
Respuesta aceptada
Shunichi Kusano
el 21 de Feb. de 2019
As you noticed, phase is discontinuous function. One can convert this to the continuous function, for example, by using cosine and sine functions, for which interpolation works.
%% generate original phase image
x = -1:0.1:1; % original x-coordinate
y = -1:0.1:1; % original y-coordinate
[X, Y] = meshgrid(x,y);
phase = angle(complex(X,Y)) * 180 / pi;
imagesc(phase);
colormap hsv;
% not-correct
figure,imagesc(imresize(phase, [100,100])),colormap hsv;
% phase is converted by cos and sin.
X = cos(phase/180*pi);
Y = sin(phase/180*pi);
% interpolation
X_interp = imresize(X, [100, 100]);
Y_interp = imresize(Y, [100, 100]);
% re-convert to phase
phase_interp = angle(complex(X_interp,Y_interp)) * 180 / pi;
figure, imagesc(phase_interp), colormap hsv;
hope this helps.
0 comentarios
Más respuestas (1)
Ver también
Categorías
Más información sobre Orange en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!