Ejemplo n.º 1
0
def process_image(errors, tiles_db, SOURCE_DIR, TARGET_DIR):
    photos = glob.glob(os.path.join(SOURCE_DIR, '*.png'))
    if not photos:
        errors.append(ERRORS.get('NO_SOURCE_PHOTOS'))

    for photo in photos:
        pname = photo.split(os.sep)[-1]
        # create Cartesian result
        result = mosaic.createMosaic(tiles_db, photo)
        result.show()
        file_name = os.path.join(TARGET_DIR, ('result-Cartesian-%s' %pname))
        result.save(file_name, 'PNG')
        # create hex result
        result = mosaic.createMosaicHex(tiles_db, photo)
        result.show()
        file_name = os.path.join(TARGET_DIR, ('result-Hex-%s' %pname))
        result.save(file_name, 'PNG')
    return errors
Ejemplo n.º 2
0
def process_image(errors, tiles_db, SOURCE_DIR, TARGET_DIR):
    photos = glob.glob(os.path.join(SOURCE_DIR, '*.png'))
    if not photos:
        errors.append(ERRORS.get('NO_SOURCE_PHOTOS'))

    for photo in photos:
        pname = photo.split(os.sep)[-1]
        # create Cartesian result
        result = mosaic.createMosaic(tiles_db, photo)
        result.show()
        file_name = os.path.join(TARGET_DIR, ('result-Cartesian-%s' % pname))
        result.save(file_name, 'PNG')
        # create hex result
        result = mosaic.createMosaicHex(tiles_db, photo)
        result.show()
        file_name = os.path.join(TARGET_DIR, ('result-Hex-%s' % pname))
        result.save(file_name, 'PNG')
    return errors
Ejemplo n.º 3
0
import os.path
import sys
import glob
import extract_meta
import mosaic
import pickle

db_filename = 'db.p'

if not os.path.isfile(db_filename):
	photos = glob.glob("photos/*.png")
	db = [(photo, extract_meta.extractPhotoInfo(photo)) for photo in photos]
	db_file = open(db_filename, 'wb')
	pickle.dump(db, db_file)
else:
	db_file = open(db_filename, 'r')
	db = pickle.load(db_file)
		
print "Have " + str(len(db)) + " samples"

photos = glob.glob("*.png")

result = mosaic.createMosaic(db, photos[0])
result.show()
result.save('result-Cartesian.png', 'PNG')


result = mosaic.createMosaicHex(db, photos[0])
result.show()
result.save('result-Hex.png', 'PNG')
Ejemplo n.º 4
0
import os.path
import sys
import glob
import extract_meta
import mosaic
import pickle

db_filename = 'db.p'

if not os.path.isfile(db_filename):
    photos = glob.glob("photos/*.png")
    db = [(photo, extract_meta.extractPhotoInfo(photo)) for photo in photos]
    db_file = open(db_filename, 'wb')
    pickle.dump(db, db_file)
else:
    db_file = open(db_filename, 'r')
    db = pickle.load(db_file)

print "Have " + str(len(db)) + " samples"

photos = glob.glob("*.png")

result = mosaic.createMosaic(db, photos[0])
result.show()
result.save('result-Cartesian.png', 'PNG')

result = mosaic.createMosaicHex(db, photos[0])
result.show()
result.save('result-Hex.png', 'PNG')