Azimuth data: Colormap wrapping when performing interpolation
4 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Shunichi Kusano
2019-2-21
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 个评论
更多回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Orange 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!