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!!
azimuth_data.jpg

채택된 답변

Shunichi Kusano
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.

추가 답변 (1개)

William Thielicke
William Thielicke 2019년 2월 21일
ThabkThank you veryvery much for your helphelp!

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by