c1 = 0.8; c2 =0.2; anglebetweencomponents = 30; speedratio = 1.5; [imarray,movieframes] = MakePlaidMovie(c1,c2,anglebetweencomponents,speedratio); % to show the movie, you can use: movieview(movieframes); % if you want it to repeat twice, you can do movieview([movieframes movieframes]) % or play backwards movieview(movieframes(end:-1:1)) % now compute the image derivatives [Ix,Iy,It]=ComputeImageDerivs(imarray); % to compute the velocity likelihood, first selection a spacetime region pixellocation_ijt =[32 32 16]; % y=32, x=32, t=16 % and choose the size of the averaging window window_sigma = 8; % velocity range to compute the likelihood over vellims = [-3 3]; % if you want this chosen automatically, leave this blank. % finally, decide how noisy our measurements are Measure_sigma=1; % compute the likelihood of vx,vy for a range of vx and vy [p_Igivenv,Vx,Vy] = ComputeVelLikeli(Ix,Iy,It,Measure_sigma,pixellocation_ijt,window_sigma,vellims); % %compute the prior on vx, vy % choose Prior_sigma Prior_sigma = 1; P_v = ComputePrior(Vx,Vy,Prior_sigma); Posterior_v = (p_Igivenv.*P_v)/sum(sum(p_Igivenv.*P_v)); % finally you can visualize the effects of the components and the % probabilities % for example, to view the area in the original movie and the likelihood % for that region, call ShowPdistandMovieFrames(imarray,pixellocation_ijt,window_sigma,p_Igivenv,Vx,Vy); % for example, to view the area in the temporal derivative and the % posterior % for that region, call ShowPdistandMovieFrames(It,pixellocation_ijt,window_sigma,Posterior_v,Vx,Vy);