mediapipe-pose-smooth
Version:
This will remove the jitter and smooth the landmarks given by Mediapipe
3 lines (2 loc) • 993 B
JavaScript
!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(n||self).mediapipePoseSmooth=e()}(this,function(){var n=[],e=[];return function(t,r){if(t.poseLandmarks&&n.push(t.poseLandmarks),8===n.length){for(var i=function(t){var r=n.map(function(n){return n[t].x}),i=n.map(function(n){return n[t].y}),u=n.map(function(n){return n[t].z}),o=n.map(function(n){return n[t].visibility});r=r.sort(function(n,e){return n-e}),i=i.sort(function(n,e){return n-e}),u=u.sort(function(n,e){return n-e}),o=o.sort(function(n,e){return n-e}),r=r.slice(2,6),i=i.slice(2,6),u=u.slice(2,6),o=o.slice(2,6),e[t]={x:r.reduce(function(n,e){return n+e},0)/r.length,y:i.reduce(function(n,e){return n+e},0)/i.length,z:u.reduce(function(n,e){return n+e},0)/u.length,visibility:o.reduce(function(n,e){return n+e},0)/o.length}},u=0;u<33;u++)i(u);n.shift()}return e.length>0&&(t.poseLandmarks=e),r?r(t):t}});
//# sourceMappingURL=index.umd.js.map