Created
August 9, 2016 15:38
-
-
Save navin-mohan/efbe081b2bde5662cc1e76db0e12289e to your computer and use it in GitHub Desktop.
Subtracting Two Images - OpenCV Python
This file contains 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
import cv2 | |
def diff(img,img1): # returns just the difference of the two images | |
return cv2.absdiff(img,img1) | |
def diff_remove_bg(img0,img,img1): # removes the background but requires three images | |
d1 = diff(img0,img) | |
d2 = diff(img,img1) | |
return cv2.bitwise_and(d1,d2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Can you please explain why 3 images are used and what are those images?