Lab - Laplacian Pyramids

Computer Vision (CSCI 4220U)

Faisal Qureshi

Faculty of Science, UOIT

Consider the following python file called that loads and displays an image.

# Python 2.7

import argparse
import cv2
import numpy as np
from matplotlib import pyplot as plt

def process_img(imgfile):
    print 'Opening ', imgfile
    img = cv2.imread(imgfile)
    cv2.imshow('img', img)
    print 'print any key'

    // Complete this function
    // This function converts the image into grayscale
    // and constructs a Laplacian pyramid from this image.
    // The smallest size of the image in the pyramid is 
    // determined by minsize argument
    lpyr = make_lpyr(img, minsize=128)
    for i in lpyr:
        cv2.imshow('lpyr', i)
        print 'press any key'


if __name__ == '__main__':
    parser = argparse.ArgumentParser(description='Laplacian pyramids.')
    parser.add_argument('imgfile', help='Image file')
    args = parser.parse_args()


Implement make_lpyr() method, which constructs a Laplacian pyramid for the input image. It first converts the passed image into grayscale.

What to submit

Submit via Blackboard.