Skip to content

Commit

Permalink
agregar colores para manos distintas
Browse files Browse the repository at this point in the history
  • Loading branch information
montoyamoraga committed Nov 19, 2024
1 parent aeabcbe commit 37f281b
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions 05-SofiaEct/clase-14/ml5Manos/sketch.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,16 @@ let handPose;
let video;
let hands = [];

// crear 4 colores
let colores = Array();

let opciones = {
maxHands: 8,
flipped: false,
runtime: "tfjs",
modelType: "full",
detectorModelUrl: undefined, //default to use the tf.hub model
landmarkModelUrl: undefined, //default to use the tf.hub model
maxHands: 8,
flipped: false,
runtime: 'tfjs',
modelType: 'full',
detectorModelUrl: undefined, //default to use the tf.hub model
landmarkModelUrl: undefined, //default to use the tf.hub model
};

function preload() {
Expand All @@ -33,6 +36,13 @@ function setup() {
// start detecting hands from the webcam video
// cuando tiene un resultado, llama a la funcion obtuveManos
handPose.detectStart(video, obtuveManos);

noStroke();

colores.push(color(255));
colores.push(color(0));
colores.push(color(255, 0, 0));
colores.push(color(0, 255, 0));
}

function draw() {
Expand All @@ -44,8 +54,8 @@ function draw() {
let hand = hands[i];
for (let j = 0; j < hand.keypoints.length; j++) {
let keypoint = hand.keypoints[j];
fill(0, 255, 0);
noStroke();

fill(colores[i]);
circle(keypoint.x, keypoint.y, 10);
}
}
Expand Down

0 comments on commit 37f281b

Please sign in to comment.