def createNewItemWithTextures(back1, back2): LOG.enabled = False clothing = ClothingItem() LOG.debug("Created new clothing item: {0}".format(clothing.id)) img1 = Image.open(back1) img2 = Image.open(back2) LOG.debug("Opened images.") clothing.addImage(img1, "back1") clothing.addImage(img2, "back2") LOG.debug("Added images.") clothing.createFinalTexture() LOG.enabled = True return clothing.id
def newWithTexturesFromCWD(cat): #Hack so this function can be called from any thread tempDB = Vars.DB Vars.DB = DatabaseInterface.Database() clothing = ClothingItem(category=cat) LOG.debug("Created new clothing item: {0}".format(clothing.id)) img1 = Image.open("back1.png") img2 = Image.open("back2.png") LOG.debug("Opened images.") clothing.addImage(img1, "back1") clothing.addImage(img2, "back2") LOG.debug("Added images.") clothing.createFinalTexture() Vars.DB = tempDB return clothing.id
def testingRecognizer(clothes): template = TemplateRecgonizer() match = template.findMatch("recog.png", clothes) LOG.debug("Found Match with ID: {0}, confidence: {1}".format( match[1].id, match[0]))
def func_wrapper(*args, **kwargs): current_time = time.time() ret = func(*args, **kwargs) LOG.debug("Time taken to execute function {0}: {1} s".format( str(func.__name__), float(time.time() - current_time))) return ret