source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/missing-data/unoccluded_motion2.m @ 98

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

Added original make3d

File size: 1.3 KB
Line 
1function [M, pts] = unoccluded2_motion(nframes,npoints,frot,ftrans)
2% This is an alternate motion generator.  The previous one had the property that the
3% if, for each frame, one takes the third row of the rotation matrix, these all lie in
4% a plane.
5
6% To avoid this, we'll add a little torque to the old method.  We'll rotate out of plane by
7% the same magnitude in another direction, but this time with angular acceleration.
8M = [];
9translation_mag = ftrans/(nframes-1);
10ip_rot = (pi/2)/(nframes-1);
11op_rot = (2*pi*frot)/(nframes-1);
12
13tor_rots = (0:nframes-1).*(1:nframes)./2;
14tor_rots = (2*pi*frot).*tor_rots./sum(tor_rots);
15tor_axis = 2*pi*rand(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
21depth_axis = 2*pi*rand(1);
22translation_dir = 2*pi*rand(1);
23translation_vec = translation_mag*[cos(translation_dir), sin(translation_dir),0];
24
25rpts1 = rotate_z_axis(pts,depth_axis);
26
27for fnum=0:nframes-1
28  tor_rot = tor_rots(fnum+1);
29  rpts2 = rotate_x_axis(rpts1,op_rot*fnum);
30  rpts3 = rotate_z_axis(rpts2,-depth_axis);
31
32  rpts3a = rotate_z_axis(rpts3,tor_axis);
33  rpts3b = rotate_x_axis(rpts3a,tor_rot);
34  rpts3c = rotate_z_axis(rpts3b,-tor_axis);
35
36  rpts4 = rotate_z_axis(rpts3c,ip_rot*fnum);
37  rpts5 = translate(rpts4,fnum*translation_vec);
38  M = [M',rpts5(1:2,:)']';
39end
40
41
Note: See TracBrowser for help on using the repository browser.