Esempio n. 1
0
import numpy as np
from PIL import Image

import recogners.math.scale as s
import recogners.utils.logging as l

logger = l.get_logger(__name__)


def rasterize(x, img_shape, tile_shape, tile_spacing=(0, 0), scale=True, output=True):
    """Rasterizes and prepares an image to be outputted as a mosaic.

    Args:
        x (array): An input array to be rasterized.
        img_shape (tuple): A tuple for the image shape.
        tile_shape (tuple): A tuple holding the shape of each tile.
        tile_spacing (tuple): A tuple containing the spacing between tiles.
        scale (bool): If output array should be scaled between 0 and 1.
        output (bool): If output values should be returned as pixels or not.

    Returns:
        An output array containing the rasterized version of input array.

    """

    # Asserts if tuple lengths are equal to 2
    assert len(img_shape) == 2
    assert len(tile_shape) == 2
    assert len(tile_spacing) == 2

    # Creates an output shape
Esempio n. 2
0
def test_get_logger():
    logger = logging.get_logger(__name__)

    assert logger.name == 'test_logging'

    assert logger.hasHandlers() == True