dog_breeds_web_app/dog_filters.py
def put_dog_tongue(self, x, y, w, h):
        """
        Overlay dog_tongue filter image to the detected faces on human images
        Parameters:
            dog_tongue_img: filter image with dog tongue
            human_img: input image for the classifier
            x, y : coordinates of the bounding box for the detected face at the top right corner
            w: width of bounding box for the detected face
            h: height of bounding box for the detected face
        Return:
            human_img: human image with dog tongue filter
        """
        dog_nose_filter = self.resize_filters[3]
        #overlay range
        yo = dog_nose_filter.shape[0]
        xo = dog_nose_filter.shape[1]
        #loop every pixel
        for j in range(yo):
            for i in range(xo):
                for k in range(3):
                    alpha = float(dog_nose_filter[j][i][3]/255.0) # read the alpha channel
                    self.face_img[y+h-yo+j][x+int((w-xo)/2)+i][k] = alpha*dog_nose_filter[j][i][k]+\
                                                            (1-alpha)*self.face_img[y+h-yo+j][x+int((w-xo)/2)+i][k]

        Overlay dog_tongue filter image to the detected faces on human images
        Parameters:
            dog_tongue_img: filter image with dog tongue
            human_img: input image for the classifier
            x, y : coordinates of the bounding box for the detected face at the top right corner
            w: width of bounding box for the detected face
            h: height of bounding box for the detected face
        Return:
            human_img: human image with dog tongue filter
        
Overlay dog_tongue filter image to the detected faces on human images
Overlay dog_tongue filter image to the detected faces on human images
def put_dog_tongue(self, x, y, w, h):
        dog_nose_filter = self.resize_filters[3]
        yo = dog_nose_filter.shape[0]
        xo = dog_nose_filter.shape[1]
        for j in range(yo):
            for i in range(xo):
                for k in range(3):
                    alpha = float(dog_nose_filter[j][i][3]/255.0) 
                    self.face_img[y+h-yo+j][x+int((w-xo)/2)+i][k] = alpha*dog_nose_filter[j][i][k]+\
                                                            (1-alpha)*self.face_img[y+h-yo+j][x+int((w-xo)/2)+i][k]
def put_dog_tongue ( self , x , y , w , h ) : dog_nose_filter = self . resize_filters [ 3 ] yo = dog_nose_filter . shape [ 0 ] xo = dog_nose_filter . shape [ 1 ] for j in range ( yo ) : for i in range ( xo ) : for k in range ( 3 ) : alpha = float ( dog_nose_filter [ j ] [ i ] [ 3 ] / 255.0 ) self . face_img [ y + h - yo + j ] [ x + int ( ( w - xo ) / 2 ) + i ] [ k ] = alpha * dog_nose_filter [ j ] [ i ] [ k ] + ( 1 - alpha ) * self . face_img [ y + h - yo + j ] [ x + int ( ( w - xo ) / 2 ) + i ] [ k ]
Overlay dog_tongue filter image to the detected faces on human images
Overlay dog_tongue filter image to the detected faces on human images
"""
        Overlay dog_tongue filter image to the detected faces on human images
        Parameters:
            dog_tongue_img: filter image with dog tongue
            human_img: input image for the classifier
            x, y : coordinates of the bounding box for the detected face at the top right corner
            w: width of bounding box for the detected face
            h: height of bounding box for the detected face
        Return:
            human_img: human image with dog tongue filter
        """ #overlay range #loop every pixel # read the alpha channel
self
x
y
w
width of bounding box for the detected face
width of bounding box for the detected face
h
height of bounding box for the detected face
height of bounding box for the detected face
dog_tongue_img
filter image with dog tongue
filter image with dog tongue
human_img
input image for the classifier
input image for the classifier
x, y 
coordinates of the bounding box for the detected face at the top right corner
coordinates of the bounding box for the detected face at the top right corner