add_gaussian_peak
- hybrid_learning.datasets.base.add_gaussian_peak(mask_np, centroid, binary_radius, radius_value=0.5)[source]
Add a peak to the heatmap
mask_np
as a non-normalized gaussian atcentroid
. The standard deviation is calculated such that the value of the gaussian isradius_value
at L2 distance of``binary_radius`` from the centroid. The gaussian is non-normalized, i.e. has maximum 1. For adding, each pixel is set to the maximum of the original value or the new gaussian. The value of a pixel is set to that of its center point, e.g. the pixel at index[0,0]
in the image gets the value of the point(0.5, 0.5)
.- Parameters
mask_np (ndarray) – numpy mask of shape
(width, height)
centroid (Tuple[float, float]) – the center point of the peak in
(x, y)
in pixelsbinary_radius (Union[float, int]) – the radius of the peak if binarized with a threshold of
radius_value
; is related to the standard deviation of the non-normalized gaussian via \(\sigma=\frac{r}{\sqrt{-2 \ln(\text{radius\_value})}}\)radius_value (float) – the value the point at L2 distance of
binary_radius
from the peakcentroid
should have
- Returns
copy of
mask_np
with new peak added- Return type
ndarray