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

1 visualizzazione (ultimi 30 giorni)
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.

Risposta accettata

Walter Roberson
Walter Roberson il 19 Feb 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 Commenti
Walter Roberson
Walter Roberson il 20 Feb 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)

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Images in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by