AI PRACTICALS
B.B.SREESHNU RAAM
XC 1035'C'
Question 12
import cv2
img=cv2.imread(r"C:\Users\Documents\ yellow_flower.jpg")
b,g,r=img[300][100]
print("Blue color",b)
print("Green color",g)
print("Red color",r)
Solution
Blue color 255
Green color 255
Red color 255
Question 13
import cv2
img=cv2.imread(r"C:\Users\Documents\ yellow_flower.jpg")
cv2.imshow("Grey Scale Image",img)
cv2.waitKey()
cv2.destroyAllWindows()
Solution
Question 14
import cv2
img=cv2.imread(r"C:\Users\Documents\ yellow_flower.jpg")
print("Height and Width: ",img.shape[0],img.shape[1])
print("No of channels: ",img.shape[2])
Solution
Height and Width: 643 900
No of channels: 3
Question 15
import cv2
img=cv2.imread(r"C:\Users\Documents\ yellow_flower.jpg")
r=cv2.resize(img,(300,300))
cv2.imshow("Resized image",r)
cv2.waitKey(0)
cv2.destroyAllWindows()
Solution
Question 16
img=cv2.imread(r'C:\Users\studant\Documents\Sanjeev Balaji 1033C\yellow_flower.jpg')
edges=cv2.Canny(img,100,0)
cv2.imshow("Outline of image",edges)
cv2.waitKey(0)
cv2.destroyAllWindows()
Solution