0% found this document useful (0 votes)
4 views5 pages

Ai Python Practical File Term

The document contains a series of Python code snippets using OpenCV for image processing tasks, including reading an image, displaying its color values, converting it to grayscale, obtaining its dimensions, resizing it, and performing edge detection. Each section includes input code and expected output results. The examples demonstrate basic functionalities of the OpenCV library in computer vision applications.

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)
4 views5 pages

Ai Python Practical File Term

The document contains a series of Python code snippets using OpenCV for image processing tasks, including reading an image, displaying its color values, converting it to grayscale, obtaining its dimensions, resizing it, and performing edge detection. Each section includes input code and expected output results. The examples demonstrate basic functionalities of the OpenCV library in computer vision applications.

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/ 5

AI Practical File(Computer Vision)

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

You might also like