def left_stitch(self, a, b, flag=None):
        if flag == 1:
            m = Matching('./lib/lib1.jpg', './lib/lib2.jpg')
            m.ransac(100)
            H_inv = m.H

        H = self.matcher.match(a, b, 'left')
        H_inv = np.linalg.inv(H)

        # find top left point for offset calculation.
        tl = np.dot(H_inv, np.array([0, 0, 1]))
        tl = tl / tl[-1]
        H_inv[0][-1] += abs(tl[0])
        H_inv[1][-1] += abs(tl[1])

        # find down right for size calculation.
        w, h = a.shape[1], a.shape[0]
        dr = np.dot(H_inv, np.array([w, h, 1]))
        dsize = (int(dr[0]) + abs(int(tl[0])), int(dr[1]) + abs(int(tl[1])))

        # warp a into b's view and put them together.
        merge = cv2.warpPerspective(a, H_inv, dsize)
        fig = plt.figure()
        ax1 = fig.add_subplot(1, 2, 1)
        plt.imshow(merge)
        ax2 = fig.add_subplot(1, 2, 2)
        merge[abs(int(tl[1])):b.shape[0] + abs(int(tl[1])),
              abs(int(tl[0])):b.shape[1] + abs(int(tl[0])), :] = b
        plt.imshow(merge)
        plt.show()
        offset = (abs(int(tl[0])), abs(int(tl[1])))
        return merge, offset