faceSwap.py
def applyWarpTriangle(self, img1, img2, img2Tri, points1, points2):
        """Compute warp triangles for each triangles of image1 and image2.first find.
           corresponding landmark points of each triangles from the triangulations
           indexes. then warp each triangle of image1 to image2 by calling created
           warpTriangle function.

        Parameters
        ----------
        img1 : numpy.ndarray
            output of image1 read by opencv.
        img2 : numpy.ndarray
            output of image2 read by opencv.
        img2Tri : list
            delaunay triangle indexes of image2.
        points1 : list
            landmark points of image1.
        points2 : list
            landmark points of image2.

        Returns
        -------
        img2 : numpy.ndarray
            warped img1 copied to img2.

        """

        # iterate through each triangles
        for i in range(len(img2Tri)):
            t1 = []
            t2 = []

            # iterate through all the three triangle indexes and find t1 and t2
            for j in range(3):
                t1.append(points1[img2Tri[i][j]])
                t2.append(points2[img2Tri[i][j]])

            self.warpTriangle(img1, img2, t1, t2)

        return img2
Compute warp triangles for each triangles of image1 and image2.first find.
           corresponding landmark points of each triangles from the triangulations
           indexes. then warp each triangle of image1 to image2 by calling created
           warpTriangle function.

        Parameters
        ----------
        img1 : numpy.ndarray
            output of image1 read by opencv.
        img2 : numpy.ndarray
            output of image2 read by opencv.
        img2Tri : list
            delaunay triangle indexes of image2.
        points1 : list
            landmark points of image1.
        points2 : list
            landmark points of image2.

        Returns
        -------
        img2 : numpy.ndarray
            warped img1 copied to img2.

        
Compute warp triangles for each triangles of image1 and image2.first find.
corresponding landmark points of each triangles from the triangulations
indexes. then warp each triangle of image1 to image2 by calling created
warpTriangle function.

Parameters

img1 : numpy.ndarray
output of image1 read by opencv.
img2 : numpy.ndarray
output of image2 read by opencv.
img2Tri : list
delaunay triangle indexes of image2.
points1 : list
landmark points of image1.
points2 : list
landmark points of image2.

Returns

img2 : numpy.ndarray
warped img1 copied to img2.
Compute warp triangles for each triangles of image1 and image2 . first find . corresponding landmark points of each triangles from the triangulations indexes . then warp each triangle of image1 to image2 by calling created warpTriangle function . Parameters img1 : numpy . ndarray output of image1 read by opencv . img2 : numpy . ndarray output of image2 read by opencv . img2Tri : list delaunay triangle indexes of image2 . points1 : list landmark points of image1 . points2 : list landmark points of image2 . Returns img2 : numpy . ndarray warped img1 copied to img2 .
def applyWarpTriangle(self, img1, img2, img2Tri, points1, points2):
        for i in range(len(img2Tri)):
            t1 = []
            t2 = []
            for j in range(3):
                t1.append(points1[img2Tri[i][j]])
                t2.append(points2[img2Tri[i][j]])
            self.warpTriangle(img1, img2, t1, t2)
        return img2
def applyWarpTriangle ( self , img1 , img2 , img2Tri , points1 , points2 ) : for i in range ( len ( img2Tri ) ) : t1 = [ ] t2 = [ ] for j in range ( 3 ) : t1 . append ( points1 [ img2Tri [ i ] [ j ] ] ) t2 . append ( points2 [ img2Tri [ i ] [ j ] ] ) self . warpTriangle ( img1 , img2 , t1 , t2 ) return img2
Compute warp triangles for each triangles of image1 and image2.first find.
Compute warp triangles for each triangles of image1 and image2 . first find .
"""Compute warp triangles for each triangles of image1 and image2.first find.
           corresponding landmark points of each triangles from the triangulations
           indexes. then warp each triangle of image1 to image2 by calling created
           warpTriangle function.

        Parameters
        ----------
        img1 : numpy.ndarray
            output of image1 read by opencv.
        img2 : numpy.ndarray
            output of image2 read by opencv.
        img2Tri : list
            delaunay triangle indexes of image2.
        points1 : list
            landmark points of image1.
        points2 : list
            landmark points of image2.

        Returns
        -------
        img2 : numpy.ndarray
            warped img1 copied to img2.

        """ # iterate through each triangles # iterate through all the three triangle indexes and find t1 and t2
self
img1
img2
img2Tri
points1
points2