def __init__(self, outPath='pic/', tempPicPath='pic/', emoi_folder='data/emoi/', debug=False): self.splitNum = 5 self.love_module = love_module self.couplet_module = couplet_module self.landmarker = landmarker() self.cartoon_face = cartoon_face(self.landmarker) self.word_vector = WordVector() self.emoi_movie_maker = emoi_movie_module(emoi_folder, outPath, self.landmarker, debug) self.movie_maker = movie_maker(outPath, self.landmarker, self.cartoon_face) self.emotion_module = emotion_module self.crawl_module = pic_crawler(tempPicPath) self.outPath = outPath
#### user_bot.roiCartoon = cv2.cvtColor(user_bot.roiCartoon, cv2.COLOR_BGR2RGB) rightImg = cv2.cvtColor(rightImg, cv2.COLOR_BGR2RGB) leftImg = cv2.cvtColor(leftImg, cv2.COLOR_BGR2RGB) user_bot.specialImg = cv2.cvtColor(user_bot.specialImg, cv2.COLOR_BGR2RGB) #### imgList = [ user_bot.roiCartoon, user_bot.roiCartoon, rightImg, rightImg, rightImg, user_bot.roiCartoon, user_bot.roiCartoon, leftImg, leftImg, leftImg, user_bot.specialImg, user_bot.specialImg, user_bot.specialImg, user_bot.specialImg, user_bot.specialImg, user_bot.specialImg, user_bot.specialImg, user_bot.specialImg ] user_bot.moviePath = CVTools.makeMovie(imgList, self.outPath) return user_bot if __name__ == '__main__': import botClass from landmarkModule import landmarker bb = botClass.bot() la = landmarker() bb.roiCartoon = cv2.imread('pic/1620210456.7131963.jpg') bb.roiLandmarks = la.run(bb.roiCartoon)[0] bb.specialImg = cv2.imread('../facefatter.jpg') mm = movie_maker('pic/', la) bb = mm.run(bb, 1) print(bb.moviePath)
user_bot.specialImg = morph_image return user_bot else: return morph_image # 显示 # cv2.imshow('thin', thin_image) # cv2.imwrite('thin.jpg', thin_image) # cv2.imwrite('mask.jpg',mask) if __name__ == '__main__': from landmarkModule import landmarker from cartonModule import cartoon_face la = landmarker(False) cm = cartoon_face(la) cf = face_morph(la, cm) src_img = cv2.imread('roi.jpg') from botClass import bot user_bot = bot() user_bot.imgPath = 'pic/25033812051166452013.jpg' # user_bot.roiCartoon=cv2.imread('inputImg.jpg') out = cf.run(user_bot) # print('in',image.shape,'out',out.shape) # cv2.imwrite('../facefatter.jpg', out.specialImg) # print('time', time.time() - t1) # # src = cv2.imread('a10.png')[:,:,:3] # src = cv2.imread('wuyifan.jpg')[:,:,:3]