def set_faceProcessor(self): self.mouth_drawer = drw.MouthDrawer() self.eyes_drawer = drw.EyesDrawer() self.skin_color = features.SkinCategoryFeature() self.qr_code = features.QRCodeFeature() skin_rec = recommenders.DictRecommender(self.skin_color, SKIN_COLORS) qr_rec = recommenders.DictRecommender(self.qr_code, QR_CODE_COLORS) self.skin_rec = RecommenderStream(self.stream, skin_rec).start() self.qr_rec = RecommenderStream(self.stream, qr_rec).start()
dest='alpha', type=float, default=0.25, help='alpha') args = ap.parse_args() detector = FacePartsDetector(args.shape_predictor, [ 'mouth', 'right_eye', 'left_eye', 'right_eyebrow', 'left_eyebrow', 'nose', 'jaw' ]) cap = cv2.VideoCapture(args.source) mouth_drawer = DRAWERS['mouth'] eyes_drawer = DRAWERS['eyes'] skin_color = features.SkinCategoryFeature() qr_code = features.QRCodeFeature() skin_rec = recommenders.DictRecommender(skin_color, SKIN_COLORS) qr_rec = recommenders.DictRecommender(qr_code, QR_CODE_COLORS) while (True): # load the input image, resize it, and convert it to grayscale _, image = cap.read() if image is not None: image = imutils.resize(image, width=900) gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) shapes = detector.detect(gray) skin_predict = skin_rec.predict(image, shapes) qr_predict = qr_rec.predict(image, shapes) eyes_drawer.draw(image, shapes, (183, 163, 255), 0.1) mouth_drawer.draw(image, shapes, (99, 49, 222), 0.2)