source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/missing-data/unoccluded_motion.m @ 37

Last change on this file since 37 was 37, checked in by (none), 14 years ago

Added original make3d

File size: 1.2 KB
Line 
1function [M, pts] = unoccluded_motion(nframes,npoints,frot,ftrans)
2
3% To generate this, we'll consider a very simple situation in which the motion
4%   is constant, and the points are randomly chosen from within a cube.
5%   the cube in between 0 and 1 in each dimension, so the image will be
6%   roughly of size 1x1.
7%   We assume that the key variable is the amount of rotation in depth,
8%   so we'll make the in-plane rotation constant so that it adds up to
9%   ninety degrees, and the translation constant,
10%   in a random direction.
11
12M = [];
13translation_mag = ftrans/(nframes-1);
14ip_rot = (pi/2)/(nframes-1);
15op_rot = (2*pi*frot)/(nframes-1);
16
17pts = rand(4,npoints);
18pts(4,:) = ones(1,npoints);
19% points have x,y,z coordinates, and a 1 in the 4th row for translation.
20
21
22depth_axis = 2*pi*rand(1);
23%depth_axis = 0;
24translation_dir = 2*pi*rand(1);
25translation_vec = translation_mag*[cos(translation_dir), sin(translation_dir),0];
26
27rpts1 = rotate_z_axis(pts,depth_axis);
28
29
30for fnum=0:nframes-1
31  rpts2 = rotate_x_axis(rpts1,op_rot*fnum);
32  rpts3 = rotate_z_axis(rpts2,-depth_axis);
33  rpts4 = rotate_z_axis(rpts3,ip_rot*fnum);
34  rpts5 = translate(rpts4,fnum*translation_vec);
35  M = [M',rpts5(1:2,:)']';
36end
37
Note: See TracBrowser for help on using the repository browser.