How to create heat maps from an image?

Can anyone guide me how to create color-coded heatmaps based on the method below? I have been able to create a logical image and need help in creating the heat maps:
A map was generated by computing area within each 16x16 pixel sampling window over the logical image. In the map, bright red indicates a higher values, dark blue indicates lower values, and intermediate values are represented in a spectrum of yellow to green.

 Accepted Answer

Sounds like they're simply computing the local average, something you can do with conv2()
windowSize = 17;
kernel = ones(windowSize) / windowSize^2;
out = conv(double(grayImage), kernel, 'same');

7 Comments

Thanks for this answer. However, given that gray2rgb does not work, how do you color code the kernel filtered image?
There is no gray2rgb() function. You'd do this:
rgbImage = cat(3, grayImage, grayImage, grayImage);
I don't know what "color code the kernel filtered image" means. If you want you can call colormap():
imshow(out);
colormap(handleToAxes, hsv(256));
Otherwise explain what you want, because I have no idea.
It worked. Thank you so much Image Analyst!
I already have a heated map which I exported it from another program .But I need to upload the heated map pictures with color bar and then I should compare them to see which one has the greatest magnitude. The code must shows the hottest spots for each pictures ,also it needs to tell which picture have the greatest magnitude. Can anyone help me with this code? Is there any releated code which can helps me ?
@Elif, sure, we can help with that. Start a new question and upload at least two of the exported/colorbar images. Have you seen my thermal demo? Where I get temperatures from a pseudocolored image with colorbar? I'll show you in your new question after you post it.
@Elif, I posted an answer to your new question in that thread.

Sign in to comment.

More Answers (0)

Categories

Asked:

DK
on 14 Dec 2017

Commented:

on 2 Aug 2021

Community Treasure Hunt

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

Start Hunting!