How to create custom color wheel for velocity data stored as RGB and only using R/G channels?

조회 수: 1 (최근 30일)
I have velocity field data stored in RGB format where R = angle and G = amplitude/magnitude. I am wanting to create a custom color wheel with the following:
R: [0 1] where 0.5 = 0 degrees
G: [0 1] where the values increase going from the center to edge of circle
B: unused / zero
Does anyone have any suggestions on how to go about this? I would like it to be cyclic (i.e. smooth transition in colors at -pi and pi). Thank you in advance.

채택된 답변

darova
darova 2021년 4월 2일
What about this?
[R,G] = ndgrid(0:10:360,0:1); % polar coordinates
[X,Y] = pol2cart(R*pi/180,G); % convefrt o cartesian
Z = sind(R/2);
pcolor(X,Y,Z)
  댓글 수: 3
darova
darova 2021년 4월 3일
Create your own color map
[T,R] = ndgrid(0:10:360,0:5); % polar coordinates
[X,Y] = pol2cart(T*pi/180,R); % convefrt o cartesian
[m,n] = size(R);
[r1,g1] = ndgrid((1:m)/m,(1:n)/n); % red and green channels
surf(X,Y,X*0,cat(3,r1,g1,r1*0)) % surf with user colormap
view(0,90)
Mat576
Mat576 2021년 4월 8일
Thank you! A few small tweaks got me to what I needed:
[T,R] = ndgrid(-180:180,0:(Vmax/256):Vmax);
[X,Y] = pol2cart(T*pi/180,R);
[m,n] = size(R);
[r1,g1] = ndgrid((1:m)/m,(1:n)/n);
wheel = surf(X,Y,X*0,cat(3,r1,g1,r1*0));
axis off
wheel.EdgeColor = 'none';
view(0,90)
Now to get this plotted on the corner of the velocity-field image, haha!

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

추가 답변 (0개)

카테고리

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by