Close

Computer vision - workshop opdrachten

Our services run deep and are backed by over ten years of experience.
workshop
Opdracht 1
void setup() {
  size(480, 480);
}



void draw() {
  rectMode(CENTER);
  rect(240, 280, 200, 400);

  rect(240, 450, 100, 60);
  line(240, 480, 240, 420);

  rect(240, 380, 100, 30);
  line(240, 395, 240, 365);

  rect(240, 310, 100, 30);
  line(240, 325, 240, 295);

  rect(240, 240, 100, 30);
  line(240, 255, 240, 225);

  rect(240, 170, 100, 30);
  line(240, 185, 240, 155);
}
opdracht1
Opdracht 2
void setup() {
  size(480, 480);
}



void draw() {
  rectMode(CENTER);
  fill(0, 0, 255);
  rect(240, 170, 300, 60);
  fill(255, 255, 255);
  rect(240, 110, 300, 60);
  fill(255, 0, 0);
  rect(240, 50, 300, 60);
}
opdracht2
Opdracht 3
void setup() {
    size(600, 600);
    noStroke();
  }

  void draw() {
    background(126);
    fill(#FF0000);
    rect(mouseX,mouseY+20, 200, 50);    // Top 
    fill(#ffffff);
    rect(mouseX,mouseY+70, 200, 50); // Middle 
    fill(#0000ff);
    rect(mouseX,mouseY+120, 200, 50); // Bottom 
  }
opdracht3
Opdracht 4
int diameter = 400;

void setup(){
    size(400,400);
  }

void draw(){

    background(#282828);
    stroke(0);
    fill(255, 0, 0);
    ellipse(width/2,height/2,diameter,diameter);
    if(diameter > 0){
      diameter -= 1;

    }
    else{
      diameter = 0;

    }

    }
opdracht4
Opdracht 5a
import gab.opencv.*;
import processing.video.*;
import java.awt.*;

Capture video;
OpenCV opencv;

void setup() {
  size(640, 480);
  video = new Capture(this, 640/2, 480/2);
  opencv = new OpenCV(this, 640/2, 480/2);
  opencv.loadCascade(OpenCV.CASCADE_FRONTALFACE);  

  video.start();
}

void draw() {
  scale(2);
  opencv.loadImage(video);

  image(video, 0, 0 );

  noFill();
  stroke(0, 255, 0);
  strokeWeight(3);
  Rectangle[] faces = opencv.detect();
  println(faces.length);

  for (int i = 0; i     println(faces[i].x + "," + faces[i].y);
    ellipse(faces[i].x+40, faces[i].y+20, faces[i].width, faces[i].height);
  }
}

void captureEvent(Capture c) {
  c.read();
}
opdracht5a
Opdracht 5b
import gab.opencv.*;
import processing.video.*;
import java.awt.*;

Capture video;
OpenCV opencv;

void setup() {
  size(640, 480);
  video = new Capture(this, 640/2, 480/2);
  opencv = new OpenCV(this, 640/2, 480/2);
  opencv.loadCascade(OpenCV.CASCADE_FRONTALFACE);  

  video.start();
}

void draw() {
  scale(2);
  opencv.loadImage(video);

  image(video, 0, 0 );

  fill(0);
  Rectangle[] faces = opencv.detect();
  println(faces.length);

  for (int i = 0; i     println(faces[i].x + "," + faces[i].y);
    rect(faces[i].x-10, faces[i].y+10, faces[i].width+20, faces[i].height/3);
  }
}

void captureEvent(Capture c) {
  c.read();
}
opdracht5b
Opdracht 5c
import gab.opencv.*;
import processing.video.*;
import java.awt.*;

PImage image1;

Capture video;
OpenCV opencv;

void setup() {
  size(640, 480);

  video = new Capture(this, 640/2, 480/2);
  opencv = new OpenCV(this, 640/2, 480/2);
  opencv.loadCascade(OpenCV.CASCADE_FRONTALFACE);  
  
  image1 = loadImage("mask.png");
  
  video.start();
}

void draw() {
  scale(2);
  opencv.loadImage(video);

  image(video, 0, 0 );

  fill(0);
  Rectangle[] faces = opencv.detect();
  println(faces.length);

  for (int i = 0; i     println(faces[i].x + "," + faces[i].y);
    image(image1, faces[i].x, faces[i].y, faces[i].width, faces[i].height);
  }
}

void captureEvent(Capture c) {
  c.read();
}
opdracht5c