I'm trying to use clustering techniques which should allow me to find centroids (or medoids) for each group of people inside a density map (of a real photo). I could I reach that? I've already used Kmeans strategy, and maybe the calculated centroids could be also correct. But how could I better view them over the image?
h5 file: density map of a crowd - points are representing people
Download the ".h5" from here: https://drive.google.com/file/d/1C5xvEQELswr4SJ5zhtYtUEVw2FbP2QWo/view?usp=sharing
I obtain the matrix of this h5 file through this code:
import sys
import numpy
import h5py
import matplotlib.pyplot as plt
from PIL import Image as im
with h5py.File('/content/img001001.h5', 'r') as hf:
h5_matrix= hf.get('density')[:]
plt.imshow(h5_matrix)
#print(h5_matrix[:, 1])
print(h5_matrix.shape)
Printed matrix look like this:
https://drive.google.com/file/d/1f376lUPaWT58iBIg5E693uQfC22g5m3U/view?usp=sharing
what I would like to find and have: density map with centroids How could I afford that?