title: cluster / find similar heatmap figures using python
body: <p>I have the following sample images of heatmaps (I have hundreds of these images...for now, it will grow later):</p>
  
  <p><a href="https://i.stack.imgur.com/Btf3Y.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Btf3Y.jpg" alt="heatmap1"></a></p>
  
  <p><a href="https://i.stack.imgur.com/cLxnY.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cLxnY.jpg" alt="heatmap2"></a></p>
  
  <p><a href="https://i.stack.imgur.com/mBPht.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mBPht.jpg" alt="heatmap3"></a></p>
  
  <p><a href="https://i.stack.imgur.com/efYYB.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/efYYB.jpg" alt="heatmap4"></a></p>
  
  <p>Using my human eye, I'd say that heatmap1, 3 and 4 are similar to each other, or maybe 3 and 4 are most similar to each other, I'm not sure.  </p>
  
  <p>I'd like to be able to group the heatmap figures that are most similar to each other into different groups, based on the patterns and their intensities. </p>
  
  <p><strong>For example, each of the heatmap contains 24 rows and 5 columns (The rows represent time and the columns represent features). Each color in each column represents a number between 0 to 1. The pattern and intensities in column 1 for heatmap 3 and 4 is more similar compare to the other heatmaps</strong>. But, instead of looking at each column, I want to compare the overall patterns and intensities of each heatmap to one another. </p>
  
  <p>I thought I was going to use kmeans clustering, but couldn't find any info that could help me in achieving what I want. My search ends up with hierarchical clustering quite a lot, which will not help me, from what I understand.</p>
  
  <p>Then, I found some information on image hashing. Read up on it a little bit, and it seems like it could help me with my problem.</p>
  
  <p>Before I go read and learn any further, I have a couple of questions/confusions that I'd like to address, this way I can further invest my time in learning and reading about the better way to approach this problem.</p>
  
  <p>My questions/confusions:</p>
  
  <ol>
  <li>What is the best way to approach this problem? kmeans or image
  hashing? </li>
  <li>Is it even possible to do this using kmeans?</li>
  </ol>
  
  <p>Any other approaches are welcome.</p>