Oh, that naughty sketch! Please let us know what the issue is below.
Apply Template
Applying this template will reset your sketch and remove all your changes. Are you sure you would like to continue?
Report Sketch
Report Comment
Please confirm that you would like to report the comment below.
We will review your submission and take any actions necessary per our Community Guidelines. In addition to reporting this comment, you can also block the user to prevent any future interactions.
Please report comments only when necessary. Unnecessary or abusive use of this tool may result in your own account being suspended.
Are you sure you want to delete your sketch?
Any files uploaded will be deleted as well.
Delete Comment?
This will also delete all the replies to this comment.
Delete this tab? Any code in it will be deleted as well.
Select a collection to submit your sketch
We Need Your Support
Since 2008, OpenProcessing has provided tools for creative coders to learn, create, and share over a million open source projects in a friendly environment.
Niche websites like ours need your continued support for future development and maintenance, while keeping it an ad-free platform that respects your data and privacy!
Please consider subscribing below to show your support with a "Plus" badge on your profile and get access to many other features!
A fork of ML5NextGen-Facemesh by Golan Levin
CC Attribution NonCommercial ShareAlike
ml5-faceMesh-2024
Levin
xxxxxxxxxx
// Requires: https://unpkg.com/ml5@1/dist/ml5.js
let facemesh;
let video;
let faces = [];
let options = { maxFaces: 1, refineLandmarks: false, flipHorizontal: true };
const MAIN_FACE_POINTS = [33,133,362,263,4,78,308];
function preload() {
// Load the faceMesh model
facemesh = ml5.faceMesh(options);
}
function setup() {
createCanvas(640, 480);
// Create the webcam video and hide it
video = createCapture(VIDEO);
//video.size(width, height);
video.hide();
// Start detecting faces from the webcam video
facemesh.detectStart(video, gotFaces);
}
function draw() {
// Draw the webcam video
push();
if (options.flipHorizontal){
translate(width,0);
scale(-1,1);
}
let transparency = 255; // reduce this to make video transparent
tint(255,255,255,transparency);
image(video, 0, 0, width, height);
pop();
// Draw all the tracked face points
noStroke();
for (let i = 0; i < faces.length; i++) {
let face = faces[i];
for (let j = 0; j < face.keypoints.length; j++) {
let keypoint = face.keypoints[j];
fill('lime');
circle(keypoint.x, keypoint.y, 5);
}
// Highlight some special ones
for (let i=0; i<7; i++){
let j = MAIN_FACE_POINTS[i];
let keypoint = face.keypoints[j];
fill('red');
circle(keypoint.x, keypoint.y,10);
}
}
}
// Callback function for when facemesh outputs data
function gotFaces(results) {
// Save the output to the faces variable
faces = results;
//console.log(faces);
}
See More Shortcuts
Please verify your email to comment
Verify Email