Skip to content

Instantly share code, notes, and snippets.

@PeaceAndHiLight
Created January 6, 2016 14:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PeaceAndHiLight/1f66fca6bc5ec705bd9c to your computer and use it in GitHub Desktop.
Save PeaceAndHiLight/1f66fca6bc5ec705bd9c to your computer and use it in GitHub Desktop.
Python Copy ROI
#coding: utf-8
import cv2
import numpy as np
# Read Image
img = cv2.imread('beatles_forsale.jpg')
# Copy John's Face
john = img[20:80, 40:100]
img[30:90, 90:150] = john
cv2.imwrite('copyJohn.jpg', img)
cv2.imshow('forsale_edit', img)
cv2.waitKey(0)
cv2.destroyAllWindows()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment