Set a colour to a value in image processing
Información
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
Mostrar comentarios más antiguos
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 comentarios
Ahmed Alsaadi
el 13 de Nov. de 2015
Ahmed Alsaadi
el 13 de Nov. de 2015
Ahmed Alsaadi
el 13 de Nov. de 2015
Ahmed Alsaadi
el 13 de Nov. de 2015
Ahmed Alsaadi
el 13 de Nov. de 2015
Image Analyst
el 13 de Nov. de 2015
Would you like some help? I'm not sure.
Respuestas (2)
Image Analyst
el 13 de Nov. de 2015
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 comentarios
Ahmed Alsaadi
el 13 de Nov. de 2015
Image Analyst
el 13 de Nov. de 2015
I thought that your image was composed of those discrete, specific values in that list, and ONLY values in that list? Is that not true? Can there be other values as well, like a whole continuum of values?
If those values are merely the maximum values that will occur, and there could be millions of floating point values between zero and that max, then do you want a continuous colormap with the only requirement that Red be at the top value, and the other values get redder as the approach the top value, whatever that top value might be?
Ahmed Alsaadi
el 13 de Nov. de 2015
Image Analyst
el 14 de Nov. de 2015
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.
Ahmed Alsaadi
el 14 de Nov. de 2015
0 votos
La pregunta está cerrada.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!