bool lookForFaces() { yarp::sig::Vector pxl(2,0.0); yarp::sig::Vector pxr(2,0.0); while (true) { imageInR = imagePortInR -> read(false); imageInL = imagePortInL -> read(false); if (imageInL) { ImageOf<PixelBgr> imageOutL; detectorL->loop(imageInL,imageOutL); imagePortOutL.write(imageOutL); } if (imageInR) { ImageOf<PixelBgr> imageOutR; detectorR->loop(imageInR,imageOutR); imagePortOutR.write(imageOutR); } printMessage(2,"counterL: %i counterR: %i\n",detectorL->counter,detectorR->counter); if (detectorL->counter > certainty && detectorR->counter > certainty) { pxl=detectorL->getCenterOfFace(); pxr=detectorR->getCenterOfFace(); printMessage(1,"I have found a face! pxl: %s pxr: %s\n",pxl.toString().c_str(),pxr.toString().c_str()); if (pxl(0)!=0.0 && pxr(0)!=0.0) { igaze->lookAtStereoPixels(pxl,pxr); } return true; } Time::delay(0.1); } return false; }
bool updateModule() { detector->loop(); return true; }