dog_filters.py
def apply_snapchat_filter(self):
        """
        Overlay  dog filter images(left_ear, right_ear, nose, tongue) to the detected faces on human images
        Parameters:
            img_path: a string-valued file path to an image
        Return:
            None
        """
        # extract pre-trained face detector
        face_cascade = cv2.CascadeClassifier('haarcascades/haarcascade_frontalface_alt.xml')

        # convert BGR image to grayscale
        gray = cv2.cvtColor(self.face_img, cv2.COLOR_BGR2GRAY)

        # find faces in image
        face = face_cascade.detectMultiScale(gray)

        # add overlayer
        for (x,y,w,h) in face:
            self.resize_filter(w)
            self.put_dog_left_ear(x, y)
            self.put_dog_right_ear(x, y, w, h)
            self.put_dog_nose(x, y, w, h)
            self.put_dog_tongue(x, y, w, h)
        cv_rgb = cv2.cvtColor(self.face_img, cv2.COLOR_BGR2RGB)
        fig = plt.figure(figsize=(10, 5))
        ax = fig.add_subplot(1, 2, 2, xticks=[], yticks=[])
        plt.imshow(cv_rgb)

        Overlay  dog filter images(left_ear, right_ear, nose, tongue) to the detected faces on human images
        Parameters:
            img_path: a string-valued file path to an image
        Return:
            None
        
Overlay  dog filter images(left_ear, right_ear, nose, tongue) to the detected faces on human images
Overlay dog filter images ( left_ear right_ear nose tongue ) to the detected faces on human images
def apply_snapchat_filter(self):
        face_cascade = cv2.CascadeClassifier('haarcascades/haarcascade_frontalface_alt.xml')
        gray = cv2.cvtColor(self.face_img, cv2.COLOR_BGR2GRAY)
        face = face_cascade.detectMultiScale(gray)
        for (x,y,w,h) in face:
            self.resize_filter(w)
            self.put_dog_left_ear(x, y)
            self.put_dog_right_ear(x, y, w, h)
            self.put_dog_nose(x, y, w, h)
            self.put_dog_tongue(x, y, w, h)
        cv_rgb = cv2.cvtColor(self.face_img, cv2.COLOR_BGR2RGB)
        fig = plt.figure(figsize=(10, 5))
        ax = fig.add_subplot(1, 2, 2, xticks=[], yticks=[])
        plt.imshow(cv_rgb)
def apply_snapchat_filter ( self ) : face_cascade = cv2 . CascadeClassifier ( 'haarcascades/haarcascade_frontalface_alt.xml' ) gray = cv2 . cvtColor ( self . face_img , cv2 . COLOR_BGR2GRAY ) face = face_cascade . detectMultiScale ( gray ) for ( x , y , w , h ) in face : self . resize_filter ( w ) self . put_dog_left_ear ( x , y ) self . put_dog_right_ear ( x , y , w , h ) self . put_dog_nose ( x , y , w , h ) self . put_dog_tongue ( x , y , w , h ) cv_rgb = cv2 . cvtColor ( self . face_img , cv2 . COLOR_BGR2RGB ) fig = plt . figure ( figsize = ( 10 , 5 ) ) ax = fig . add_subplot ( 1 , 2 , 2 , xticks = [ ] , yticks = [ ] ) plt . imshow ( cv_rgb )
Overlay  dog filter images(left_ear, right_ear, nose, tongue) to the detected faces on human images
Overlay dog filter images ( left_ear right_ear nose tongue ) to the detected faces on human images
"""
        Overlay  dog filter images(left_ear, right_ear, nose, tongue) to the detected faces on human images
        Parameters:
            img_path: a string-valued file path to an image
        Return:
            None
        """ # extract pre-trained face detector # convert BGR image to grayscale # find faces in image # add overlayer
self
img_path
a string-valued file path to an image
a string - valued file path to an image