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

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

6.869 Advances in Computer Vision Spring 2010, A. Torralba

Photography Help Sheets

Nova Full-Screen Calibration System

Photographing Long Scenes with Multiviewpoint

Home Lab 3 Pinhole Viewer Box Continued and Measuring the Diameter of the Sun

DIGITAL PHOTOGRAPHY CAMERA MANUAL

FOCUS, EXPOSURE (& METERING) BVCC May 2018

Unit 5.B Geometric Optics

How to Take a Great Booth Picture by Larry Berman

Creating Stitched Panoramas

Midterm Examination CS 534: Computational Photography

Computer Vision Slides curtesy of Professor Gregory Dudek

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

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

CPSC 425: Computer Vision

Basic principles of photography. David Capel 346B IST

CAMERA BASICS. Stops of light

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

Chapter 6-Existing Light Photography

Get the Shot! Photography + Instagram Workshop September 21, 2013 BlogPodium. Saturday, 21 September, 13

LENSES. INEL 6088 Computer Vision

Which equipment is necessary? How is the panorama created?

To start there are three key properties that you need to understand: ISO (sensitivity)

Comparison of the diameter of different f/stops.

Image Formation. Dr. Gerhard Roth. COMP 4102A Winter 2015 Version 3

Instructions for the Experiment

Basics of Photogrammetry Note#6

Chapter 11-Shooting Action

Reikan FoCal Aperture Sharpness Test Report

Computer Vision. The Pinhole Camera Model

AgilEye Manual Version 2.0 February 28, 2007

CSC Stereography Course I. What is Stereoscopic Photography?... 3 A. Binocular Vision Depth perception due to stereopsis

This talk is oriented toward artists.

CSE 527: Introduction to Computer Vision

Funded from the Scottish Hydro Gordonbush Community Fund. Metering exposure

ECEN. Spectroscopy. Lab 8. copy. constituents HOMEWORK PR. Figure. 1. Layout of. of the

Reikan FoCal Aperture Sharpness Test Report

Standard Operating Procedure for Flat Port Camera Calibration

Quintic Hardware Tutorial Camera Set-Up

Great (Focal) Lengths Assignment #2. Due 5:30PM on Monday, October 19, 2009.

Sharpness, Resolution and Interpolation

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

Focus Stacking Tutorial (Rev. 1.)

Overview. Pinhole camera model Projective geometry Vanishing points and lines Projection matrix Cameras with Lenses Color Digital image

How do we see the world?

Home Lab 2 Pinhole Viewer Box

Reikan FoCal Aperture Sharpness Test Report

Capturing Realistic HDR Images. Dave Curtin Nassau County Camera Club February 24 th, 2016

Using PhotoModeler for 2D Template Digitizing Eos Systems Inc.

Working with your Camera

Reikan FoCal Aperture Sharpness Test Report

High Dynamic Range Photography

TAKING GREAT PICTURES. A Modest Introduction

Reikan FoCal Aperture Sharpness Test Report

Lens Aperture. South Pasadena High School Final Exam Study Guide- 1 st Semester Photo ½. Study Guide Topics that will be on the Final Exam

FRAUNHOFER AND FRESNEL DIFFRACTION IN ONE DIMENSION

As can be seen in the example pictures below showing over exposure (too much light) to under exposure (too little light):

P202/219 Laboratory IUPUI Physics Department THIN LENSES

Lenses, exposure, and (de)focus

Projection. Announcements. Müller-Lyer Illusion. Image formation. Readings Nalwa 2.1

Camera Exposure Modes

Modeling and Synthesis of Aperture Effects in Cameras

Aperture Explained. helping you to better understand your digital SLR camera SLR PHOTOGRAPHY GUIDE

Term 1 Study Guide for Digital Photography

Name: Date: Math in Special Effects: Try Other Challenges. Student Handout

6.098 Digital and Computational Photography Advanced Computational Photography. Bill Freeman Frédo Durand MIT - EECS

ECEN 4606, UNDERGRADUATE OPTICS LAB

Forest Inventory System. User manual v.1.2

EXPOSURE TIPS. Camera shake causing blurry pictures

Name Digital Imaging I Chapters 9 12 Review Material

Cameras. CSE 455, Winter 2010 January 25, 2010

English PRO-642. Advanced Features: On-Screen Display

Intro to Digital SLR and ILC Photography Week 1 The Camera Body

OUTDOOR PORTRAITURE WORKSHOP

Photography Basics. Exposure

Understanding and Using Dynamic Range. Eagle River Camera Club October 2, 2014

1 / 9

HDR videos acquisition

Sensors and Sensing Cameras and Camera Calibration

Exposure settings & Lens choices

Aperture & ƒ/stop Worksheet

Introduction to Digital Photography

One Week to Better Photography

The Bellows Extension Exposure Factor: Including Useful Reference Charts for use in the Field

Exercise questions for Machine vision

Volume 1 - Module 6 Geometry of Aerial Photography. I. Classification of Photographs. Vertical

3D Capture. Using Fujifilm 3D Camera. Copyright Apis Footwear

3D Capture. Using Fujifilm 3D Camera. Copyright Apis Footwear

Optics. Experiment #4

Laboratory experiment aberrations

IMAGE SENSOR SOLUTIONS. KAC-96-1/5" Lens Kit. KODAK KAC-96-1/5" Lens Kit. for use with the KODAK CMOS Image Sensors. November 2004 Revision 2

3D Flaming Liquid Group Gamma Project 3

3DUNDERWORLD-SLS v.3.0

PTC School of Photography. Beginning Course Class 2 - Exposure

Problem Set 3. Assigned: March 9, 2006 Due: March 23, (Optional) Multiple-Exposure HDR Images

Team Second Peter Brunsgaard. Flow Visualization. Professor Jean Hertzberg. 1 P a g e

Introduction to 2-D Copy Work

Multi Viewpoint Panoramas

Photography. Taking better photos

Transcription:

Princeton University COS429 Computer Vision Problem Set 1: Building a Camera What to submit: You need to submit two files: one PDF file for the report that contains your name, Princeton NetID, all the pictures taken and text to answer the questions; one ZIP file (not RAR or any other format) that contains all source code for your system, and a main.m file that takes no parameter as input and run directly in Matlab to generate the results reported in your PDF file. Both the PDF and ZIP file should be named using your Princeton NetID underscore cos429ps1. As an example using my account, they should be named xj cos429ps1.pdf and xj cos429ps1.zip. To verify your result and detect plagiarism to make sure there is no cheating, we will use an automatic program to run your code and compare your code with other students (including both this year and all previous years) and public available implementations (e.g. from Google, Bing, Github). Therefore, please follow the file format to make our grading job easier. Failure to follow these rules will result in losing your grade. Awards: We will give some awards to people who build a special camera, such as biggest camera award, smallest camera award, craziest camera award, lightest camera award. Please write down what is special about your construction! Problem 1 Build the camera obscura You need to build your own camera obscura, or pinhole camera. A camera obscura is a dark chamber with a single hole in one extreme that lets light in. The light gets projected into the opposite wall forming an image. In order to capture the projected image we will use a digital camera. One of the problems with pinhole cameras is that the amount of light that enters the device is very small. Therefore, we will need to use long exposure time to capture images with enough contrast. Many digital cameras with a manual mode allow setting the exposure time. We used a Canon DSLR for the pictures in this problem set. Let s first start building the device (we followed the instructions in here 1 ): 1. Take a box (we used a card box with 11 9 15 inches). 2. Make a hole in the center of one of the faces. The hole has to be small (a diameter of 5 milimeters). 3. Make a second hole so that you can fit the lens of the camera inside (if your box is big enough to contain your digital camera and you can set auto-capture or wirelessly control the camera, then you don t need a second hole). 4. Cover the inside walls with black paper to reduce inter-reflections. 1 http://www.foundphotography.com/photothoughts/archives/2005/04/pinhole_camera.html 1

5. Cover the inside wall facing the pinhole with white paper. The white paper will be the screen on which the image will be projected. The digital camera will be used to take pictures of the image that gets projected onto the white paper. Using a paper of standard size (e.g. standard letter size), will assist you in calibrating the camera later on (Section ). Figure 1: Building the pinhole camera. Figure 1 shows some pictures of our construction. In this construction, the distance between the pinhole and the white wall is 11 inches. The big hole visible in the pictures is the hole we used to insert the digital camera. The pinhole is a very small hole in the center and it is hard to see in these pictures. It is important that the camera fits tightly so that no light enters via that aperture. Make sure that light enters only via the small hole in the center of the box. Once you have built your camera obscura, take some pictures of your construction to put on the report. Report the size, and we will give an award to the biggest camera obscura built in the class. Problem 2 Take some pictures with your camera For this you will need a digital camera for which you can set the exposure time. We used a Cannon G11 with exposure time of 15 seconds and set the ISO to maximum sensibility. Figure 2 shows a few images taken with our setup. If the images appear too blurry, you can increase the sharpness by reducing the size of the hole. But then you will need to increase the exposure time. 2

Figure 2: Upper left: this is a picture of a bright light source. This picture makes the white screen on the back of the wall appear clearly. Upper right: a picture on a cloudy day. Bottom row: a couple of images we have taken during a sunny day. You need to take pictures under bright light (sunny day outdoors). But you can play first by shining a light at the hole. If you see nothing, then there might be something wrong with the camera settings. Explain the geometry of the construction and write down why the pictures appear slightly deformed. Problem 3 Calibration and image correction The captured images contain distortion due to the angle between the digital camera and the principle axis of the pinhole camera. If the digital camera could be precisely calibrated (i.e. we knew the exact angle and its distance to the image plane, we could calculate an exact homography that transforms the image from the digital camera viewpoint to the viewpoint of the pinhole. Since we cannot measure this accurately in our setup, we will use a simplified calibration procedure. At each time you setup your camera, take one picture with a strong light source that will make the four corners of the white sheet apparent (Figure 2 top left; this can also be done by reducing the contrast of a capture image). Write a small program H = calibrate(im) in MATLAB that allows you to mark those four corners manually on the image, and computes the (homogeneous) transformation matrix H that rectifies the camera distortion. To figure 3

(a) Captured image (b) Image correction tool (c) Rectified image Figure 3: Correcting projective distortions. Rectified Image Original Image Homography Homography Homography Figure 4: More example of homography rectificiation. out the dimensions of the white sheet when viewed from the pinhole direction at a distance focal length away, take a picture of the white sheet with your digital camera at the same focal length and height as the pinhole (this need only be done once). This process will give you four point correspondences, from which you can compute an homography that transforms one set of points to the other, as discussed in class. Note that this mapping will need to be computed each time you move your digital camera. You d might also want to add to your transformation matrix reflection about the x-axis. This will rectify the image and flip it with a single warp. Figure 3 shows an example of the rectification process. Figure 4 shows more examples. Hints: you can use the MATLAB function ginput or impoly for entering the corner locations, and the functions interp2 or griddata to warp the image. If your images are noisy, you can further play with different filtering techniques such as medfilt2. Extra credit (optional) Anaglyph camera obscura 4

One interesting aspect of this device is that you can build different types of cameras by playing with the shape of the pinhole. So, let s make a new kind of camera obscura. In particular, we can build a camera that produces anaglyph images in a single shot by making two pinholes instead of just one. There are several ways of taking stereo pictures and viewing them. The most common mechanism is that two pictures are taken independently (with two cameras) and then they are combined to form anaglyph images, or viewed with special devices (e.g., LCD shutter glasses, polarized 3d glasses, stereoscopes,...) that show each image from the stereo pair to each of the two eyes. Anaglyph images are a particular method to produce 3D images. Anaglyph images are formed by superimposing a pair of stereo images into two different color channels. They provide a 3D effect when viewed with color glasses. We will transform the camera obscura into an anaglyph camera obscura by making two holes and placing different color filters on each hole. This will produce an image that will be the superposition of two images taken from slightly different viewpoints. Each image will have a different color. Then, to see the 3D image we can look at the picture by placing the same color filters in front of our eyes. In order to do this, we used color glasses with blue and red filters: We used one of the glasses to get the filters and placed them in front of the two holes. Figure 5 shows two pictures of the two holes (top left) and the filters positioned in front of each hole (top right). On the bottom of that figure is a resulting 3D image, with the two views superimposed. That image should give you a 3D percept when viewed with anaglyph glasses. Suggestions: For this to work you will have to experiment with the distance between the two holes. We tried two distances: 3 inches and 1.5 inches. We found it easier to see the 3D for the 1.5 inches images. Try to take good quality images. Once you would have placed the color filters on each hole, you will need longer exposure times in order to get the same image quality than before. If the images are too blurry, it will be hard to perceive 3D. Also, as you increase the distance between the pinholes, you will increase the range of distances that will provide 3D information. However, the images will be farther apart which makes the 3D perception harder. If the images are too far apart, the visual system will not be able to fuse them and you will not see a 3D image when looking with the color glasses. You can also try viewing the images by changing the image size. Extra credit (optional) Anaglyph camera obscura: A device to measure distances to objects We can all measure distances to an object by using a ruler. However, using a ruler is an intrusive procedure, as it requires physically placing one extreme of the ruler touching the 5

Figure 5: Anaglyph camera obscura. object. Some objects do not like to be constantly approached by rulers. Stereovision provides a way of measuring distances between the camera and other objects in the world remotely, without touching them. Figure 6 shows two example pictures of a light taken at two different distances. As you can see, a single light produces two spots in the picture. This is due to the fact that the light enters the camera obscura through two pinholes instead of one. Each spot has a different color because we placed two colored filters on each pinhole to form the anaglyph image. The interesting property is that the distance between the two spots, d, changes with respect to the distance, Z, between the camera and the light. Therefore, we could measure the distance Z to the light by just measuring d and if we had a perfect model of the geometry of the camera. We will do this in the next part. Extra credit (optional) Find the relation between the separation of the lights and distance Place the light at various known distances from the pinhole and take a set of pictures. You can decompose the anaglyph image into the images projected by each pinhole by visual- 6

Figure 6: Light at different distances as captured by the anaglyph camera izing the red and blue channels separately: img = imread ( yourfilename.jpg ); figure imshow([img(:,:,1); img(:,:,3)]) Plot the relationship between Z and d. You should think about the geometry of the camera in order to derive an analytical expression that relates the distance between the two spots in the picture with the distance of the light with respect to the camera and the parameters of the camera (distance to the back wall, separation between the two holes, etc.). Check that your predictions fit the experimental data. Extra credit (optional) A manual stereo algorithm In this part, the goal is to apply manually a stereo reconstruction algorithm. The goal is: given two images, to recover the full 3D structure of the image (we will only produce a coarse approximation to it). Automatic algorithms for measuring depths from stereo can be challenging. However, we will do it manually by following the next steps: 1. Take a picture with the anaglyph camera. Try to take a picture in which there are many clear elements that can be easily identified in the image. Also, select a scene with enough depth differences (with some elements very close to the camera and others far away). 2. Use MATLAB to select a number of matching points between the two color channels of the anaglyph image manually. 3. Use the function from the previous section that relates the horizontal distance between matching points to recover the distance between the camera and the selected points. 4. Now you will need to interpolate the distance in order to create a continuous image of depths. You can use the function griddata. Figure 7 (top) shows one example showing the red and blue channels of the stereo picture. We used the top image as the reference image, and then computed depth at a set of selected points on the top image. Once you have a depth map (the value of the distance at each pixel in the image), you can do different things like trying to rotate the image in 3D. Figure 7 shows two different viewpoints of the car. 7

Figure 7: Point correspondences (top) and viewpoint interpolation (bottom) of the car image. Acknowledgement: This assignment is designed based on a related assignment from MIT6.869. 8