Example #1
0
def orientedPaint(im, texture, N=7000, size=50, noise=0.3):
    '''same as painterly but computes and uses the local orientation information to orient strokes.'''
    out = np.zeros_like(im)
    thetas = computeAngles(im)
    singleScaleOrientedPaint(im, out, thetas, np.ones_like(im), texture, float(size), N, noise, 36)
    singleScaleOrientedPaint(im, out, thetas, helper.sharpnessMap(im), texture, float(size)/4, N, noise, 36)
    return out    
Example #2
0
def painterly(im, texture, N=10000, size=50, noise=0.3):
    ''' First paints at a coarse scale using all 1's for importance sampling,
        then paints again at size/4 scale using the sharpness map for importance sampling.'''
    out = np.zeros_like(im)
    singleScalePaint(im, out, np.ones_like(im), texture, float(size), N, noise)
    singleScalePaint(im, out, helper.sharpnessMap(im), texture, float(size)/4, N, noise)
    return out
def painterly(im,
              texture,
              N=10000,
              size=50,
              noise=01.3,
              debug=False,
              imname=''):
    '''First paints at a coarse scale using all 1's for importance sampling, then paints again at size/4 scale using the sharpness map for importance sampling.'''

    out = io.constantIm(im.shape[0], im.shape[1])
    outCopy = None
    if debug:
        outCopy = out.copy()

    # first pass
    importance_first_pass = np.ones_like(im)
    singleScalePaint(im, out, importance_first_pass, texture, size, N, noise)
    if debug:
        io.imwrite(out, str(imname + "PainterlyFirstPassOnly.png"))

    # second pass
    importance_second_pass = helper.sharpnessMap(im)
    singleScalePaint(im, out, importance_second_pass, texture, size / 4, N,
                     noise)
    if debug:
        singleScalePaint(im, outCopy, importance_second_pass, texture,
                         size / 4, N, noise)
        io.imwrite(outCopy, str(imname + "PainterlySecondPassOnly.png"))

    return out
def painterly(im, texture, N=10000, size=50, noise=0.3):
    '''First paints at a coarse scale using all 1's for importance sampling, then paints again at size/4 scale using the sharpness map for importance sampling.'''
    importanceLow = np.ones_like(im)
    outLow = io.constantIm( im.shape[0], im.shape[1], 0.0 )
    singleScalePaint(im, outLow, importanceLow, texture, size, N, noise)

    importanceHigh = helper.sharpnessMap(im)
    singleScalePaint(im, outLow, importanceHigh, texture, size/4, N, noise)

    return outLow
def orientedPaint(im, texture, N=7000, size=50, noise=0.3):
    '''same as painterly but computes and uses the local orientation information to orient strokes.'''
    importanceLow = np.ones_like(im)
    outLow = io.constantIm( im.shape[0], im.shape[1], 0.0 )
    thetas = computeAngles(im)
    singleScaleOrientedPaint(im, outLow, thetas, importanceLow, texture, size, N, noise)

    importanceHigh = helper.sharpnessMap(im)
    singleScaleOrientedPaint(im, outLow, thetas, importanceHigh, texture, size/4, N, noise)

    return outLow
def orientedPaint(im, texture, N=7000, size=50, noise=0.3):
    '''same as painterly but computes and uses the local orientation information to orient strokes.'''

    out = io.constantIm(im.shape[0], im.shape[1])

    thetas = computeAngles(im)

    # first pass
    importance_first_pass = np.ones_like(im)
    singleScaleOrientedPaint(im, out, thetas, importance_first_pass, texture,
                             size, N, noise)

    # second pass
    importance_second_pass = helper.sharpnessMap(im)
    singleScaleOrientedPaint(im, out, thetas, importance_second_pass, texture,
                             size / 4, N, noise)

    return out