Skip to content

Instantly share code, notes, and snippets.

Created March 23, 2019 09:44
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save saurabhpal97/5edab42610ae93ecb1aa02f18150b05f to your computer and use it in GitHub Desktop.
#import required libraries
import numpy as np
import matplotlib.pyplot as plt
import cv2
%matplotlib inline
#read the image
image = cv2.imread('coins.jpg')
#apply thresholdin
ret,mask = cv2.threshold(sure_fg,0,255,cv2.THRESH_BINARY_INV+cv2.THRESH_OTSU)
#apply AND operation on image and mask generated by thrresholding
final = cv2.bitwise_and(image,image,mask = mask)
#plot the result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment