# ECE516 2015, Lab 2: Algebra in images

## Part 1: Law of composition for 2 images of the same subject matter under different illumination

In the first part of this lab, you'll combine 2 pictures that differ only in their illumination.

Take 3 pictures: image v1 with light source "A" turned on; image v2 with light source "B" turned on; image v3 with both light sources turned on.

Light sources "A" and "B" should be light sources that either intersect, at least in part, or they should substantially illuminate at least the same subject matter in intersecting ways.

For example, a desk lamp, and an overhead light, both lighting the same desk.

The pictures should differ only in illumination, i.e. the camera and its exposure should remain fixed. Exposure (the sensitivity of the camera) should stay constant in all regards (sensitivity, aperture, shutter speed, etc.).

Create a new image v12 from images v1 and v2, according to a law of composition v12 = (v1^n + v2^n)^(1/n), where n is any real non-negative number, after first scaling the images on the interval from 0 to 1, and then rescale the result onto the original interval.

Compare v12 with v3. Try n=1, n=1.5, n=2, n=2.5, n=10, and n=infinity or maximum value (i.e. the limit, as n increases without bound, v12 approaches max(v1,v2), an output pixel simply being the lighter of the two input pixels). For what value of n does v12 look most similar to v3?

## Part 2:

Develop a way of comparing v12 with v3 automatically, by computer. Develop an algorithm to find the best n.

## Optional part of lab: Additional bonus marks

Make a light wand ("3D AR mouse", or pointing device). Write patterns or trails in lights, using the law of composition of Part 1, and the value of n you found in Part 2, to combine multiple pictures, to combine at least 2 overlapping long exposure light traces.

Additional bonus marks for realtime capture and continuous display and compositing of images, so the trail of lights is displayed while it is being generated.

Additional bonus marks for creating a 3D Unity environment that follows the trail of lights in Unity, as a true 3D representation of the path taken by your wand's light source.