Created
March 23, 2019 09:44
-
-
Save saurabhpal97/5edab42610ae93ecb1aa02f18150b05f to your computer and use it in GitHub Desktop.
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 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 | |
plt.imshow(final) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment