Goju-Ryu
YaBB Newbies
Offline
Posts: 18
Control camera properties
Dec 11th , 2008, 5:41pm
Hello all! I'm trying to make something similar to what is shown on this video: http://www.youtube.com/watch?v=Gv8nwCHQ_-w&feature=PlayList&p=3F18CCE722BE0302&index=1 I'm using Bryan Chung face detect library and my code is as follows: import JMyron.*; PFaceDetect face; JMyron m; PImage img; float center_x; float center_y; int xx; int yy; void setup() { size(640,480, OPENGL); m = new JMyron(); m.start(width,height); m.findGlobs(0); face = new PFaceDetect(this,width,height, "haarcascade_frontalface_default.xml"); img = createImage(width,height,ARGB); rectMode(CORNER); //dimensões dos rectângulos a partir do seu canto(x,y) //noFill(); // desactiva o preenchimento de formas stroke(255,0,0); smooth(); //suaviza geometrias - atrasa o sistema } void draw() { background(0); camera(xx, yy, 220, // eyeX, eyeY, eyeZ 0.0, 0.0, 0.0, // centerX, centerY, centerZ 0.0, 1.0, 0.0); // upX, upY, upZ rect(200, 200, 100, 100); m.update(); arraycopy(m.cameraImage(),img.pixels); img.updatePixels(); face.findFaces(img); //image(img,0,0); drawFace(); } void drawFace() { int [][] res = face.getFaces(); if (res.length>0) { for (int i=0;i<res.length;i++) { int x = res[i][0]; xx = x; int y = res[i][1]; yy = y; int w = res[i][2]; int h = res[i][3]; //rect(x,y,w,h); //Desenha rectângulo envolvente } } } void stop() { m.stop(); super.stop(); } void mousePressed(){ m.settings();//click the window to get the settings } The reactangle disappears/jumps from the image. What am I doing wrong? How can I control the camera properties as desired? Thanks in advance. Best regards!