Example #1
0
def ex(params):
    rgb = RGBExtractor()
    rgb.shp = (200, 200)

    p = list(params)
    p[-1] *= 1.5
    return rgb.extract(*p)
Example #2
0
def ex(params):
    rgb = RGBExtractor()
    rgb.shp = (200, 200)

    p = list(params)
    p[-1] *= 1.5
    return rgb.extract(*p)
Example #3
0
def main():

    ex = RGBExtractor()
    ex.shp = (100, 100)

    data = filter(hit_rate=0.2)

    params = {}
    for i, d in enumerate(data):
        d1 = list(d)
        d2 = list(d)
        d2[-1] *= 2

        l = int(np.round(d[0]))
        d1 = [l] + d1
        d2 = [l] + d2

        im = np.hstack((ex(*d1), ex(*d2)))
        pth = "vet_%4.4i.png" % i
        params[pth] = d
        pth = os.path.join('best', pth)
        imsave(pth, im)

    pth = os.path.join('best', 'data.pkl')
    with open(pth, 'w') as outfile:
        pickle.dump(params, outfile)
Example #4
0
def collage(bubbles):
    ex = RGBExtractor()
    ex.shp = (200, 200)
    images = [ex.extract(*p) for p in bubble_params(bubbles)]

    if len(images) == 3:
        return np.vstack(images)

    r, g, b = tuple(
        montage2d(np.array([a[:, :, i] for a in images])) for i in range(3))
    return np.dstack((r, g, b)).astype(np.uint8)
Example #5
0
def collage(bubbles):
    ex = RGBExtractor()
    ex.shp = (200, 200)
    images = [ex.extract(*p) for p in bubble_params(bubbles)]

    if len(images) == 3:
        return np.vstack(images)

    r, g, b = tuple(montage2d(np.array([a[:, :, i] for a in images]))
                    for i in range(3))
    return np.dstack((r, g, b)).astype(np.uint8)