I am writing a code that takes a webcam feed and tracks the person on it, I have then put a gif in place of the person, I now want to rotate the gif to match the direction of movement so that it looks like it is walking that way.
This is for my final unin project that is due next week please help !!!
I have tried using rotate (), push and pop and translate and i just cannot get the gif to rotate. I am new to p5, so there may be something I am just missing but I have explored every option I can find.
var gif
var angle = 0
let video;
let poseNet;
let poses = [];
function modelReady() {
console.log("ready");
}
function preload (){
gif = createImg("ant gif.gif")
}
function setup() {
createCanvas(640, 480);
video = createCapture(VIDEO)
video.size(width, height);
video.hide();
imageMode (CENTER)
angleMode(DEGREES)
poseNet = ml5.poseNet(video, { maxPoseDetections: 8 } );
poseNet.on("pose", function (results) {
poses = results;
});
}
function draw() {
background(255)
if (poses[0]){
gif.position(width - poses[0].pose.nose.x, poses[0].pose.nose.y)
}
gif.size(100,100)
}
jessie is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.