Skip to content

Instantly share code, notes, and snippets.

@iKrishneel
Created June 8, 2018 06:50
Show Gist options
  • Save iKrishneel/509116cb3b88c69e242a68a17bad8e3a to your computer and use it in GitHub Desktop.
Save iKrishneel/509116cb3b88c69e242a68a17bad8e3a to your computer and use it in GitHub Desktop.
Poisson Image Blending on OpenCV
#!/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