0% found this document useful (0 votes)
25 views4 pages

Ai Prac File

The document contains a series of Python code snippets using OpenCV to manipulate and analyze an image of a yellow flower. It includes tasks such as reading the image, displaying color values, showing a grayscale version, retrieving image dimensions, resizing the image, and detecting edges. Each section provides a code example followed by the expected output or result.

Uploaded by

sreeshnu2008
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views4 pages

Ai Prac File

The document contains a series of Python code snippets using OpenCV to manipulate and analyze an image of a yellow flower. It includes tasks such as reading the image, displaying color values, showing a grayscale version, retrieving image dimensions, resizing the image, and detecting edges. Each section provides a code example followed by the expected output or result.

Uploaded by

sreeshnu2008
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

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

You might also like