def to_distance_maps(self, inverted=False):
ia.do_assert(len(self.keypoints) > <NUM_LIT:0>)<EOL>height, width = self.shape[<NUM_LIT:0>:<NUM_LIT:2>]<EOL>distance_maps = np.zeros((height, width, len(self.keypoints)), dtype=np.float32)<EOL>yy = np.arange(<NUM_LIT:0>, height)<EOL>xx = np.arange(<NUM_LIT:0>, width)<EOL>grid_xx, grid_yy = np.meshgrid(xx, yy)<EOL>for i, keypoint in enumerate(self.keypoints):<EOL><INDENT>y, x = keypoint.y, keypoint.x<EOL>distance_maps[:, :, i] = (grid_xx - x) ** <NUM_LIT:2> + (grid_yy - y) ** <NUM_LIT:2><EOL><DEDENT>distance_maps = np.sqrt(distance_maps)<EOL>if inverted:<EOL><INDENT>return <NUM_LIT:1>/(distance_maps+<NUM_LIT:1>)<EOL><DEDENT>return distance_maps<EOL>
Generates a ``(H,W,K)`` output containing ``K`` distance maps for ``K`` keypoints.

The k-th distance map contains at every location ``(y, x)`` the euclidean distance to the k-th keypoint.

This function can be used as a helper when augmenting keypoints with a method that only supports
the augmentation of images.

Parameters
-------
inverted : bool, optional
    If True, inverted distance maps are returned where each distance value d is replaced
    by ``d/(d+1)``, i.e. the distance maps have values in the range ``(0.0, 1.0]`` with 1.0
    denoting exactly the position of the respective keypoint.

Returns
-------
distance_maps : (H,W,K) ndarray
    A ``float32`` array containing ``K`` distance maps for ``K`` keypoints. Each location
    ``(y, x, k)`` in the array denotes the euclidean distance at ``(y, x)`` to the ``k``-th keypoint.
    In inverted mode the distance ``d`` is replaced by ``d/(d+1)``. The height and width
    of the array match the height and width in ``KeypointsOnImage.shape``.