faceSwap.py
def applyForBothModes(self, img1, img2, img2_original, landmark_points1, landmark_points2):
        """This function contain code tha will be use for both mode. inorder to avoid repetition.

        Parameters
        ----------
        img1 : nparray
            Readed value of image1.
        img2 : type
            Readed value of image2
        img2_original : type
            The original readed img2 for backup.
        landmark_points1 : list
            List of facial landmark poinst of single face in image1.
        landmark_points2 : type
            List of facial landmark poinst of single face in image2.

        Returns
        -------
        swappedImage: numpy.ndarray
            The swapped image.

        """
        # find the convex hull bounding the landmark points of the images
        hull1, hull2 = self.applyConvexHull(
            landmark_points1, landmark_points2)

        # calculate the delauney triangulations
        # triangulation_indexes1 = self.calculateDelaunayTriangles(
        #     img1, hull1)
        triangulation_indexes2 = self.calculateDelaunayTriangles(
            img2, hull2)

        img2warped = self.applyWarpTriangle(
            img1, img2, triangulation_indexes2, hull1, hull2)

        swappedImage = self.applySeamlessClone(
            img2warped, img2_original, hull2)

        return swappedImage
This function contain code tha will be use for both mode. inorder to avoid repetition.

        Parameters
        ----------
        img1 : nparray
            Readed value of image1.
        img2 : type
            Readed value of image2
        img2_original : type
            The original readed img2 for backup.
        landmark_points1 : list
            List of facial landmark poinst of single face in image1.
        landmark_points2 : type
            List of facial landmark poinst of single face in image2.

        Returns
        -------
        swappedImage: numpy.ndarray
            The swapped image.

        
This function contain code tha will be use for both mode. inorder to avoid repetition.
Parameters

img1 : nparray
Readed value of image1.
img2 : type
Readed value of image2
img2_original : type
The original readed img2 for backup.
landmark_points1 : list
List of facial landmark poinst of single face in image1.
landmark_points2 : type
List of facial landmark poinst of single face in image2.

Returns


This function contain code tha will be use for both mode . inorder to avoid repetition . Parameters img1 : nparray Readed value of image1 . img2 : type Readed value of image2 img2_original : type The original readed img2 for backup . landmark_points1 : list List of facial landmark poinst of single face in image1 . landmark_points2 : type List of facial landmark poinst of single face in image2 . Returns
def applyForBothModes(self, img1, img2, img2_original, landmark_points1, landmark_points2):
        hull1, hull2 = self.applyConvexHull(
            landmark_points1, landmark_points2)
        triangulation_indexes2 = self.calculateDelaunayTriangles(
            img2, hull2)
        img2warped = self.applyWarpTriangle(
            img1, img2, triangulation_indexes2, hull1, hull2)
        swappedImage = self.applySeamlessClone(
            img2warped, img2_original, hull2)
        return swappedImage
def applyForBothModes ( self , img1 , img2 , img2_original , landmark_points1 , landmark_points2 ) : hull1 , hull2 = self . applyConvexHull ( landmark_points1 , landmark_points2 ) triangulation_indexes2 = self . calculateDelaunayTriangles ( img2 , hull2 ) img2warped = self . applyWarpTriangle ( img1 , img2 , triangulation_indexes2 , hull1 , hull2 ) swappedImage = self . applySeamlessClone ( img2warped , img2_original , hull2 ) return swappedImage
This function contain code tha will be use for both mode.
This function contain code tha will be use for both mode .
"""This function contain code tha will be use for both mode. inorder to avoid repetition.

        Parameters
        ----------
        img1 : nparray
            Readed value of image1.
        img2 : type
            Readed value of image2
        img2_original : type
            The original readed img2 for backup.
        landmark_points1 : list
            List of facial landmark poinst of single face in image1.
        landmark_points2 : type
            List of facial landmark poinst of single face in image2.

        Returns
        -------
        swappedImage: numpy.ndarray
            The swapped image.

        """ # find the convex hull bounding the landmark points of the images # calculate the delauney triangulations # triangulation_indexes1 = self.calculateDelaunayTriangles( #     img1, hull1)
self
img1
img2
img2_original
landmark_points1
landmark_points2