Created
June 8, 2018 06:50
-
-
Save iKrishneel/509116cb3b88c69e242a68a17bad8e3a to your computer and use it in GitHub Desktop.
Poisson Image Blending on OpenCV
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import os | |
import sys | |
import numpy as np | |
import cv2 as cv | |
def main(argv): | |
if len(argv) < 3: | |
raise Exception('Provide image paths') | |
im_src = cv.imread(argv[1], cv.IMREAD_COLOR) | |
im_dst = cv.imread(argv[2], cv.IMREAD_COLOR) | |
im_mask = np.full(im_dst.shape, 255, dtype = np.uint8) | |
center = (im_src.shape[1]/2, im_src.shape[0]/2) | |
im_clone = cv.seamlessClone(im_dst, im_src, im_mask, center, cv.MIXED_CLONE) | |
cv.imshow("clone", im_clone) | |
cv.waitKey(0) | |
if __name__ == '__main__': | |
main(sys.argv) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment