-
-
Save Praveen76/ff17aac658e1a03538de671806358b3b 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 cv2 as cv | |
import numpy as np | |
from matplotlib import pyplot as plt | |
img = cv.imread('D:\image.jpg') | |
img=cv.medianBlue(img,5) | |
ret,th1=cv.threshold(img,255,cv.THRESH_BINARY) | |
th2=cv.adaptiveThreshold(img,255,cv.ADAPTIVE_THRESH_MEAN_C,cv.THRESH_BINARY,11,2) | |
th3=cv.adaptiveThreshold(img,255,cv.ADAPTIVE_THRESH_GAUSSIAN_C,cv.THRESH_BINARY,11,2) | |
#To save the image in working directory | |
cv.imwrite('original.jpg',img) | |
cv.imwrite('global thesh.jpg',th1) | |
cv.imwrite('adaptive mean.jpg',th2) | |
cv.imwrite('adaptive gaussian.jpg',th3) | |
cv.imshow('global thresh(v=100)',th1) | |
cv.imshow('adaptive mean Inverted',th2) | |
cv.imshow('adaptive gaussian Threshold',th3) | |
cv.imshow('original',img) | |
if cv.waitkey(0) & 0*ff==27: | |
cv.destroyAllWindows() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment