-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Testing new p5 mirror function #106
Comments
This is great, thank you for digging into this @ziyuan-linn! Do I understand correctly that this already works without any changes to the ml5.js codebase and it's just a matter of properly documenting this? I wonder if we should create a page on the website all about "flipping video" since it is something that goes across all models. Can we apply the same Maybe we should follow p5.js's lead and introduce a |
@shiffman Yes, this should work without any changes to the codebase. I think a page on the website about this is a great idea! All of the image-based models already have a For the current ml5's API, options can only be passed in when loading the model. ml5 saves the (oops, I accidentally clicked close issue) |
Ah, that makes sense. I'm of two minds (1) It's good to use the actual language and properties of the underlying model as much as possible. I think I lean towards going with (2). How about we put I agree we shouldn't add it to This looks so nice and lovely to me: let video = createCapture(VIDEO, { flipped: true });
let handPose = ml5.handPose({ flipped: true }); |
@ziyuan-linn it occurred to me today that if you are making some adjustments / updates to the examples, we should include info on how to flip the video in them! |
@shiffman Sounds good! I think implementing Do you think the example sketches should be mirrored by default with comments/info on how to set them to not flipped, or vice versa? |
I was testing the new p5 mirror function released in
1.9.1
along with handPose.When mirroring is enabled with the following code:
this happens:
The webcam video is mirrored correctly but the handPose keypoints are still not mirrored.
ml5 runs inferences on the underlying HTML video element when given a p5 video element, which is probably never mirrored. Mirroring an HTML video element is not very straightforward, and I don't think it would make sense for p5 to do it.
Luckily, the tfjs models all have a
flipHorizontal
property. We could simply set it to true:and everything will work correctly:
We now have an intuitive two-line solution to the mirroring problem🎉! Perhaps we can add some mirrored examples? We can probably also mention this somewhere in the docs or the website.
The text was updated successfully, but these errors were encountered: