CSC2529 – Homework1 Solved

$ 20.99
Category:

Description

Learning Goals
In this homework, you will learn about and experiment with pinhole cameras. This will help you understand the very basics of how to form an image with a camera-like instrument. Most of all, we hope you have fun tinkering with your pinhole camera! You will also learn how to load images in Python, take a 2D Fourier transform, edit and compose images in the Fourier domain, and plot and save these images. This exercise will help you get up to speed with basic image processing tasks in Python.
Instructions
Tasks 1 and 2 are a project in which you will build a pinhole camera from a cardboard box and record photographs with it. No programming is necessary for this part of the assignment. Students can work in teams of up to 3 people, but each student has to submit their own assignment and specify who was in the team.
You should document all your answers, plots, and derivations in a single pdf file containing all requested results and the scripts that generated these results. Submit your solution to Gradescope. Solutions to tasks should be on separate pages and include text, images, and code.
Task 1 of 3: Build a Pinhole Camera (30 points)
Construct a pinhole camera from a cardboard box. A shoebox should work.
1. Get the box.
2. Get or borrow a digital camera that allows you to take long exposures (15–60 seconds). You can also use your cellphone camera, but you need to make sure that you can take a long exposure and that you can mount it super rigidly; also use a self timer, so that it doesn’t move at all while exposing!
3. Determine which face of the inside of your box will be the screen. Make sure that the distance between screen and the opposite box side is longer than the shortest distance your camera can focus. You cannot capture a sharp photograph with your pinhole camera if your digital camera cannot focus on the screen.
4. Cover the screen with a sheet of white paper. Cover the rest of the inside of the box with black paper or just paint it.
5. Cut a large hole into the opposite side of the screen. This hole should be bigger than the pinhole (1/2”-1” diameter).
6. Pierce the pinhole into a separate piece of (black) paper – tape in over the bigger hole in the box so that light only enters through the pinhole. Make three separate pinholes with the following diameters: 0.1 mm, 3 mm, and 5 mm.
7. Cut a hole for your digital camera lens next to the pinhole. Make sure you don’t block the light path inside or outside the box with the digital camera. This hole should be absolutely light tight – make sure no light enters through this hole. Attach your camera there.
9. Take photographs of your pinhole box camera (e.g., with your cell phone) and report on your design decisions, such as screen size, distance between screen and pinhole (focal length), and field of view. What is the optimal pinhole diameter for your camera design? (see https://en.wikipedia.org/wiki/Pinhole_camera)
What you need to submit for this task: the photos of your pinhole camera and a few sentences or paragraphs of text on your design decisions (see 9).

Task 2 of 3: Take Photos with your Pinhole Camera (45 points)
Capture at least 3 photographs with each of the 3 pinholes (0.1 mm, 3 mm, 5 mm) (9 photographs in total). Report on the differences you observe for the different pinholes.
Experiment with your camera settings! If your photographs are blurry, it could be either because (i) your camera is not focused correctly onto the screen or (ii) the pinhole is too large. To make sure (i) is not the case, place a piece of paper with text on the screen and take a photo (or look at the viewfinder of your digital camera) with your box open. Make sure the camera is focused on the screen. If your pinhole is too big (ii), try another one that is smaller. If your images are too bright, reduce the exposure time and make sure the box is light tight. If your images are too dark, increase the exposure time and make sure light enters through the pinhole.
Task 3 of 3: Hybrid Images (25 points)
Hybrid images. Merge two different images into a single image, such that when printed and observed, one image is visible when you are close and the other is visible when you are far away from the print.
1. Given an image with a resolution of 1001×1001 pixels and printed with 300 dpi, what is the physical image size on the printout (in m, cm, or mm)? How many pixels of the printed image fall into 1◦ (degree) of visual angle when the viewer is at a distance of 40 cm and when the viewer is at a distance of 2 m away from the printed image?
2. Assuming that the peak of the contrast sensitivity function (CSF) is at 5 cycles per visual degree (cpd), which image frequency does that correspond to for the viewing distances of 40 cm and 2 m for the image in part 1? What is the image frequency half way between the peak CSF image frequencies for viewing distance 1 (40 cm) and viewing distance 2 (2 m)?
3. Convert the frequency found in 2) to pixels in the image after fft2 and report this frequency. Low-pass filter image1.png with a hard cutoff at this frequency and high-pass filter image2.png with the same frequency cutoff. Merge the two images and print the combined image (verify the physical image size after printing). Show the hybrid image in your solution and report on what you see when looking at the printed image from 40 cm and from 2 m.
Note: we have not covered low-pass and high-pass filters in class yet, but assume that you know these concepts from the course requirements. If you need a refresher, pay special attention in the problem session! Everything will be reviewed there.
Bonus Task (up to 5 points extra)
Record either a short stop-motion video clip with your pinhole camera or a time-lapse video. Each of the video clips should have at least 30 still frames. Submit your video in .mp4 or .mov format by sending a sharable link to it uploaded on your Google drive or Dropbox to the course staff.
Additional advice and troubleshooting
Some advice on several FFT-related functions of the numpy.fft package:
• Remember to use fftshift() and ifftshift(). When you call fft2() on an image, the frequency axis goes from 0 frequency, up to the highest frequency, and back down to zero. The fftshift() function will shift the spectrum so that 0 frequency is in the middle. Likewise, you need to call ifftshift() before using ifft2().
• To combine the low- and high-pass filtered spectra, just add the frequency components in the Fourier domain for each color channel – i.e., all FFT operations should be done separately for each color channel.
Questions?

Reviews

There are no reviews yet.

Be the first to review “CSC2529 – Homework1 Solved”

Your email address will not be published. Required fields are marked *