## Second assignment

- First task: Tutorial: Computing 2D and 3D Optical Flow

You can easily find existing Matlab implementation on web to try-and-test optical flow algorithm.
- Second task: for pure landmark-based registration I'll recommend to read this nice paper before, thanks to Kristine Slot.

## Link to optimization software

- Congaratulations! We have an optimization software at DIKU, but still Otimization Software
thanks for Kevin Hejn.

## Useful Matlab tricks

- For homography transformations you can simply use
**imtransform** function.
- Don't forget: in Matlab origin of the image is in the left top corner. Try to apply P and P_prime homography with center in the middle of the image.

## Useful suggestions

- Fundamental matrixes are correct, try to follow this steps to rectify images
- Formulas for rotation around fixed point you can find here.
- To verify you translation and rotation matrices find out you new
epipoles and check up are the align with Ox axis or not? (Should be close to
**e=[1,0,*], e'=[1,0,*]** otherwise search for mistake)
**Do not calculate integrals without correct rotation and translations!!**

Integrals for calculation p1.
Plug in boundaries but don't trust me for 100% calculate them by yourself otherwise use Matlab numerical integration function **dblquad**.
- In the end don't forget that in Matlab by default origin of the image is in the left top corner and in our experiment
it is in the
**middle** of the image.

## Pf. Adriens comments

- Fundamental matrix that he give with any of the data sets is expressed with the origin in the
top-left hand corner. In order to move the origin to the image centre, you need to translate it
by half the size of the image, thanks to Dirk, Jakob and Kristine:

FF = T2^{-T}*F*T1^{-1}

where T1 = [1 0 -size(I0,1)/2; 0 1 -size(I0,2)/2; 0 0 1];

and T2 = [1 0 -size(I1,1)/2; 0 1 -size(I1,2)/2; 0 0 1].
- To vizualize epilines use this function.
- Instead of eig-function try to calculate epipoles

e1 = cross(F(1,:)',F(2,:)')+cross(F(2,:)',F(3,:)')+cross(F(3,:)',F(1,:)');

e2 = cross(F(:,1),F(:,2))+cross(F(:,2),F(:,3))+cross(F(:,3),F(:,1));
- If an epipole, say e1, is far from the image,ie if the epipolar lines are parallel, then you can't
divide by e1(3) since it will be close to 0.