INNER CODE UNIT · Python

_remap

ljvmiranda921/sprites-as-a-service · backend/sprites/sprites.py:184

    def _remap(new_range, matrix):
        old_min, old_max = np.min(matrix), np.max(matrix)
        new_min, new_max = new_range
        old = old_max - old_min
        new = new_max - new_min
        return (((matrix - old_min) * new) / old) + new_min

    sprite_with_gradient = _remap(map_range, grad)
    return sprite_with_gradient


def _combine(mat_outline: np.ndarray, mat_gradient: np.ndarray) -> np.ndarray:
    """Combine the sprite with outline and the one with gradients

    Parameters
    ----------
    mat_outline: np.ndarray
        The sprite with outline

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…