How to cluster heat maps?

Hi,
I have some contour heatmaps with 5 or 6 categorized pressure points for different channels (y-axis). The yellow shade means high pressure and blue is lower end. I was wondering if there is already an algorithm which clusters the heat maps into groups. For instance the one I am pasting here has some patches of yellow and I have some more similar graphs. Now I want that my algorithm should categorize them according to some cluster it defines intuitively or explicitly. So it gives me a "n" number of different clusters for lets say 100 plots and then I can work on it or optimize it if possible. Please help. Thank you so much.

Answers (1)

Perhaps you just want to threshold top get a binary image of each pressure range.
pressureRange1 = pressureImage >= lowThreshold & pressureImage <= highThreshold;
or perhaps you want to use imquantize(). Then you can call colormap() to colorize the quantized image.

6 Comments

Hi, thank you for the answer. How should I use imquantize(). I will reiterate what I wanted to say if I did not make myself clear :) Suppose the yellow and blue patches are nearly at the same area my code should categorize those two plots in the same cluster.
I'm assuming that you had some gray scale image and then, by some process, you created this labeled image. What actually created the image? Do you have an integer labeled image, rather than this RGB image? Are there black boundaries between the region? If so, which region should they belong to?
You say, "my algorithm should categorize them" but they're already categorized, you just need to find out what category (color, label) each pixel is in, I guess. Have you tried using rgb2ind() to get an indexed image? If you do that, each color will be an integer, like 1 is purple, 2 is cyan, 3 is yellow, and 4 is green. Then you can assign some "category" to each number. Look up categories in the help.
I think I was not clearly able to pose the question. Yes, I understand that I already have a number for them as they are categorized in 4 or 5 sections. Now what I wanted to was if the next figure is similar to the previous one they are categorized into same group by similar I mean there must be a zone defined and if yellow part for instance goes out of that zone then it goes in the corresponding category.
For the maps I have matrix and I have used contourf() to get these maps and you are right that I have 5 levels already at regular integral intervals which defines the five colors. I am pasting three images here. Next two images in two comments because I can not paste two images.31102-31562.jpg
Now if you look at these two images I have in comment they are pretty similar for me and the same colors are in nearly same zone. But if you compare these two with the top one which is in my question then they are quite different. So I want to cluster that image in another segment. Please let me know if you do not understand me. 33049-33568.jpg
Maybe you should look at image similarity metrics like ssim().
Yes. This one looks like something that could help me. Though it gives a very high value for not so similar images I think I still can set high value like 0.95 as ssim value and that will also help me to avoid creaating different zones. I hope this will work. Thank you so much for the help.

Sign in to comment.

Asked:

on 26 Jun 2019

Commented:

on 29 Jun 2019

Community Treasure Hunt

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

Start Hunting!