FaceRecognition.java compare one face with others.

3,114 views
Skip to first unread message

henriqu...@gmail.com

unread,
Dec 11, 2013, 5:14:15 AM12/11/13
to jav...@googlegroups.com
I have doubt in FaceRecognition.java

I'm following the example of the URL:
http://code.google.com/p/javacv/source/browse/samples/FaceRecognition.java?r=02385ce192fb82f1668386e55ff71ed8d6f88ae3

When I detect Face from camera I need to get the image ( crop only the face and then recognize )

I would to know where the point should I consider that the picture was actually found

public void recognizeFace(IplImage face) {

tallyFaceRecognizeTime = (double) cvGetTickCount() - timeFaceRecognizeStart;
if (nCorrect + nWrong > 0) {
return true;// FOUND THE FACE ????

LOGGER.info("TOTAL ACCURACY: " + (nCorrect * 100 / (nCorrect + nWrong)) + "% out of " + (nCorrect + nWrong) + " tests.");
LOGGER.info("TOTAL TIME: " + (tallyFaceRecognizeTime / (cvGetTickFrequency() * 1000.0 * (nCorrect + nWrong))) + " ms average.");
}


After How I will invoke the method above:
My purpose is to do :
//WHEN  DETECT FACE.... then RECOGNIZE

CvSeq cascadeFaces = cvHaarDetectObjects(grayImage, defaultCascade, STORAGE, 1.15, 3, opencv_objdetect.CV_HAAR_DO_CANNY_PRUNING);
if( cascadeFaces.total() > 0){ // found face

    CvRect rectangle = new CvRect(cvGetSeqElem(cascadeFaces, 0));
    cvSetImageROI(grayImage, rectangle);   
      final FaceRecognition faceRecognition = new FaceRecognition();
      faceRecognition.recognizeFace(grayImage); // refactoring the method  recognizeFileList   
  }



Thanks & regards


Samuel Audet

unread,
Dec 14, 2013, 11:49:41 PM12/14/13
to jav...@googlegroups.com
On 12/11/2013 07:14 PM, henriqu...@gmail.com wrote:
> I have doubt in FaceRecognition.java

You should try the new FaceRegonizer of OpenCV:
http://code.google.com/p/javacv/source/browse/src/main/java/com/googlecode/javacv/cpp/opencv_contrib.java#840
http://docs.opencv.org/modules/contrib/doc/facerec/facerec_tutorial.html
It should work much better

Samuel

Henrique Molina

unread,
Dec 19, 2013, 6:13:13 AM12/19/13
to jav...@googlegroups.com
Samuel thanks for replied.

I noticed that the algo detection faces get others object from image and not faces.
look in attached what the opencv to catched

The haarcascade used is haarcascade_frontalface_default.xml


defaultCascade = new CvHaarClassifierCascade(cvLoad("haarcascade_frontalface_default.xml"));
defaultFaces = cvHaarDetectObjects(grayImage, defaultCascade, STORAGE,1.15, 3, com.googlecode.javacv.cpp.opencv_objdetect.CV_HAAR_DO_CANNY_PRUNING);

there are some thing wrong with parameters in method "cvHaarDetectObjects" ?
code:
for (int i = 0; i < defaultFaces.total(); i++) {
   cvRectangle(grayImage, cvPoint(rectangle.x(), rectangle.y()),
   cvPoint(rectangle.x() + rectangle.width(), rectangle.y() + rectangle.height()),
   CvScalar.BLACK, 1, CV_AA, 0);
}




How I can catch only face...
I need to use other .xml haarcascade?


Thanks




--

--- You received this message because you are subscribed to a topic in the Google Groups "javacv" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/javacv/mwhjjgs2vaA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to javacv+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

1387450521454.png
principal_test.png

Samuel Audet

unread,
Dec 22, 2013, 9:27:45 PM12/22/13
to jav...@googlegroups.com
On 12/19/2013 08:13 PM, Henrique Molina wrote:
> Samuel thanks for replied.
>
> I noticed that the algo detection faces get others object from image and not faces.
> look in attached what the opencv to catched

Yes, that's not unexpected

> How I can catch only face...
> I need to use other .xml haarcascade?

Yes, probably very expensive ones from camera or cellphone makers :)

Samuel

Gayathri vasu

unread,
Feb 6, 2015, 2:11:44 AM2/6/15
to jav...@googlegroups.com
hi
  i detected the face,
 now i want to crop the rectangle in it 
and i need to compare
pls help me

jerusha

unread,
Feb 6, 2015, 2:14:01 AM2/6/15
to jav...@googlegroups.com
my project is capturing image using cellphones
and compare image i need source code

thanks 

Samuel Audet

unread,
Feb 8, 2015, 7:25:11 AM2/8/15
to jav...@googlegroups.com
We can crop an image by calling cvSetImageROI() followed by cvCopy().

Samuel

Pakhi Sue

unread,
Nov 20, 2016, 6:58:35 PM11/20/16
to javacv
how can i compare face from two different image? please help me!!!!!!!!!!!!!!!

Samuel Audet

unread,
Nov 21, 2016, 7:47:55 PM11/21/16
to jav...@googlegroups.com
On 11/21/2016 03:36 AM, Pakhi Sue wrote:
> how can i compare face from two different image? please help me!!!!!!!!!!!!!!!

Check the tutorial for that here:
http://docs.opencv.org/2.4/modules/contrib/doc/facerec/facerec_tutorial.html

Samuel

Reply all
Reply to author
Forward
0 new messages