600.445 Homework 2
 

    This is a programming assignment. You are encouraged to work in small teams of 2-3 people, provided that each member of the team contributes substantially to the writing of the programs. Ideally, you should split the coding so you each do about equal parts, although you may organize this as you please. However, don't just latch onto a group and try to ride for free. You'll only cheat yourself. Everyone in each team should do at least some of the programming and you should all help with the debugging. All members of a team will receive the same score/grade for the assignment.

    One week before the due date, I'll make test data sets available.
You should hand in:

     You are free to use standard utility packages, such as linear equation solvers or a standard least squares solver. Some pointers include
 

If you do not have access to a suitable package, please see me ASAP. I heartily recommend the book Numerical Recipes in C, from Cambridge University Press. This book has several ways to solve systems of linear equations, with varying efficiency properties. I will arrange for a copy to be placed on reserve. The following subroutine,

void solve(int n, float** A, float* b) {
int*   index = (int*) malloc(n*sizeof(int));
        float* d;
        ludcmp(A,n,indx,&d);
        lubksb(A,n,indx,b);
        free indx;}

will solve the n x n system Ax = b and return the answer in b. It will replace A with the LU decomposition of A. (You don't need to understand this to do the homework.). The code for lubksb and ludcmp are in Section 2.3 of my copy of the book. Anyone reading the book is permitted to make one copy of any code in the book for his or her own use, and it is also possible to buy a diskette with all the software on it.
    One way (not the best, but adequate) to solve the least squares problem

Ax » b

where A is an m x n matrix and m > n, is to produce the n x n square system of equations

(AtA)x = Atb

and solve for x.

PROBLEM 1

Write a calibration program for the planar manipulator described in class. The input data for this program will consist of a file with the following information
    In other words, the first line will give the approximate values for each link length. The next records will give nominal angle values together with a measured tip position, as reported by an extremely accurate, all knowing ``ground truth'' 3D position sensor. Your program needs to Your program needs to estimate

and print out these values.

All numbers will be in standard floating point format (e.g., 99.9).

 

PROBLEM 2:

    Write a program to calibrate a fluoroscopic x-ray image intensifier tube and register it to a coordinate system defined by a calibration fixture. The calibration fixture consists of two plates, both roughly parallel to the detector plate of the C-arm, which we will assume lies roughly in the XY plane of the calibration fixture coordinate system with the source somewhere up the Z axis in the vicinity of [0,0,1000]. The calibration input data consists of a file consisting of records of the form
n,px,py,pz,u,v, <eol>

where n = plate number (1 or 2); [px,py,pz] = location of fiducial feature in fixture coordinates. And [u,v] = image coordinates of fiducial feature.

 

The last line of the file will consist of ``0,0,0,0,0<eol>''.

Write a function that accepts as input an image coordinate pair (u,v) and computes the coordinates of two points through which the ray corresponding to (u,v) passes. In particular, for (u,v) compute two points

[x0,y0,0]

and

[x1000,y1000,1000]

on the ray passing through the detector at image (not physical) coordinate (u,v). The test data will consist of a file of image coordinates (u,v,<eol>)for which the program is to print out the ray data.