HSV heatmap from RGB image

15 views (last 30 days)
riane on 20 Nov 2021
Commented: Image Analyst on 23 Nov 2021
How do I get the HSV heatmap shown in the picture below? According to the source, "hue saturation value (HSV) heat map (is) produced from grayscale image". So do I use rgb2gray and then after that what?
Also, sorry, as you can tell, I'm a beginner at MATLAB.

Accepted Answer

Image Analyst
Image Analyst on 20 Nov 2021
If you have a super low contrast RGB image with horrendous shading (light falling off from the center) as shown in your comment, first I'd try to estimate the background to flatten the image and get rid of the shading. So divide your image by your estimated background image to get a flattened image. Then I'd use imadjust() to increase the contrast to make it easier to see. I think that seeing an enhanced original color image would be preferable to converting it to grayscale and then pseudocoloring a gray scale image with some artificial and arbitrary colormap, don't you? Why would you want fake colors rather than the "real" ones?
  1 Comment
riane on 22 Nov 2021
That totally makes sense! I'd be honest I was doing blindly on this one and just simply following the steps from some random literature paper that I read.

Sign in to comment.

More Answers (1)

DGM on 20 Nov 2021
If all you want is to apply a colormap to a monochrome image, then:
A = imread('cameraman.tif');
If you want something else, then you'll have to clarify.
Image Analyst
Image Analyst on 23 Nov 2021
OK so you should use the Blue Channel for any UV that managed to be detected by the sensor, and the red channel for the IR image:
[uvImage, unusedGreenChannel, IRImage] = imsplit(rgbImage);
You should probably not use the green channel -- it will most likely be all black anyway since your filters block any green light from the sensor.
Again pseudocoloring the UV image and IR image (say maybe to shades of blue and red, respectively) will not help the image analysis but may give you a visual effect on the display that you like.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!

Translated by