Skip to content

Instantly share code, notes, and snippets.

@tuncatunc
Created February 22, 2022 13:05
Show Gist options
  • Save tuncatunc/15e1b0dedf8457492506d3730599808e to your computer and use it in GitHub Desktop.
Save tuncatunc/15e1b0dedf8457492506d3730599808e to your computer and use it in GitHub Desktop.
# https://www.geeksforgeeks.org/opencv-alpha-blending-and-masking-of-images/
import cv2
im = cv2.imread("black glasses.png", cv2.IMREAD_UNCHANGED)
_, mask = cv2.threshold(im[:, :, 3], 1, 255, cv2.THRESH_BINARY)
cv2.imwrite('mask1.jpg', mask)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment