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

1 次查看(过去 30 天)
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.

采纳的回答

Walter Roberson
Walter Roberson 2016-2-19
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 个评论
Walter Roberson
Walter Roberson 2016-2-20
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)

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Images 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by