楼主: qibbxxt
1863 3

[程序分享] moler写的人行走的程序 [推广有奖]

  • 0关注
  • 2粉丝

大专生

78%

还不是VIP/贵宾

-

威望
0
论坛币
588 个
通用积分
114.3936
学术水平
8 点
热心指数
10 点
信用等级
1 点
经验
3898 点
帖子
59
精华
0
在线时间
64 小时
注册时间
2009-10-12
最后登录
2023-5-16

相似文件 换一批

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
  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)')
复制代码
二维码

扫码加我 拉你入群

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

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

关键词:Moler Mol OLE relationship coefficients 程序 Moler

2011031802.jpg (46.61 KB)

2011031802.jpg

walkers.zip

4.3 KB

本附件包括:

  • walkers.mat

沙发
murong2009 发表于 2011-3-18 13:54:03 |只看作者 |坛友微信交流群
高手真的是很多哦 见识一下

使用道具

藤椅
tulipsliu 在职认证  发表于 2011-4-28 12:53:49 |只看作者 |坛友微信交流群
是啊,很强。
是从看他为其他人写“动态随机优化“的程序来找他的帖子的。
论坛里强人多啊。
劳动经济学

使用道具

板凳
eagle1208 发表于 2013-7-18 21:46:14 |只看作者 |坛友微信交流群
牛人 厉害厉害

使用道具

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群

京ICP备16021002-2号 京B2-20170662号 京公网安备 11010802022788号 论坛法律顾问:王进律师 知识产权保护声明   免责及隐私声明

GMT+8, 2024-5-22 05:51