Ejemplo n.º 1
0
    def __init__(self, img):
        ''' initialize the image alias using an image (required)'''
        self.image = Image(img)
        self.drawing = twombly.draw(self.image)

        # originals
        self.ref_image = Image(img.copy())
        self.ref_drawing = twombly.draw(self.ref_image)
        self.history = []
        self.undone = []

        self.tmp_history = []
        self.tmp_undone = []
Ejemplo n.º 2
0
def to_drawing(im, distance=20, canny_sigma=None, canny_low=None, canny_high=None, fully_connected='high', contours=None, level=0, line=True):
    '''find image contours and draws them using a twombly Drawing'''
    if contours is None:
        contours = _get_contours(im, level, canny_sigma, canny_low, canny_high, fully_connected)

    tmp = zeros(im.shape, dtype=im.dtype)
    ctx = draw(tmp)
    for a in contours:
        ctx.move_to(a[0][1], a[0][0])
        if line:
            a = a[:len(a)/2:distance]
        for b in a:
            ctx.line_to(b[1], b[0])
    return tmp, ctx