Date post: | 21-Dec-2015 |
Category: |
Documents |
View: | 217 times |
Download: | 1 times |
Images
• imread(filename) reads image as:– h x w (greyscale) or– h x w x 3 (color)– uint8, values in [0, 255].
• Do alignment in greyscale, doubles.A=double(imread(filename));
if size(A,3)==3 A = rgb2gray(A); end• imshow(A) with double A assumes colors are in
[0, 1]. So divide by 255 before imshow() at some point.
Parts of Assignment
• Paradigm: Write an error function, then minimize that function.
• Part 1: Image difference– F(x, y, theta) => Error– Want to minimize error.
• Part 2: Minimization– Minimizing a function of n variables is a well-studied
problem, general solutions are known.
Image Difference
• Overlap region image 1's region.• So in image 1's coordinates, can represent
overlap region with a mask,
1 = overlap, 0 = no overlap.
Mask
• If A, B are pair of images, then
imtransformSimple(B, [x y θ]) transforms
image B.
• To find mask, transform array of all ones with same parameters.
Image Difference
• Now follow directions of assignment: use mask to find sum squared difference.
• Use .* (element-wise product) operator, not * (matrix product) when multiplying mask against an image.
Minimization
• Given F(x, y, θ) (F: R3 → R).• Find vector [x y θ] minimizing F.• If smooth, can find local minimum by general
algorithm.• So treat F as a black box and solve minimization
independently of the previous part.• Golden Section search finds local minimum of
1D function.• Do Golden Section search for dimensions i=1, 2,
3, then repeat => taxicab minimization.
Minimization
• For convenience, loop over the dimension i that you're minimizing via Golden Section search (write F as a vector function).
• Extra credit: plot [x, y, θ] points that the algorithm searches over in 3D (use plot3()), observe zig-zagging of taxicab minimization.