We start by applying the mask $h_f$ to the image. The mask $h_f$ has a 3x3 size, so we need to slide it over the image and calculate the distance for each pixel. The distance transform using $h_f$ is given by the formula:
$$ D_f(m, n) = \min_{(i,j) \in h_f} \{
Show more…