1) write a function that fits a line to data. It should get as input
vectors x,y and return a,b the parameters of the best fitting lines.
Test your function with
(a) x=0:0.05:1; y=2*x+1
(b) x=0:0.05:1; y=2*x+1+0.1*randn(size(x)).
(c) x=0:0.05:1;
y=(abs(x-0.5) < 0.25).*(x+1)+(abs(x-0.5) > =0.25).*(-x);
In all cases plot the data and the best fitting lines.
2) Write a function that estimates the parameters of two lines using EM. It should get as input vectors x,y and return (a1,b1), (a2,b2) the parameters of the two lines as well as the weight vectors w_1 and w_2. (Set the free parameter sigma^2=0.1.)
(a) test your function on the data in part (c) of the previous question: x=0:0.05:1; y=(abs(x-0.5) < 0.25).*(x+1)+(abs(x-0.5) > =0.25).*(-x); Plot the data and the two fitted lines as estimated after each of the first five iterations. Also, show in separate plots the membership vectors after every iteration.
(b) experiment with adding Gaussian noise to the y coordinates. How much noise can you add before the algorithm breaks.
3) write a function that does motion segmentation using EM. It should get as input the two frames as well as Vx,Vy - the output of optic flow. It should return the global translation parameters of the two models (u_1,v_1) and (u_2,v_2) and the two weight images w_1 and w_2.
Test your function on the following two sequences. (Display the flow
fields for the two images using displayFlow and the two weight images
as gray level images)
(a) a textured square moving over a static textured background.
problem3a.mat . (This is a
Matlab .mat file as in the previous problem set. Load it in
using the 'load' command and you will have i1,i2,vx,vy variables in
your workspace)
).
(b) same as above, but both images have noise added to them.
problem3b.mat . (Load it in
using the 'load' command and you will have i1N,i2N,vxN,vyN variables in
your workspace)
4) Compute the segmentation map for the previous problem by warping
the images and verifying as discussed in the tutorial. Is the
segmentation better?