Research and find a project (experiments, websites, art installations, games, etc) that creatively utilizes machine learning.

https://experiments.withgoogle.com/ai/drum-machine/view/

Create a surprising interaction or one inspired by the project you find.

The example code inspired me:https://editor.p5js.org/ml5/sketches/DNbSiIYKB

I was thinking about what other phenomena could be associated with this gesture, and I realized that we typically use two fingers whenever we zoom in on our phones or computers. So, I also created a magnifying glass effect.

998331727928711_.pic.jpg

998341727928726_.pic.jpg

998351727928741_.pic.jpg

https://editor.p5js.org/yh4069/sketches/PZqP3YqUm

let handPose;
let video;
let hands = [];

let pinch = 0;

function preload() {
  handPose = ml5.handPose();
}

function setup() {
  createCanvas(640, 480);
  video = createCapture(VIDEO);
  video.size(640, 480);
  video.hide();
  handPose.detectStart(video, gotHands);
}

function draw() {
  image(video, 0, 0, width, height);

  if (hands.length > 0) {
    let finger = hands[0].index_finger_tip;
    let thumb = hands[0].thumb_tip;

    let centerX = (finger.x + thumb.x) / 2;
    let centerY = (finger.y + thumb.y) / 2;
    
    pinch = dist(finger.x, finger.y, thumb.x, thumb.y);

    let magnificationSize = map(pinch, 0, 200, 50, 200); 

    let magnifiedImage = video.get(centerX - magnificationSize / 2, centerY - magnificationSize / 2, magnificationSize, magnificationSize);
    
    image(magnifiedImage, centerX - magnificationSize / 2, centerY - magnificationSize / 2, magnificationSize * 2, magnificationSize * 2); 
  }
}

function gotHands(results) {
  hands = results;
}