# Homework

Current homework.

## Homework 6

Due: Tuesday 3 April 2012

Write a pipeline object that computes Harris corner detector weights given an input 2D (grayscale) image and two scale parameters, sigma_D and sigma_I. You can use either metric mentioned in Szeliski section 2.1.1.

First, compute the derivatives of the image using derivative of Gaussian filters (scipy.ndimage.filters.gaussian_filter1d). Remember, Gaussian filters are separable, so computing a derivative involves using two 1D filters: a Gaussian along one image axis and a 1st derivative of Gaussian along the other image axis. These Gaussians should use the same scale (sigma_D).

From the image derivatives, you can compute the three unique components of the image structure tensor. Each of these should then be filtered by a 2D Gaussian, performing a weighted averaging in an image region. Use a scale that is larger than the derivative scale (sigma_I). Finally, compute the Harris weights using either of equations (4.9) or (4.11).

Display the resulting Harris weight image. You'll want to do all your image computations with float pixel values and then normalize before displaying.

## Homework 5

Due: Thursday 8 February 2012

Read the paper by Pang et al., 2012. Read the paper for general concepts, not details. Briefly outline what is different about the authors' approach to dark current estimation and the approach you used in project 2.

## Homework 4

Due: Thursday 23 February 2012

For this project 2 checkpoint, your team should demonstrate a display pipeline object that displays live images from a video source. You should have a pipeline object that performs affine intensity adjustment (also known as gain/bias or contrast/brightness) through user interaction. Include the ability to do auto contrast.

Add a function to the affine intensity process object that adjusts contrast without changing the mean brightness of the image. In other words, there are three ways to control the scale and offset: modify the offset only, modify the scale only, or modify the scale while computing a new offset that does not change the mean output intensity.

Because contrast/brightness is a display-related adjustment, you could logically include an instance of this object within your display class. The affine intensity equation is:

## Homework 3

Due: Tuesday 21 February 2012

Get the sample FirewireVideo.py program working with the PGR Flea cameras in the lab. You will need to do this on bioimager, the iMac. Take a picture of one of the sample slides after performing proper Köhler alignment and send me the image.

## Homework 2

Due: Thursday 9 February

1. Create ndarrays containing the following data using a few concise expressions. Avoid setting the value of each element individually.
```[[1 1 1 1 1]
[1 1 1 1 1]
[1 1 1 0 0]
[1 1 1 0 0]
[1 1 1 0 0]]
```
```[[0 0 0 0 0 1 1 1 1]
[0 0 0 0 0 2 2 2 2]
[0 0 0 0 0 1 1 1 1]
[0 0 0 0 0 2 2 2 2]
[1 1 1 1 1 1 1 1 1]
[2 2 2 2 2 2 2 2 2]
[1 1 1 1 1 1 1 1 1]
[2 2 2 2 2 2 2 2 2]
[1 1 1 1 1 1 1 1 1]]
```
```[[ 1  2  3  4  5  6  7  8  9]
[ 2  4  6  8 10 12 14 16 18]
[ 3  6  9 12 15 18 21 24 27]
[ 4  8 12 16 20 24 28 32 36]
[ 5 10 15 20 25 30 35 40 45]
[ 6 12 18 24 30 36 42 48 54]
[ 7 14 21 28 35 42 49 56 63]
[ 8 16 24 32 40 48 56 64 72]
[ 9 18 27 36 45 54 63 72 81]]
```
2. Create a 5 x N array, the first row of which contains even numbers [2 ... 16]. The second and third rows should contain the minimum and maximum values of an unsigned integer represented by the number of bits in the first row. The fourth and fifth rows should do the same, but for signed integers. Your arrays should look like below (but you should construct them with expressions, not by copying these values).
```[[     2      4      6      8     10     12     14     16]
[     0      0      0      0      0      0      0      0]
[     3     15     63    255   1023   4095  16383  65535]
[    -2     -8    -32   -128   -512  -2048  -8192 -32768]
[     1      7     31    127    511   2047   8191  32767]]
```
3. Demonstrate that the following equation is true by writing a Python function and evaluating it for some values of n (clearly this is not a formal proof). Use NumPy arrays instead of loops. The numpy.cumsum function may be useful.

## Homework 1

Due: Tuesday 7 February

Look up and write down the standard numeric (integer and float) types and their ranges available in C. Include signed and unsigned integers.

Open one of the images below in ImageJ (installed on the Roberts 225 minis). What data type is used for a pixel?

Why is type important when performing image manipulations? How would you find the pixel-wise difference between two images?

Try computing a pixel-wise difference in ImageJ (Process -> Image calculator) with the following two images. Do you get the result you expect?

 This puzzle appeared in Globe on 28 November 2005.