Quantcast
Channel: Kinect - Processing 2.x and 3.x Forum
Viewing all articles
Browse latest Browse all 530

events

$
0
0

im looking to learn about how to build my own eventHandler type of event, where and how to begin? using arduino i can see how one would build classes cpp files and make their own #include <event.h> but in Processing we use import processing.serial.*; but i dont see any of its inner core files that makes up that library source code. Last nigh i was thinking i need to make my own event handler for opencv in processing and i came upon 2 problems.

1) i would need to learn and build my own HarrCascade.xml for this event i want to build. 2) i would need to build a library for this event.

when we use OpenCV in processing you would see this,

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 < faces.length; i++) {
    println(faces[i].x + "," + faces[i].y);
    rect(faces[i].x, faces[i].y, faces[i].width, faces[i].height);
  }
}

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

where as opencv.loadCascade(OpenCV.CASCADE_FRONTALFACE); does the actual magic and hence the reason why i want to learn how to redefine/build my own Cascade file.

then we see the math happening in

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

      for (int i = 0; i < faces.length; i++) {
        println(faces[i].x + "," + faces[i].y);
        rect(faces[i].x, faces[i].y, faces[i].width, faces[i].height);
      }

i want to say that i sorta understand whats going on and the fact the we are using a xml file implies that some type of parsing its going down and is how Rectangle[] faces = opencv.detect(); the Array is able to store what it has parse through when we first opencv.loadCascade(OpenCV.CASCADE_FRONTALFACE);

i wand to build a handler event or event handler that reads from this harrcascade xml file i want to begin building in this case my hand.


Viewing all articles
Browse latest Browse all 530

Trending Articles