Comments (1)
Hi @JimmyDevPasto, thank you for submitting this issue! The flipImage
function is no longer supported in the newest version of ml5.
If you would like to continue using an older library version with support for flipImage
, try version 0.12.2
. In the HTML file, change the version number of ml5 in the script tag from 1.0.1
or latest
to 0.12.2
. The script tag should be changed to something like this:
<script src="https://unpkg.com/[email protected]/dist/ml5.min.js"></script>
This should bring back the flipImage
function!
Below is some info if you decide to try the new version of the library.
The new version of the ml5 library handles the mirroring differently. The latest version of the p5.js library has a flipped
option for videos, which automatically flips a video when it is displayed. The new ml5 models also have a flipped
option when applicable, setting it to true will horizontally mirror the output landmarks/masks. Setting both options to true will correctly mirror both the video and the prediction output. Below is an example with handPose model.
In the HTML file, set p5 and ml5 to the latest versions:
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.9.4/p5.min.js"></script>
<script src="https://unpkg.com/[email protected]/dist/ml5.min.js"></script>
The sketch:
let handPose;
let video;
let hands = [];
function preload() {
// Load the handPose model
handPose = ml5.handPose({ flipped: true }); // <----- setting flipped to true
}
function setup() {
createCanvas(640, 480);
// Create the webcam video and hide it
video = createCapture(VIDEO, { flipped: true }); // <----- setting flipped to true
video.size(640, 480);
video.hide();
// start detecting hands from the webcam video
handPose.detectStart(video, gotHands);
}
function draw() {
// Draw the webcam video
image(video, 0, 0, width, height);
// Draw all the tracked hand points
for (let i = 0; i < hands.length; i++) {
let hand = hands[i];
for (let j = 0; j < hand.keypoints.length; j++) {
let keypoint = hand.keypoints[j];
fill(0, 255, 0);
noStroke();
circle(keypoint.x, keypoint.y, 10);
}
}
}
// Callback function for when handPose outputs data
function gotHands(results) {
// save the output to the hands variable
hands = results;
}
from ml5-next-gen.
Related Issues (20)
- add smoothing to BlazePose under `tfjs` HOT 2
- Question about `maskType` HOT 6
- Google search for reference leads to a non existing page HOT 2
- Posenet Model Does Not Load Suddenly HOT 2
- featureExtractor() not working HOT 1
- TypeError: ml5.objectDetector is not a function HOT 1
- `topk` in the `options` for `imageClassifier` doesn't work HOT 3
- Errors with ml5.js code (from prior to 1.0 release)!
- Configure issue template for ml5-next-gen repo HOT 4
- Use "good first issue" label on issues and add to contributing documentation HOT 1
- Specify version for yarn and node HOT 4
- Code and comment cleanup
- `bodyPose` and `bodySegmentation` failing to preload in p5 instance mode HOT 3
- Why the code can be run as local file normally about in June, but now cannot HOT 13
- `ml5.neuralNetwork` reorders labels that are numerical strings HOT 3
- BodySegmentation: flipped option doesn't work HOT 1
- imageClassifier not working in v1.0.1 HOT 3
- Research using Commitizen for standardizing release commit messages HOT 1
- Hide Debug Log Messages in Production
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ml5-next-gen.