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

Write A Program To Read An Image Using Open CV

The document contains four programs that demonstrate how to read and display images using OpenCV in Python. Each program includes variations such as displaying images in grayscale, adding titles, and converting images from BGR to RGB format. The code snippets utilize libraries like cv2 and matplotlib for image processing and visualization.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views4 pages

Write A Program To Read An Image Using Open CV

The document contains four programs that demonstrate how to read and display images using OpenCV in Python. Each program includes variations such as displaying images in grayscale, adding titles, and converting images from BGR to RGB format. The code snippets utilize libraries like cv2 and matplotlib for image processing and visualization.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Program 1

Question:

Write a program to read an image using Open CV.

INPUT:

import cv2

import [Link] as plt

import numpy as np

img=[Link]('[Link]')

[Link](img)

[Link]()

OUTPUT:
Program 2

Question:

Write a program to read an image using Open CV in grayscale mode.

INPUT:

import cv2

import [Link] as plt

import numpy as np

img=[Link]("[Link]",0)

[Link](img,cmap= "gray")

[Link]("Abstract Art")

[Link]("on")

[Link]()

OUTPUT:
Program 3

Question:

Write a program to read an image using Open CV and insert title for the image.

INPUT:

import cv2

import [Link] as plt

import numpy as np

img=[Link]('[Link]')

[Link](img)

[Link]('Abstract Art')

[Link]('on')

[Link]()

OUTPUT:
Program 4

Question:

Write a program to read an image using Open CV and convert it from BGR to RGB Image.

INPUT:

import cv2

import [Link] as plt

import numpy as np

img=[Link]('[Link]')

[Link]([Link](img,cv2.COLOR_BGR2RGB))

[Link]('Absract Art')

[Link]('on')

[Link]()

OUTPUT:

You might also like