CIS581: Computer Vision and Computational Photography Homework: Cameras and Convolution Due: Sept. 14, 2017 at 3:00 pm

Similar documents
>>> from numpy import random as r >>> I = r.rand(256,256);

>>> from numpy import random as r >>> I = r.rand(256,256);

Understanding Matrices to Perform Basic Image Processing on Digital Images

MEM: Intro to Robotics. Assignment 3I. Due: Wednesday 10/15 11:59 EST

Introduction to DSP ECE-S352 Fall Quarter 2000 Matlab Project 1

6.098/6.882 Computational Photography 1. Problem Set 1. Assigned: Feb 9, 2006 Due: Feb 23, 2006

PLazeR. a planar laser rangefinder. Robert Ying (ry2242) Derek Xingzhou He (xh2187) Peiqian Li (pl2521) Minh Trang Nguyen (mnn2108)

CAP 5415 Computer Vision. Marshall Tappen Fall Lecture 1

Image Filtering. Median Filtering

Image Processing & Projective geometry

Princeton University COS429 Computer Vision Problem Set 1: Building a Camera

CEE598 - Visual Sensing for Civil Infrastructure Eng. & Mgmt.

Computer Vision Slides curtesy of Professor Gregory Dudek

MIT CSAIL Advances in Computer Vision Fall Problem Set 6: Anaglyph Camera Obscura

MEM455/800 Robotics II/Advance Robotics Winter 2009

Image Enhancement in the Spatial Domain Low and High Pass Filtering

Robert Collins CSE486, Penn State. Lecture 3: Linear Operators

CSE 166: Image Processing. Overview. What is an image? Representing an image. What is image processing? History. Today

Midterm is on Thursday!

CS534 Introduction to Computer Vision. Linear Filters. Ahmed Elgammal Dept. of Computer Science Rutgers University

Image Filtering and Gaussian Pyramids

CPSC 340: Machine Learning and Data Mining. Convolutional Neural Networks Fall 2018

Motion illusion, rotating snakes

Image Filtering in Spatial domain. Computer Vision Jia-Bin Huang, Virginia Tech

Digital Image Processing 3/e

Vision Review: Image Processing. Course web page:

Matlab (see Homework 1: Intro to Matlab) Linear Filters (Reading: 7.1, ) Correlation. Convolution. Linear Filtering (warm-up slide) R ij

Colorado School of Mines. Computer Vision. Professor William Hoff Dept of Electrical Engineering &Computer Science.

Revit Structure 2013 Basics

EE482: Digital Signal Processing Applications

A moment-preserving approach for depth from defocus

Revit Structure 2014 Basics

8.2 IMAGE PROCESSING VERSUS IMAGE ANALYSIS Image processing: The collection of routines and

Geometry of Aerial Photographs

CS 4501: Introduction to Computer Vision. Filtering and Edge Detection

CS 548: Computer Vision REVIEW: Digital Image Basics. Spring 2016 Dr. Michael J. Reale

This experiment is under development and thus we appreciate any and all comments as we design an interesting and achievable set of goals.

Sampling and Reconstruction

Lane Detection in Automotive

Chapter 17. Shape-Based Operations

Multiplying Three Factors and Missing Factors

Vehicle License Plate Recognition System Using LoG Operator for Edge Detection and Radon Transform for Slant Correction

Image Processing for feature extraction

Revit Structure 2012 Basics:

Photo/Image Controls

Digital Image Processing. Lecture # 8 Color Processing

Numerical Derivatives See also T&V, Appendix A.2 Gradient = vector of partial derivatives of image I(x,y) = [di(x,y)/dx, di(x,y)/dy]

Background. Computer Vision & Digital Image Processing. Improved Bartlane transmitted image. Example Bartlane transmitted image

Princeton ELE 201, Spring 2014 Laboratory No. 2 Shazam

IMAGE PROCESSING: AREA OPERATIONS (FILTERING)

Image Pro Ultra. Tel:

Announcements. Image Processing. What s an image? Images as functions. Image processing. What s a digital image?

Computer Vision, Lecture 3

Lecture 2. Electromagnetic radiation principles. Units, image resolutions.

Digital images. Digital Image Processing Fundamentals. Digital images. Varieties of digital images. Dr. Edmund Lam. ELEC4245: Digital Image Processing

Basic Camera Craft. Roy Killen, GMAPS, EFIAP, MPSA. (c) 2016 Roy Killen Basic Camera Craft, Page 1

Prof. Vidya Manian Dept. of Electrical and Comptuer Engineering

(ans: Five rows require a 3-bit code and ten columns a 4-bit code. Hence, each key has a 7 bit address.

AutoCAD 2D I. Module 6. Drawing Lines Using Cartesian Coordinates. IAT Curriculum Unit PREPARED BY. February 2011

6.003: Signal Processing. Synthetic Aperture Optics

Overview. Neighborhood Filters. Dithering

Digital Image Processing

Lecture 17 Convolutional Neural Networks

Image preprocessing in spatial domain

Image and Multidimensional Signal Processing

Image Manipulation: Filters and Convolutions

Images and Filters. EE/CSE 576 Linda Shapiro

Subband coring for image noise reduction. Edward H. Adelson Internal Report, RCA David Sarnoff Research Center, Nov

02/02/10. Image Filtering. Computer Vision CS 543 / ECE 549 University of Illinois. Derek Hoiem

Libyan Licenses Plate Recognition Using Template Matching Method

Multiresolution Analysis of Connectivity

Sensors and Sensing Cameras and Camera Calibration

Lesson 1 Area of Parallelograms

Toward Non-stationary Blind Image Deblurring: Models and Techniques

MATLAB Image Processing Toolbox

RGB COLORS. Connecting with Computer Science cs.ubc.ca/~hoos/cpsc101

Images and Graphics. 4. Images and Graphics - Copyright Denis Hamelin - Ryerson University

Lab S-4: Convolution & FIR Filters. Please read through the information below prior to attending your lab.

NCSS Statistical Software

IMAGE FORMATION. Light source properties. Sensor characteristics Surface. Surface reflectance properties. Optics

Application of GIS to Fast Track Planning and Monitoring of Development Agenda

Midterm Examination CS 534: Computational Photography

Sante FFT Imaging Copyright 2018 Santesoft, all rights reserved

Proposed Method for Off-line Signature Recognition and Verification using Neural Network

Unit 1: Image Formation

TECHNICAL REPORT VSG IMAGE PROCESSING AND ANALYSIS (VSG IPA) TOOLBOX

Which equipment is necessary? How is the panorama created?

Instruction Manual. Mark Deimund, Zuyi (Jacky) Huang, Juergen Hahn

CPSC 4040/6040 Computer Graphics Images. Joshua Levine

MATLAB 6.5 Image Processing Toolbox Tutorial

Image Enhancement using Histogram Equalization and Spatial Filtering

Digital Image Processing. Digital Image Fundamentals II 12 th June, 2017

Lane Detection in Automotive

Automatic Electricity Meter Reading Based on Image Processing

Line Segmentation and Orientation Algorithm for Automatic Bengali License Plate Localization and Recognition

www. riseeyetracker.com TWO MOONS SOFTWARE LTD RISEBETA EYE-TRACKER INSTRUCTION GUIDE V 1.01

CSCI 1290: Comp Photo

MASSACHUSETTS INSTITUTE OF TECHNOLOGY

Image acquisition. Midterm Review. Digitization, line of image. Digitization, whole image. Geometric transformations. Interpolation 10/26/2016

Contents. 2.3 The color code scheme is defined in the following table:

Transcription:

CIS58: Computer Vision and Computational Photography Homework: Cameras and Convolution Due: Sept. 4, 207 at 3:00 pm Instructions This is an individual assignment. Individual means each student must hand in their own answers, and each student must write their own code in the homework. It is admissible for students to collaborate in solving problems. To help you actually learn the material, what you write down must be your own work, not copied from any other individual. You must also list the names of students (maximum two) you collaborated with. You must submit your solutions online on Canvas. We recommend that you use LATEX, but we will accept scanned solutions as well. Please place your homework (.pdf), code, images and any additional files into the top level of a single folder named <PennKey>.zip Notation Clarification For notations in all questions below, we denote I as input image, f as kernel and g as output image. In addition, questions are independent of each other except additional notifications. Start early! If you get stuck, please post your questions on Piazza or come to office hours! Getting Started. Introduction to MATLAB / Python In this question, you will be required to build upon the starter code provided, to read in an image and apply the Sobel operator to it. The kernel which highlights the vertical edges when convolved with an image has been given to you in the code. You need to perform the following tasks:. Read in the image Bikesgray. jpg into the variable img 2. Convolve the image with the given kernel f 3. Display and save the result of the convolution 4. Come up with a kernel f 2 similar to f, but one which causes the horizontal edges to be highlighted 5. Convolve the image img with kernel f 2 6. Display and save the result of the convolution. Question.: Please implement the above via MATLAB or Python. Submit your code and the two images generated as a result of the convolution with kernels f and f 2 respectively..2 Filtering Recall the definition of filtering is as follows: where I is the image, f is the kernel for filtering. g(i, j) = I(i + m, j + n) f (m,n) = I f () m,n

Question.2: Using the I and f given below, check if the commutative property (I f f I) holds for the filtering operation. Show by hand how you arrived at your answer. Assume zeropadding along the boundary, and same output size. 0.5 2.0.5 I = 0.5.0 0.0 (2) 2.0 0.5.0 0.5.0 0.0 f = 0.0.0 0.5 (3) 0.5 0.0 0.5 Note: The matrices for I and f given in Eq. 2 and 3 respectively are to be used only for Question.2. 2 Convolution Recall the definition of convolution, where I and f represents the image and kernel respectively. Typically, when kernel f is a -D vector, we get where i is the index in the row or column dimension. If the kernel f is a 2-D kernel, we have where i and j are the row and column indices respectively. g = I f (4) g(i) = I(i m) f (m) (5) m g(i, j) = I(i m, j n) f (m,n) (6) m,n In this section, you need to perform the convolution by hand, get familiar with convolution in both - D and 2-D as well as its corresponding properties. Note: All convolution operations in this section follow except additional notifications:. Zero-Padding, 2. Same Output Size, 3. An addition or multiplication with 0 will count as one operation. For this problem, we will use the following 3 3 image: 0.0.0.0 I = 2.0.0 0.0 (7) 0.0 3.0.0 You are given two -D vectors for convolution: f x = [.0 0.0.0 ] (8) f y = [.0.0.0 ] T (9) Let g = I f x f y, f xy = f x f y and g 2 = I f xy. Note : f xy should be full output size. Question 2.: Compute g and g 2 (At least show two steps for each convolution operation and intermediate results), and verify the associative property of convolution Question 2.2: How many operations are required for computing g and g 2 respectively? Show addition and multiplication times in your result. Question 2.3: What does convolution do to this image?

3 Kernel Estimation Recall the special case of convolution discussed in class: The Impulse function. Using an impulse function, it is possible to shift (and sometimes also scale ) an image in a particular direction. For example, when the following image is convolved with the kernel, it results in the output: I = a b c d e f (0) g h i f = 0 0 () g = e f 0 h i 0 (2) Another useful trick to keep in mind is the decomposition of a convolution kernel into scaled impulse kernels. For example, a kernel f = 0 0 7 (3) 0 4 0 can be decomposed into f = 7 0 0 and f 2 = 4 0 0 Question 3: Using the two tricks listed above, estimate the kernel f by hand which when convolved with an image I = 5 2 7 8 6 (4) 3 9 4 results in the output image Hint: Look at the relationship between corresponding elements in g and I. 29 43 0 g = 62 52 30 (5) 5 45 20 4 Edge Moving Object Recognition is one of the most popular applications in Computer Vision. The goal is to identify the object based on a template or a specific pattern of the object that has been learnt from a training dataset. Suppose we have a standard template for a "barrel" which is a 3 3 rectangle block in a 4 4 image. We also have an input 4 4 query image. Now, your task is to verify if the image in question contains a barrel. After preprocessing and feature extraction, the query image is simplified as I Q and the barrel template is I T. 0 0 0 0 I Q = 0 0,I T = 0 0 Instinctively, the human eye can automatically detect a potential barrel in the top left corner of the query image but a computer can t do that right away. Basically, if the computer finds that the difference between

query image s features and the template s features are minute, it will prompt with high confidence: Aha! I have found a barrel in the image. However, in our circumstance, if we directly compute the pixel wise distance D between IQ and IT where D(IQ, IT ) = (IQ (i, j) IT (i, j))2 (6) i, j we get D = 0 which implies that there s a huge difference between the query image and our template. To fix this problem, we can utilize the power of the convolution. Let s define the mean shape image IM which is the blurred version of IQ and IT. 0.25 0.5 0.5 0.25 0.5 0.5 IM = 0.5 0.5 0.25 0.5 0.5 0.25 Question 4.: Compute two 3 3 convolution kernels f, f2 by hand such that IQ f = IM and IT f2 = IM where denotes the convolution operation. (Assume zero-padding) Question 4.2: For a convolution kernel f = ( f + f2 )/2, we define IQ0 = IQ f and IT0 = IT f. Compute IQ0, IT0 and D(IQ0, IT0 ) by hand. Compare it with D(IQ, IT ) and briefly explain what you find. 5 Camera Model and Camera Projection Question 5. Camera Sensor Size: Choose a digital camera that you own, for example: a mobile phone. What is the height (mm) and width (mm) of its image sensors (front-facing and back)? You can find this by looking it up on the internet. Please include the web address as a reference. How does the sensor size affect the field of view of the camera? Question 5.2 Pixel Size: What is the image sensor resolution of the back camera? Compute the size of a pixel in millimeters. Question 5.3 Focal Length: What is the focal length of your camera (front-facing and back)? You can find this by looking it up on the internet. Please include the web address as a reference. Also, compute the focal length of your back camera by measuring its field of view and using the size of its sensor. How similar are they? Ignore the difference caused due to autofocus. How does the focal length of the camera affect its field of view? Question 5.4 Camera Matrix: Compose the intrinsic camera matrix for your digital camera. Assume the axis skew to be zero. Question 5.5 Depth of an Object: Using your digital camera, capture a picture of your friend (say F) with known height (in meters) standing some distance in front of Benjamin Franklin (say B) in front of College Hall at the University of Pennsylvania as shown in the Figure 5.5(a) and Figure 5.5(b). Please ensure that the camera plane is perpendicular to the ground plane while capturing the image. Figure 5.5(a): Front View Figure 5.5(b): Side View

Question 5.5.: Given the height H F (in meters) of F and pixel height h F, compute the distance from F to the camera (in meters). Show all your work. Question 5.5.2: Given the height H B (23 inches) of B and pixel height h B, compute the distance from B to the camera (in meters). Show all your work. Question 5.6 Dolly Zoom: Capture two images with different camera positions in the same setting as Question 5.4, taking a few steps, d backwards for the second image as shown in Figure 5.6(a). F and B should appear smaller in the second image since d is positive. Simulate the Dolly Zoom effect by scaling up and cropping the second image as shown in Figure 5.6(b) such that your friend is the same pixel height in both the images. Figure 5.6(b): Scaling up and Cropping Figure 5.6(a): Geometry of Dolly Zoom Question 5.6.: Given pixel height h B in the first image, compute the pixel height of B, h B in the second image. Show all your work. Question 5.6.2: Measure the pixel height of B, h B in the second image. Are they close to each other? Question 5.6.3: If we want to increase h B three times while keeping h F the same, what should be the new camera position and focal length of the camera? Assume that your camera has an optical zoom. Question 5.6.4: (Optional) Create a.gif of the Dolly Zoom effect in the given setting by capturing more than two images.