You are on page 1of 2

School of Computer Science Engineering and Technology

CSET344 Image and Video Processing


Lab Assignment 1
The lab work for the Image and Video processing course will be done in google colab using OpenCV
computer vision library. Setup Google Colab Notebooks and get familiar with OpenCV Library.

Note that OpenCV reads images in BGR format. It needs to be converted into RGB format, then you
convert it to GrayScale. Matplotlib is a widely used data visualization library in python.
Start by typing colab notebook in google. Then click on
Welcome To Colaboratory - Colaboratory

Click on New notebook.


Change the title from Untitled3.ipynb to your file name XXXX.ipynb.
Upload a “house” image from the net, in sample_data in the left column.
Start with following:
import numpy as np
import pandas as pd
import cv2 as cv
from google.colab.patches import cv2_imshow # for image display
from skimage import io
from PIL import Image
import matplotlib.pylab as plt

OpenCV uses BGR (Blue, green,red) format. So when we open an image in cv2 it is BGR by default. We
need to convert it into RGB, and then gray format. Give a new name to the image after every
conversion.

1. Select an image, display in BGR format.


2. Convert and display it in RGB.
3. Then convert it into Gray format, display.
4. Manipulate the intensity values of pixels of a gray level image to darken or brighten the image.
Display. Go back to original image.
5. Use OpenCV for converting the gray image to a black and white image by using a threshold.

6. Count the area of black pixels and size of image


7. Compute the width of the object shown here
School of Computer Science Engineering and Technology

You might also like