Given a 2D set of points
pts = np.random.uniform(low=0, high=127, size=32).reshape((-1, 2))
a density image can be computed by drawing peaks and filtering with a Gaussian blur:
sigma = 2
peaks_img = np.zeros((128, 128))
peaks_img[np.int_(pts[:, 0]), np.int_(pts[:, 1])] = 1
density_img = cv2.GaussianBlur(peaks_img, (0, 0), sigma)
Is there a nice (and fast) method for doing this without the cast to int, therefore keeping the floating point precision?