Hi im using PFaceDetect library to multi detect face, but i still got noise and can't remember if the face are similar dimension.
so i want to slove this problem by compare the present positon with previous position with every face that i detect, and the nearlest by vector is right face.
i can find vector with dist()
by compare previous x y and present x y
but i don't know how to compare and swap array by the nearless first vector, it really hard for me
i wat done all for every face over and over again like:
A(old) B(old) C(old)
compare with A(new) B(new) C(new)
then B(new) is nearest by vector with A(old)
and B(new) is new first order of position, like this every face postion
this source of original example
Code:import pFaceDetect.*;
import JMyron.*;
PFaceDetect face;
JMyron m;
PImage img;
void setup() {
size(320,240);
m = new JMyron();
m.start(width,height);
m.findGlobs(0);
face = new PFaceDetect(this,width,height,
"haarcascade_frontalface_default.xml");
frameRate(15);
img = createImage(width,height,ARGB);
rectMode(CORNER);
noFill();
stroke(255,0,0);
smooth();
}
void draw() {
background(0);
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];
int y = res[i][1];
int w = res[i][2];
int h = res[i][3];
rect(x,y,w,h);
}
}
}
void stop() {
m.stop();
super.stop();
}
Thank for Help