I'm trying to create a hand to mouse movement system, however I am experiencing value fluctuations due to the PoseNet model. The way it works is this: PoseNet runs in the browser, then sends request to a local Flask server, which moves the mouse. I'm not sure what the best way to fix this would be - some sort of smoothing system after the co-ordinates are recieved by Python, or a PoseNet adjustment. I can't increase the quality as this would slow the process and movements would be jagged without a major re-thinking of the system. My code is below:
poseNet = ml5.poseNet(video, {
flipHorizontal: true
});
// When the model is loaded
function modelLoaded() {
console.log('Model Loaded!');
}
// Listen to new 'pose' events
poseNet.on('pose', (results) => {
console.log(results)
poses = results[0]
keypoints = poses["pose"]
console.log(keypoints)
var leftWrist = keypoints["leftWrist"]
console.log(leftWrist)
var leftX = leftWrist["x"]
var leftY = leftWrist["y"]
var rightWrist = keypoints["rightWrist"]
var rightX = rightWrist["x"]
var rightY = rightWrist["y"]
});