Info
此问题已关闭。 请重新打开它进行编辑或回答。
Set a colour to a value in image processing
1 次查看(过去 30 天)
显示 更早的评论
I have a color map, which is attached, has 7 regions (A_1, A_2, A_3, B_1, B_2, C_1 and C_2). The locations of these regions are fixed on the map (x and y are constant). Also I have values (numbers) ,which represent other variables for these regions, that are
C_2 1
C_1 0.49534
B_2 0.35648
B_1 0.35444
A_3 0.20162
A_2 0.09704
A_1 0.09481
I want to represent these number as colours on the map. Let's say C_2 is the highest so it can be represented in red colour while C_1 should be represented by another colour depending on its value and so on so forth. These numbers can change from run to another and that should be represented on the map as changes in the colours only not locations.
6 个评论
回答(2 个)
Image Analyst
2015-11-13
Just create a colormap with 8 colors - the 7 you want plus white for "the background". Then apply it.
C_2 = 1
C_1 = 0.49534
B_2 = 0.35648
B_1 = 0.35444
A_3 = 0.20162
A_2 = 0.09704
A_1 = 0.09481
indexedImage(1:30,1:30) = C_2;
indexedImage(1:30,31:60) = C_1;
indexedImage(1:30,61:90) = B_2;
indexedImage(31:60,1:30) = B_1;
indexedImage(31:60,31:60) = C_2;
indexedImage(31:60,61:90) = A_3;
indexedImage(61:90,1:30) = A_2;
indexedImage(61:90,31:60) = A_1;
imshow(indexedImage, [], 'InitialMagnification', 800);
axis on;
colormap(jet(256));
colorbar;
Your numbers are not equally spaced and so some have very similar colors. You might have to do precision surgery on your colormap to make it how you like, but honestly, it might be better to just create an RGB image with known colors.
4 个评论
Image Analyst
2015-11-14
Sorry - I'm not following. Why don't you just make up an RGB image with squares of the colors you want? It's not that hard. Anyway, good luck.
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!