{"id":1373,"date":"2016-04-11T12:00:37","date_gmt":"2016-04-11T17:00:37","guid":{"rendered":"https:\/\/blogs.mathworks.com\/cleve\/?p=1373"},"modified":"2016-10-24T08:51:45","modified_gmt":"2016-10-24T13:51:45","slug":"the-eigenwalker-model-of-the-human-gait","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/cleve\/2016\/04\/11\/the-eigenwalker-model-of-the-human-gait\/","title":{"rendered":"The Eigenwalker Model of the Human Gait"},"content":{"rendered":"\r\n<div class=\"content\"><!--introduction--><p>A model of the human gait, developed by Nikolaus Troje, is a five-term Fourier series with vector-valued coefficients that are the principal components for data obtained in motion capture experiments involving subjects walking on a treadmill.<\/p><!--\/introduction--><h3>Contents<\/h3><div><ul><li><a href=\"#eccba35e-043c-4f99-ac16-62f14b235f62\">Nikolaus Troje<\/a><\/li><li><a href=\"#e3683329-bfa5-4ee2-a210-973d4857a72c\">Motion Capture<\/a><\/li><li><a href=\"#d8a036e6-2c2c-4d3e-90dc-80f25993d1bd\">Fourier and PCA<\/a><\/li><li><a href=\"#cc6cde48-f441-4ace-833b-20bda32376ea\">Eigenwalker<\/a><\/li><li><a href=\"#4c8e87ff-d027-44c8-8357-25e47dd12f05\">Principal Components<\/a><\/li><li><a href=\"#20a1c769-bfeb-4fd3-af30-5a5f1be91095\">Gender<\/a><\/li><li><a href=\"#95d67121-118e-4ff3-9a63-bdb4f34d3451\">Eigenwalker App<\/a><\/li><li><a href=\"#1fb37be6-b153-469e-930e-cf95390b65eb\">Disclaimer<\/a><\/li><li><a href=\"#e8ba57da-5d56-4b49-a773-a5cd73be972f\">References:<\/a><\/li><\/ul><\/div><h4>Nikolaus Troje<a name=\"eccba35e-043c-4f99-ac16-62f14b235f62\"><\/a><\/h4><p>Today's post is about work done several years ago by Nikolaus Troje when he was at Ruhr-Universit&auml;t in Bochum, Germany.  He has since moved to Queens University in Ontario, Canada, where he is head of the Biomotion Lab.  Here is their <a href=\"http:\/\/www.biomotionlab.ca\">Web page<\/a>.<\/p><p>Troje studies the human gait.  How exactly do we move when we walk? He also studies how we perceive others when they walk.  Can we tell if people are happy or sad just by the way they walk?  Can we determine if they are male or female?<\/p><p>To get a feeling for his work, take a look at this demo: <a href=\"http:\/\/www.biomotionlab.ca\/Demos\/BMLgender.html\">BMLgender<\/a>. When I first saw this demo it was being done with MATLAB, so I asked Troje about it and I have written and talked about it many times ever since.  (Today, the demo is computed in the web browser with Java Script.)<\/p><h4>Motion Capture<a name=\"e3683329-bfa5-4ee2-a210-973d4857a72c\"><\/a><\/h4><p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/cleve\/files\/NurBmlbild.jpg\" alt=\"\"> <\/p><p>Motion capture employs high speed cameras, lights, and reflectors attached to human subjects -- German grad students -- as they walk on a closed track or a treadmill.  Once a steady, comfortable pace is established for a single subject, 20 or so steps are recorded. At 120 frames per second, this results in typically 1440 frames. The data from the reflectors are collated into 15 standard locations on the head, arms, torso and legs.  As these points move in three dimensions the raw data captured is an array of time series with 45 rows and roughly 1440 columns.<\/p><p>Here are four of the subjects, with the data scaled so that they are all walking at the same speed.<\/p><p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/cleve\/files\/four_subjects.gif\" alt=\"\"> <\/p><h4>Fourier and PCA<a name=\"d8a036e6-2c2c-4d3e-90dc-80f25993d1bd\"><\/a><\/h4><p>The walking motion is periodic so Troje's model is a five-term Fourier series describing the position of the 15 spots in three dimensions.<\/p><p>$$ p(t) = v_1 + v_2 \\cos{\\omega t} + v_3 \\sin{\\omega t}\r\n       + v_4 \\cos{2 \\omega t} + v_5 \\sin{2 \\omega t} $$<\/p><p>Here $\\omega$, the scalar frequency, is the only nonlinear parameter. It is determined by Fourier analysis of the data. The coefficients $v_1$ through $v_5$ are <i>vectors<\/i> with 45 components. Once $\\omega$ is computed the $v$'s are obtained by <i>Principal Component Analysis<\/i> (also known as <i>Singular Value Decomposition<\/i>) of the data.  PCA effectively reduces the 45-by-1440 data matrix to a 45-by-5 coefficient matrix.<\/p><p>The frequency $\\omega$ and the coefficient matrix $V$ with columns $v_1, \\ldots, v_5$ are computed just once.  Then the motion can be computed for any time $t$ with a matrix-vector product.<\/p><p>$$ p(t) = V \\ [1 \\ \\cos{\\omega t} \\ \\sin{\\omega t} \\\r\n          \\cos{2 \\omega t} \\ \\sin{2 \\omega t}]^T $$<\/p><p>This model usually reproduces the raw data with better than 95% accuracy.<\/p><h4>Eigenwalker<a name=\"cc6cde48-f441-4ace-833b-20bda32376ea\"><\/a><\/h4><p>There were several dozen subjects, each with his or her characteristic coefficient matrix $V$.  Collect all these $V$'s  together into one giant set of coefficients.  Then use PCA again to reduce this to one average set of coefficients.  You get <i>eigenwalker<\/i>, the <i>everyman<\/i>. Or at least the <i>typisch deutsche junge Akademiker<\/i>.<\/p><p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/cleve\/files\/walker.gif\" alt=\"\"> <\/p><h4>Principal Components<a name=\"4c8e87ff-d027-44c8-8357-25e47dd12f05\"><\/a><\/h4><p>The <i>eigenwalker<\/i> has five vector coefficients $v_1, \\ldots, v_5$. These components don't have any inherent names -- they're just vectors that come out of the principal component analysis. But when we look at how they affect the motion, we can give them names. The first component, $v_1$, is simply the static position.  It determines how <i>eigenwalker<\/i> looks at rest.  Here are the other four components, one at a time.<\/p><p>The second coefficient, $v_2$, dominants the forward motion so we've called it \"stride\".  The third coefficient, $v_3$, controls a sideways motion so it gets named \"sway\".  The coefficients $v_4$ and $v_5$ drive vertical motions that are in-phase and out-of-phase with the stride; they get fairly arbitrary names of \"hop\" and \"bounce\".<\/p><p>When these four motions are added to the at-rest position, they give <i>eigenwalker<\/i>, which is a fairly realistic picture of the human gait.<\/p><p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/cleve\/files\/four_components.gif\" alt=\"\"> <\/p><h4>Gender<a name=\"20a1c769-bfeb-4fd3-af30-5a5f1be91095\"><\/a><\/h4><p>The PCA does not pick out gender as one of dominant components. But half of the subjects were female and half were male.  So we can compute a matrix of coefficients $F$ for the females and a matrix of coefficients $M$ for the males.  The top two figures below are the female <i>eigenwalker<\/i> and the male <i>eigenwalker<\/i>.  Without looking at the bottom two figures, can you tell which is which?<\/p><p>The bottom two figures overemphasize the gender bias.  They run the model with the difference between $F$ and $M$ tripled.  Now you can see which is which?<\/p><p>Disney and Pixar know this -- they have to exaggerate the motion to get the point across.<\/p><p>This is Troje's research.  How do humans determine the gender of other humans just by watching them walk?  Even better -- just by watching a stick figure, or 15 dots, walk?<\/p><p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/cleve\/files\/four_genders.gif\" alt=\"\"> <\/p><h4>Eigenwalker App<a name=\"95d67121-118e-4ff3-9a63-bdb4f34d3451\"><\/a><\/h4><p>The <i>Numerical Computing with MATLAB<\/i> collection of programs includes an app that lets you see the <i>eigenwalker<\/i> in action.  Sliders vary the strength of the five components and the gender bias.  You can also rotate the viewpoint. You will need two files, <tt>walker.m<\/tt> and <tt>walkers.mat<\/tt>, available from the <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/37976-numerical-computing-with-matlab\">MATLAB Central File Exchange<\/a>.<\/p><h4>Disclaimer<a name=\"1fb37be6-b153-469e-930e-cf95390b65eb\"><\/a><\/h4><p>This has been my own description of an approach that Troje took over a decade ago.  He has since replaced Principle Components Analysis with Fourier analysis to represent the movements of an individual walker, and has applied PCA to all sorts of other walker properties on the population level.  But I like his original approach because I am such a big fan of the SVD.  The following references are mostly about Troje's more recent work.<\/p><h4>References:<a name=\"e8ba57da-5d56-4b49-a773-a5cd73be972f\"><\/a><\/h4><p><a href=\"http:\/\/jov.arvojournals.org\/article.aspx?articleid=2192503\">&lt;http:\/\/jov.arvojournals.org\/article.aspx?articleid=2192503<\/a>&gt;<\/p><p><a href=\"http:\/\/www.biomotionlab.ca\/Text\/WDP2002_Troje.pdf\">&lt;http:\/\/www.biomotionlab.ca\/Text\/WDP2002_Troje.pdf<\/a>&gt;<\/p><p><a href=\"http:\/\/www.biomotionlab.ca\/Text\/trojeChapter07b.pdf\">&lt;http:\/\/www.biomotionlab.ca\/Text\/trojeChapter07b.pdf<\/a>&gt;<\/p><script language=\"JavaScript\"> <!-- \r\n    function grabCode_7ad843ed875a48d89b1385eda7974080() {\r\n        \/\/ Remember the title so we can use it in the new page\r\n        title = document.title;\r\n\r\n        \/\/ Break up these strings so that their presence\r\n        \/\/ in the Javascript doesn't mess up the search for\r\n        \/\/ the MATLAB code.\r\n        t1='7ad843ed875a48d89b1385eda7974080 ' + '##### ' + 'SOURCE BEGIN' + ' #####';\r\n        t2='##### ' + 'SOURCE END' + ' #####' + ' 7ad843ed875a48d89b1385eda7974080';\r\n    \r\n        b=document.getElementsByTagName('body')[0];\r\n        i1=b.innerHTML.indexOf(t1)+t1.length;\r\n        i2=b.innerHTML.indexOf(t2);\r\n \r\n        code_string = b.innerHTML.substring(i1, i2);\r\n        code_string = code_string.replace(\/REPLACE_WITH_DASH_DASH\/g,'--');\r\n\r\n        \/\/ Use \/x3C\/g instead of the less-than character to avoid errors \r\n        \/\/ in the XML parser.\r\n        \/\/ Use '\\x26#60;' instead of '<' so that the XML parser\r\n        \/\/ doesn't go ahead and substitute the less-than character. \r\n        code_string = code_string.replace(\/\\x3C\/g, '\\x26#60;');\r\n\r\n        copyright = 'Copyright 2016 The MathWorks, Inc.';\r\n\r\n        w = window.open();\r\n        d = w.document;\r\n        d.write('<pre>\\n');\r\n        d.write(code_string);\r\n\r\n        \/\/ Add copyright line at the bottom if specified.\r\n        if (copyright.length > 0) {\r\n            d.writeln('');\r\n            d.writeln('%%');\r\n            if (copyright.length > 0) {\r\n                d.writeln('% _' + copyright + '_');\r\n            }\r\n        }\r\n\r\n        d.write('<\/pre>\\n');\r\n\r\n        d.title = title + ' (MATLAB code)';\r\n        d.close();\r\n    }   \r\n     --> <\/script><p style=\"text-align: right; font-size: xx-small; font-weight:lighter;   font-style: italic; color: gray\"><br><a href=\"javascript:grabCode_7ad843ed875a48d89b1385eda7974080()\"><span style=\"font-size: x-small;        font-style: italic;\">Get \r\n      the MATLAB code <noscript>(requires JavaScript)<\/noscript><\/span><\/a><br><br>\r\n      Published with MATLAB&reg; R2016a<br><\/p><\/div><!--\r\n7ad843ed875a48d89b1385eda7974080 ##### SOURCE BEGIN #####\r\n%% The Eigenwalker Model of the Human Gait\r\n% A model of the human gait, developed by Nikolaus Troje, is a five-term\r\n% Fourier series with vector-valued coefficients that are the principal\r\n% components for data obtained in motion capture experiments involving\r\n% subjects walking on a treadmill.  \r\n\r\n%% Nikolaus Troje\r\n% Today's post is about work done several years ago by Nikolaus Troje when\r\n% he was at Ruhr-Universit\u00c3\u00a4t in Bochum, Germany.  He has since moved to\r\n% Queens University in Ontario, Canada, where he is head of the\r\n% Biomotion Lab.  Here is their <http:\/\/www.biomotionlab.ca Web page>.\r\n\r\n%%\r\n% Troje studies the human gait.  How exactly do we move when we walk?\r\n% He also studies how we perceive others when they walk.  Can we tell\r\n% if people are happy or sad just by the way they walk?  Can we determine\r\n% if they are male or female?\r\n\r\n%%\r\n% To get a feeling for his work, take a look at this demo:\r\n% <http:\/\/www.biomotionlab.ca\/Demos\/BMLgender.html BMLgender>.\r\n% When I first saw this demo it was being done with MATLAB, so I asked\r\n% Troje about it and I have written and talked about it many times ever\r\n% since.  (Today, the demo is computed in the web browser with Java\r\n% Script.)\r\n\r\n%% Motion Capture\r\n%\r\n% <<NurBmlbild.jpg>>\r\n%\r\n% Motion capture employs high speed cameras, lights, and reflectors\r\n% attached to human subjects REPLACE_WITH_DASH_DASH German grad students REPLACE_WITH_DASH_DASH as they walk on\r\n% a closed track or a treadmill.  Once a steady, comfortable pace is \r\n% established for a single subject, 20 or so steps are recorded.\r\n% At 120 frames per second, this results in typically 1440 frames.\r\n% The data from the reflectors are collated into 15 standard locations\r\n% on the head, arms, torso and legs.  As these points move in three\r\n% dimensions the raw data captured is an array of time series with\r\n% 45 rows and roughly 1440 columns.\r\n\r\n%%\r\n% Here are four of the subjects, with the data scaled so that they are\r\n% all walking at the same speed.\r\n%\r\n% <<four_subjects.gif>>\r\n%\r\n\r\n\r\n%% Fourier and PCA\r\n% The walking motion is periodic so Troje's model is a five-term Fourier\r\n% series describing the position of the 15 spots in three dimensions.\r\n% \r\n% $$ p(t) = v_1 + v_2 \\cos{\\omega t} + v_3 \\sin{\\omega t}\r\n%        + v_4 \\cos{2 \\omega t} + v_5 \\sin{2 \\omega t} $$\r\n%\r\n% Here $\\omega$, the scalar frequency, is the only nonlinear parameter.\r\n% It is determined by Fourier analysis of the data.\r\n% The coefficients $v_1$ through $v_5$ are _vectors_ with 45 components.\r\n% Once $\\omega$ is computed the $v$'s are obtained by _Principal Component\r\n% Analysis_ (also known as _Singular Value Decomposition_) of the\r\n% data.  PCA effectively reduces the 45-by-1440 data matrix to a 45-by-5\r\n% coefficient matrix.\r\n\r\n%%\r\n% The frequency $\\omega$ and the coefficient matrix $V$ with columns\r\n% $v_1, \\ldots, v_5$ are computed just once.  Then the motion can be\r\n% computed for any time $t$ with a matrix-vector product.\r\n%\r\n% $$ p(t) = V \\ [1 \\ \\cos{\\omega t} \\ \\sin{\\omega t} \\ \r\n%           \\cos{2 \\omega t} \\ \\sin{2 \\omega t}]^T $$\r\n%\r\n% This model usually reproduces the raw data with better than 95% accuracy.\r\n\r\n%% Eigenwalker\r\n% There were several dozen subjects, each with his or her characteristic\r\n% coefficient matrix $V$.  Collect all these $V$'s  together into one\r\n% giant set of coefficients.  Then use PCA again to reduce this to one\r\n% average set of coefficients.  You get _eigenwalker_, the _everyman_.\r\n% Or at least the _typisch deutsche junge Akademiker_.\r\n%\r\n% <<walker.gif>>\r\n%\r\n\r\n%% Principal Components\r\n% The _eigenwalker_ has five vector coefficients $v_1, \\ldots, v_5$.\r\n% These components don't have any inherent names REPLACE_WITH_DASH_DASH\r\n% they're just vectors that come out of the principal component analysis.\r\n% But when we look at how they affect the motion, we can give them names.\r\n% The first component, $v_1$, is simply the static position.  It\r\n% determines how _eigenwalker_ looks at rest.  Here are the other four\r\n% components, one at a time.\r\n\r\n%%\r\n% The second coefficient, $v_2$, dominants the forward motion so we've\r\n% called it \"stride\".  The third coefficient, $v_3$, controls a sideways\r\n% motion so it gets named \"sway\".  The coefficients $v_4$ and $v_5$ drive\r\n% vertical motions that are in-phase and out-of-phase with the stride;\r\n% they get fairly arbitrary names of \"hop\" and \"bounce\".\r\n\r\n%%\r\n% When these four motions are added to the at-rest position, they give\r\n% _eigenwalker_, which is a fairly realistic picture of the human gait.\r\n%\r\n% <<four_components.gif>>\r\n%\r\n\r\n%% Gender\r\n% The PCA does not pick out gender as one of dominant components.\r\n% But half of the subjects were female and half were male.  So we can\r\n% compute a matrix of coefficients $F$ for the females and a matrix of\r\n% coefficients $M$ for the males.  The top two figures below are the\r\n% female _eigenwalker_ and the male _eigenwalker_.  Without looking at\r\n% the bottom two figures, can you tell which is which?\r\n\r\n%%\r\n% The bottom two figures overemphasize the gender bias.  They run\r\n% the model with the difference between $F$ and $M$ tripled.  Now you\r\n% can see which is which?\r\n\r\n%%\r\n% Disney and Pixar know this REPLACE_WITH_DASH_DASH they have to exaggerate the motion to get\r\n% the point across.\r\n\r\n%%\r\n% This is Troje's research.  How do humans determine the gender of other\r\n% humans just by watching them walk?  Even better REPLACE_WITH_DASH_DASH just by watching a\r\n% stick figure, or 15 dots, walk?\r\n%\r\n% <<four_genders.gif>>\r\n%\r\n\r\n%% Eigenwalker App\r\n% The _Numerical Computing with MATLAB_ collection of programs includes\r\n% an app that lets you see the _eigenwalker_ in action.  Sliders vary the\r\n% strength of the five components and the gender bias.  You can also \r\n% rotate the viewpoint.\r\n% You will need two files, |walker.m| and |walkers.mat|, available from the\r\n% <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/37976-numerical-computing-with-matlab\r\n% MATLAB Central File Exchange>.\r\n%% Disclaimer\r\n% This has been my own description of an approach that Troje took over a\r\n% decade ago.  He has since replaced Principle Components Analysis with \r\n% Fourier analysis to represent the movements of an individual walker, \r\n% and has applied PCA to all sorts of other walker properties on the \r\n% population level.  But I like his original approach because I am\r\n% such a big fan of the SVD.  The following references are mostly about \r\n% Troje's more recent work.\r\n\r\n%% References:\r\n% <http:\/\/jov.arvojournals.org\/article.aspx?articleid=2192503\r\n% http:\/\/jov.arvojournals.org\/article.aspx?articleid=2192503>\r\n%\r\n% <http:\/\/www.biomotionlab.ca\/walking.php\r\n% http:\/\/www.biomotionlab.ca\/walking.php>\r\n%\r\n% <http:\/\/www.biomotionlab.ca\/Text\/WDP2002_Troje.pdf\r\n% http:\/\/www.biomotionlab.ca\/Text\/WDP2002_Troje.pdf>\r\n%\r\n% <http:\/\/www.biomotionlab.ca\/Text\/trojeChapter07b.pdf\r\n% http:\/\/www.biomotionlab.ca\/Text\/trojeChapter07b.pdf>\r\n\r\n##### SOURCE END ##### 7ad843ed875a48d89b1385eda7974080\r\n-->","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img src=\"https:\/\/blogs.mathworks.com\/cleve\/files\/feature_image\/walker.gif\" class=\"img-responsive attachment-post-thumbnail size-post-thumbnail wp-post-image\" alt=\"\" decoding=\"async\" loading=\"lazy\" \/><\/div><!--introduction--><p>A model of the human gait, developed by Nikolaus Troje, is a five-term Fourier series with vector-valued coefficients that are the principal components for data obtained in motion capture experiments involving subjects walking on a treadmill.... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/cleve\/2016\/04\/11\/the-eigenwalker-model-of-the-human-gait\/\">read more >><\/a><\/p>","protected":false},"author":78,"featured_media":1376,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[13,5,23,8],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/posts\/1373"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/users\/78"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/comments?post=1373"}],"version-history":[{"count":4,"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/posts\/1373\/revisions"}],"predecessor-version":[{"id":2074,"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/posts\/1373\/revisions\/2074"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/media\/1376"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/media?parent=1373"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/categories?post=1373"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/tags?post=1373"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}