Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Static Face and Eye detection in Python.

Hello guys, I know this is a rather popular question to ask - but none of the cases I found particularly addressed my issue. I am using opencv via the python bindings and I am using this script to autorotate and mask face pictures https://github.com/TheChymera/Epproc/blob/dc4a47c0258e83c911cadd4791abcdda3b2ec9a7/pproc.py

I am using haar cascades for face and eye detection.

I use the cascades like this:

def Load(picture):
    pic = cv2.imread(picture)
    faceCasc = cv2.CascadeClassifier('/usr/share/OpenCV/haarcascades/haarcascade_frontalface_default.xml')
    leyeCasc = cv2.CascadeClassifier('/usr/share/OpenCV/haarcascades/haarcascade_lefteye_2splits.xml')
    reyeCasc = cv2.CascadeClassifier('/usr/share/OpenCV/haarcascades/haarcascade_righteye_2splits.xml')
    eyesCasc = cv2.CascadeClassifier('/usr/share/OpenCV/haarcascades/haarcascade_mcs_eyepair_small.xml')
    return(pic, faceCasc, leyeCasc, reyeCasc, eyesCasc)

and call them like this:

leye = leyeCasc.detectMultiScale(smallimg, haar_scale_eye, min_neighbors_eye, haar_flags_eye, min_size_eye, max_size_eye)

Sadly I have to play with the parameters a LOT to get the cascades to work at all - and even when they do ~2/3 of my pics get false negatives/positives. My pictures are very sharp and very high resolution (~3k x 5k - the faces are ~1/9 of that).

I recently came across this article http://docs.opencv.org/modules/contrib/doc/facerec/facerec_tutorial.html

Which seems really great, but sadly I could not figure out how/whether these methods can be used to give me a simple square (maybe even circle/ellipse?) delineating the features I am looking for. Also I am mainly having trouble with the eye detection - the haar cascade for the faces tends to work a bit better.

Cheers,

Static Face and Eye detection in Python.Python

Hello guys, I know this is a rather popular question to ask - but none of the cases I found particularly addressed my issue. I am using opencv via the python bindings and I am using this script to autorotate and mask face pictures https://github.com/TheChymera/Epproc/blob/dc4a47c0258e83c911cadd4791abcdda3b2ec9a7/pproc.py

I am using haar cascades for face and eye detection.

I use the cascades like this:

def Load(picture):
    pic = cv2.imread(picture)
    faceCasc = cv2.CascadeClassifier('/usr/share/OpenCV/haarcascades/haarcascade_frontalface_default.xml')
    leyeCasc = cv2.CascadeClassifier('/usr/share/OpenCV/haarcascades/haarcascade_lefteye_2splits.xml')
    reyeCasc = cv2.CascadeClassifier('/usr/share/OpenCV/haarcascades/haarcascade_righteye_2splits.xml')
    eyesCasc = cv2.CascadeClassifier('/usr/share/OpenCV/haarcascades/haarcascade_mcs_eyepair_small.xml')
    return(pic, faceCasc, leyeCasc, reyeCasc, eyesCasc)

and call them like this:

leye = leyeCasc.detectMultiScale(smallimg, haar_scale_eye, min_neighbors_eye, haar_flags_eye, min_size_eye, max_size_eye)

Sadly I have to play with the parameters a LOT to get the cascades to work at all - and even when they do ~2/3 of my pics get false negatives/positives. My pictures are very sharp and very high resolution (~3k x 5k - the faces are ~1/9 of that).

I recently came across this article http://docs.opencv.org/modules/contrib/doc/facerec/facerec_tutorial.html

Which seems really great, but sadly I could not figure out how/whether these methods can be used to give me a simple square (maybe even circle/ellipse?) delineating the features I am looking for. Also I am mainly having trouble with the eye detection - the haar cascade for the faces tends to work a bit better.

Cheers,

Static Face and Eye detection in Python

Hello guys, I know this is a rather popular question to ask - but none of the cases I found particularly addressed my issue. I am using opencv via the python bindings and I am using this script to autorotate and mask face pictures https://github.com/TheChymera/Epproc/blob/dc4a47c0258e83c911cadd4791abcdda3b2ec9a7/pproc.py

I am using haar cascades for face and eye detection.

I use the cascades like this:

def Load(picture):
    pic = cv2.imread(picture)
    faceCasc = cv2.CascadeClassifier('/usr/share/OpenCV/haarcascades/haarcascade_frontalface_default.xml')
    leyeCasc = cv2.CascadeClassifier('/usr/share/OpenCV/haarcascades/haarcascade_lefteye_2splits.xml')
    reyeCasc = cv2.CascadeClassifier('/usr/share/OpenCV/haarcascades/haarcascade_righteye_2splits.xml')
    eyesCasc = cv2.CascadeClassifier('/usr/share/OpenCV/haarcascades/haarcascade_mcs_eyepair_small.xml')
    return(pic, faceCasc, leyeCasc, reyeCasc, eyesCasc)

and call them like this:

leye = leyeCasc.detectMultiScale(smallimg, haar_scale_eye, min_neighbors_eye, haar_flags_eye, min_size_eye, max_size_eye)

Sadly I have to play with the parameters a LOT to get the cascades to work at all - and even when they do ~2/3 of my pics get false negatives/positives. My pictures are very sharp and very high resolution (~3k x 5k - the faces are ~1/9 of that).

I recently came across this article http://docs.opencv.org/modules/contrib/doc/facerec/facerec_tutorial.html

Which seems really great, but sadly I could not figure out how/whether these methods can be used to give me a simple square (maybe even circle/ellipse?) delineating the features I am looking for. Also I am mainly having trouble with the Also, is there anything similar for eye detection - the detection? Or will I have to continue relying on haar cascade cascades for the faces tends to work a bit better.that?

Cheers,