搜索
人大经济论坛 附件下载

附件下载

所在主题:
文件名:  walkers.zip
资料下载链接地址: https://bbs.pinggu.org/a-869328.html
本附件包括:
  • walkers.mat
附件大小:
  1. function walker(g)
  2. % WALKER Human gait.
  3. % This model, developed by Nikolaus Troje, is a five-term Fourier series
  4. % with vector-valued coefficients that are the principal components for
  5. % data obtained in motion capture experiments involving subjects wearing
  6. % reflective markers walking on a treadmill. The components, which are
  7. % also known as "postures" or "eigenwalkers", correspond to the static
  8. % position, forward motion, sideways sway, and two hopping/bouncing
  9. % movements that differ in the phase relationship between the upper and
  10. % lower portions of the body. The postures are also classified by gender.
  11. % Sliders allow you to vary the amount that each component contributes to
  12. % the overall motion. A slider setting greater than 1.0 overemphasizes
  13. % the characteristic. Can you see whether positive values of the gender
  14. % coefficient correspond to male or female subjects?
  15. %
  16. % References:
  17. % http://www.bml.psy.ruhr-uni-bochum.de/Demos
  18. % http://www.biomotionlab.de/Text/WDP2002_Troje.pdf
  19. % http://journalofvision.org/2/5/2

  20. clf
  21. shg
  22. set(gcf,'doublebuf','on','color','w','name','Walker','numbertitle','off')
  23. set(gca,'pos',get(gca,'pos')+[0 .07 0 0])

  24. % The body is represented by 15 points in three space, i.e. a vector of
  25. % length 45. The data consists of F, five vectors describing the average
  26. % female and M, five vectors describing the average male. Four linked
  27. % segments, indexed by L, are the head, torso, arms, and legs.

  28. % Initial view

  29. load walkers
  30. X = reshape((F(:,1)+M(:,1))/2,15,3);
  31. L = {[1 5],[5 12],[2 3 4 5 6 7 8],[9 10 11 12 13 14 15]};
  32. for k = 1:4
  33. p(k) = line(X(L{k},1),X(L{k},2),X(L{k},3),'marker','o', ...
  34. 'markersize',10,'linestyle','-','erasemode','background');
  35. end
  36. set(p(1),'tag','head','userdata',zeros(1,3));
  37. axis([-750 750 -750 750 0 1500])
  38. set(gca,'xtick',[],'ytick',[],'ztick',[])
  39. view(160,10)

  40. % Sliders and controls

  41. labels = {'speed','stride','sway','hop','bounce','gender'};
  42. for j = 1:6
  43. switch j
  44. case 1, smin = 0; start = 1; smax = 3;
  45. case 6, if nargin == 0, g = 0; end
  46. smin = -3; start = g; smax = 3;
  47. otherwise, smin = -2; start = 1; smax = 2;
  48. end
  49. txt = uicontrol('style','text','string',sprintf('%4.2f',start), ...
  50. 'back','w','units','norm','pos',[.16*j-.10 .11 .08 .03]);
  51. sliders(j) = uicontrol('style','slider','units','norm','back','w', ...
  52. 'pos',[.16*j-.13 .07 .14 .03],'min',smin,'max',smax,'val',start, ...
  53. 'sliderstep',[1/(4*smax),1/(10*smax)],'userdata',txt,'callback',...
  54. 'set(get(gco,''userd''),''str'',sprintf(''%4.2f'',get(gco,''val'')))');
  55. uicontrol('style','text','string',labels{j},'back','w', ...
  56. 'units','norm','pos',[.16*j-.12 .02 .10 .04])
  57. end
  58. stop = uicontrol('style','toggle','units','norm','pos',[.91 .94 .08 .05], ...
  59. 'backgr','w','fontw','bold','string','stop');
  60. uicontrol('style','radio','units','norm','pos',[.015 .96 .03 .03], ...
  61. 'userdata',H,'background','white', ...
  62. 'callback',['p1 = findobj(''tag'',''head''); if get(gco,''val''),' ...
  63. 'set(p1,''userd'',get(gco,''userd''),''marker'',''none''),' ...
  64. 'else, set(p1,''userd'',zeros(1,3),''marker'',''o''), end']);

  65. % uicontrol('style','text','units','norm','pos',[.72 .25 .25 .08], ...
  66. % 'backgr','white','fontangle','italic', ...
  67. % 'fontsize',get(0,'defaultuicontrolfontsize')-2, ...
  68. % 'string',{'Click on the figure','to change the view'})
  69. cameratoolbar setmode orbit

  70. % Start walkin'...

  71. period = 151.5751;
  72. omega = 2*pi/period;
  73. t = 0;
  74. while get(stop,'value') == 0
  75. s = cell2mat(get(sliders,'value'));
  76. t = t + s(1);
  77. c = [sin(omega*t); cos(omega*t); sin(2*omega*t); cos(2*omega*t)];
  78. X = (F+M)/2 + s(6)*(F-M)/2;
  79. w = [1; s(2:5).*c];
  80. X = reshape(X*w,15,3);
  81. H = get(p(1),'userdata');
  82. e = ones(size(H,1),1);
  83. XH = [H+X(e,:); X(5,:)];
  84. set(p(1),'xdata',XH(:,1),'ydata',XH(:,2),'zdata',XH(:,3))
  85. for k = 2:4
  86. set(p(k),'xdata',X(L{k},1),'ydata',X(L{k},2),'zdata',X(L{k},3));
  87. end
  88. pause(.0001)
  89. end;
  90. cameratoolbar close
  91. set(stop,'val',0,'str','close','fontw','bold','callb','close(gcf)')
复制代码


    熟悉论坛请点击新手指南
下载说明
1、论坛支持迅雷和网际快车等p2p多线程软件下载,请在上面选择下载通道单击右健下载即可。
2、论坛会定期自动批量更新下载地址,所以请不要浪费时间盗链论坛资源,盗链地址会很快失效。
3、本站为非盈利性质的学术交流网站,鼓励和保护原创作品,拒绝未经版权人许可的上传行为。本站如接到版权人发出的合格侵权通知,将积极的采取必要措施;同时,本站也将在技术手段和能力范围内,履行版权保护的注意义务。
(如有侵权,欢迎举报)
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

GMT+8, 2026-1-3 01:12