INNER CODE UNIT · Python
_add_outline
ljvmiranda921/sprites-as-a-service · backend/sprites/sprites.py:120
def _add_outline(mat: np.ndarray) -> np.ndarray:
"""Create an outline given a sprite image
It traverses the matrix and looks for the body of the sprite, as
represented by 0 values. Once it founds one, it looks around its neighbors
and change all background values (represented as 1) into an outline.
Parameters
----------
mat : np.ndarray
The input sprite image
Returns
-------
np.ndarray
The sprite image with outline
"""
m = np.ones(mat.shape)