Ai Python Practical File Term
Ai Python Practical File Term
R.Krishav
12. INPUT
import cv2
img=cv2.imread (r"C:\Users\Admin\Desktop\raghav pictures\opo.jpg")
b,g,r=img[100][100]
print("Blue value= ",b)
print("Green value= ",g)
print("Red value= ",r)
OUTPUT
Blue value= 249
Green value= 246
Red value= 255
13. INPUT
import cv2
x=cv2.imread(r"C:\Users\Admin\Desktop\raghav pictures\opo.jpg",0)
cv2.imshow("Gray Scale Image",x)
cv2.waitKey(0)
cv2.destroyAllWindows()
OUTPUT
14.INPUT
import cv2
img=cv2.imread(r"C:\Users\Admin\Desktop\raghav pictures\opo.jpg")
print("Height and Width of the image",img.shape[0],img.shape[1])
print("No.of channels=",img.shape[2])
OUTPUT
Height and Width of the image 158 273
No. of channels= 3
15.INPUT
import cv2
img=cv2.imread(r"C:\Users\Admin\Desktop\raghav pictures\opo.jpg")
r=cv2.resize(img,(400,400))
cv2.imshow("Resized image",r)
cv2.waitKey(0)
cv2.destroyAllWindows()
OUTPUT
16.INPUT
import cv2
img =cv2.imread( r"C:\Users\Admin\Desktop\raghav pictures\opo.jpg")
edges = cv2.Canny(img, 50, 150)
cv2.imshow("Edge Detection", edges)
cv2.waitKey(0)
cv2.destroyAllWindows()
OUTPUT