Effacer les filtres
Effacer les filtres

How can I assign a particular color to all the pixels having temperature above a certain value in a thermal image?

4 vues (au cours des 30 derniers jours)
I have a thermal image in .csv format. What I want to do is highlight the areas having temperature above a certain value. I am looking for a way to assign a particular color to all pixels having temperature above my reference and display the final result.

Réponse acceptée

Walter Roberson
Walter Roberson le 19 Fév 2016
Create a colormap that has that highlight color as the last row. image() or imagesc() the data. caxis() with the threshold as the upper bound. Any value beyond that bound will map to the last color in the table.
For example,
cmap = colormap(copper(128));
cmap(end,:) = [0 1 1]; %highlight color
image(YourData)
colormap(cmap)
caxis([0 87.23])
everything from 87.23 onwards would be mapped to the top color
  4 commentaires
Walter Roberson
Walter Roberson le 20 Fév 2016
No, this is a technique that only works for assigning a special color for high values or low values.
If you want to color according to range of temperatures, use histc() or histcounts() to generate a group number (a positive integer) for each location, and use the group number as the color information. The group number will then be an index into your colormap. For example,
[~, groupnum] = histc( YourData, [-inf, -50, -37, -1, 22, 158, inf]);
image(groupnum)
colormap(hsv(6))
The first color would be everything < -50, the second color would be -50 <= x < -37, the third color would be -37 <= x < -1, the fourth color would be -1 <= x < 22, the fifth color would be 22 <= x < 158, the sixth color would be 158 <= x. (Technically, with histc there would also be a 7th color if any of the data was itself inf)
Sudhanshu Goel
Sudhanshu Goel le 26 Fév 2016
I just saw your comment. Thanks a ton. This is really helpful.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Convert Image Type dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by