Ask Your Question
0

how to run python script to align faces in windows 7

asked 2013-03-14 02:52:59 -0600

sujith.92 gravatar image

hi friends i am new to opencv . i'm trying to create training set to recognize person. but the problem is i cant align faces in proper manner. so i googled it and found python script in opencv documentation but i am gettin this error

Traceback (most recent call last): File "align.py", line 34, in <module> import sys, math, Image ImportError: No module named 'Image'

iam new to opencv and p[ython please help...

thanks in advanc

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
1

answered 2013-03-14 03:52:28 -0600

berak gravatar image

updated 2013-03-14 05:22:34 -0600

"ImportError: No module named 'Image'"

it seems, you're lacking PIL

it does not come with the standard python windows installer, you have to get that separately

but, please reconsider what StevenPuttemans said in his answer, once you've trained your face-reco, and try to detect candidates, you'll probably have a cascade-detector in front of that anyway, and it really pays to do exactly the same kind of cropping in the training and the detection stage!

edit flag offensive delete link more
1

answered 2013-03-14 03:56:18 -0600

Something you could do is apply the viola&jones framework to detect the face and the eyes using the provided cascades in the data folder. Then once you know the eyes bounding boxes, you can calculate a rotation to get them at the same height, then apply translation to your images in order to place all eye regions on the same level.

I have read that isn't the best approach around, but I have used it and it worked. Have done it in C++ but I guess the functionality will be available in python also, since the same libraries are actually used.

Just be sure that your python environment is configured correctly, meaning the correct includes and linker options are set, and that your system has the correct PATH variables added.

Link of the C++ tutorial: http://docs.opencv.org/doc/tutorials/objdetect/cascade_classifier/cascade_classifier.html#cascade-classifier

Cheers

edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-03-14 02:52:59 -0600

Seen: 517 times

Last updated: Mar 14 '13