from matplotlib import pyplot as plt
import cv2
img = cv2.imread(r'C:\Users\Manish\Desktop\VNR CDC\Day
6\OpenCV\NTR.jpg')
gray = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
plt.imshow(gray)
plt.title('my picture')
plt.show()
_________________________________________________
import cv2
img = cv2.imread("lena.jpg",0)
ret, th = cv2.threshold(img, 125, 255, cv2.THRESH_BINARY)
ret, th1 = cv2.threshold(img, 125, 255, cv2.THRESH_BINARY_INV)
cv2.imshow("Hello World1",img)
cv2.imshow("Hello World2",th)
cv2.imshow("Hello World3",th1)
cv2.waitKey(0)
cv2.destroyAllWindows()
_____________________________________________________
_________________________________________________
import cv2
img = cv2.imread("lena.jpg",0)
ret, th = cv2.threshold(img, 125, 255, cv2.THRESH_BINARY)
ret, th1 = cv2.threshold(img, 125, 255, cv2.THRESH_BINARY_INV)
cv2.imshow("Hello World1",img)
cv2.imshow("Hello World2",th)
cv2.imshow("Hello World3",th1)
cv2.waitKey(0)
cv2.destroyAllWindows()
_____________________________________________________
No comments:
Post a Comment