Beispiel #1
0
	rw = multrandwalk(image, importance)
	globimage[rw] = image[rw]
	anim.set_data(globimage)
	return anim,


def test2(image, n=10):
	global globimage
	globimage = np.zeros(image.shape) + 50
	importance = importance_filter(image)
	fig = plt.figure()
	im = plt.imshow(image, cmap=cm.Greys_r, animated=True)
	ani = animation.FuncAnimation(fig, updateFig2, frames=xrange(n), fargs=(im, image, importance), interval=50)
	plt.show()


import sys

if __name__ == '__main__':
	img = prepareImg('pics/escher.jpg', compress=True)
	if len(sys.argv) == 2 and sys.argv[1] == 'randwalk':
		test(img, lambda image, source: image + randwalk(image))
	elif len(sys.argv) == 2 and sys.argv[1] == 'diffuse':
		test(img, lambda image, source: diffuse(image, [1, 1, 1, 1], source))
	elif len(sys.argv) == 2 and sys.argv[1] == 'both':
		test(img, lambda image, source: diffuse(image, [1, 1, 1, 1], source) + randwalk(image))
	elif len(sys.argv) == 2 and sys.argv[1] == 'randwalk2':
		test2(img)
	else:
		print "Unknown test"
Beispiel #2
0
def test2(image, n=10):
    global globimage
    globimage = np.zeros(image.shape) + 50
    importance = importance_filter(image)
    fig = plt.figure()
    im = plt.imshow(image, cmap=cm.Greys_r, animated=True)
    ani = animation.FuncAnimation(fig,
                                  updateFig2,
                                  frames=xrange(n),
                                  fargs=(im, image, importance),
                                  interval=50)
    plt.show()


import sys

if __name__ == '__main__':
    img = prepareImg('pics/escher.jpg', compress=True)
    if len(sys.argv) == 2 and sys.argv[1] == 'randwalk':
        test(img, lambda image, source: image + randwalk(image))
    elif len(sys.argv) == 2 and sys.argv[1] == 'diffuse':
        test(img, lambda image, source: diffuse(image, [1, 1, 1, 1], source))
    elif len(sys.argv) == 2 and sys.argv[1] == 'both':
        test(
            img, lambda image, source: diffuse(image, [1, 1, 1, 1], source) +
            randwalk(image))
    elif len(sys.argv) == 2 and sys.argv[1] == 'randwalk2':
        test2(img)
    else:
        print "Unknown test"
Beispiel #3
0
#!/usr/bin/env python

import sys

from imageprep import prepareImg
from meshcreator import to_mesh

if __name__ == '__main__':
	if len(sys.argv) != 3:
		print >> sys.stderr, "Usage: ./img2stl <path_to_image> <new_stl_filename>"
	img = prepareImg(sys.argv[1])
	to_mesh(img, sys.argv[2], 2)