Making a 2D color map

3 次查看(过去 30 天)
C Berry
C Berry 2012-7-2
I would like to create an image that shows both the intensity and polarization (an angular quantity) as a function of position. I thought that the best way to do this would be as a 2D plot using brightness for intensity and hue for polarization.
How could I create a 2D color map for such a purpose? I can convert intensity and polarization to RGB values without problem, what I need to know is how to actually code that up as something like a ColorMap. The best I've managed to do so far is to plot points individually, but that is horrendously slow. Is it possible to create a 2D color map (as opposed to the usual 1D)?

回答(1 个)

Sean de Wolski
Sean de Wolski 2012-7-2
What you need to have is directly colormapped image that each pixel value point to a row of an nx3 colormap. Here is a simple example:
map = jet(200); % a 200 element colormap
I = zeros(100); %blank image
I(1) = 1; %upper left corner is 1
I = bwdist(I); %value is distance to upper left corner
imshow(I,map);

类别

Help CenterFile Exchange 中查找有关 Modify Image Colors 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by