How to call create_csv.py and crop_face.py
I have never worked on python, please if anyone could tell me "how" and "where" to call create_csv.py and crop_face.py. In the python scripts, create_csv.py and crop_face.py, provided in the following link where is the editing needed to be done: (http://docs.opencv.org/trunk/modules/contrib/doc/facerec/tutorial/facerec_video_recognition.html). I have installed python 2.7 and PIL-1.1.7.win-amd64-py2.7. I have read the documentation of face recognition in video using opencv 2.4.8, on which i am working, but there is no syntax provided of how to call these python scripts. Please help.
the 1st one is easy. you open a cmdline, cd to the directory you need, and type:
(where img_dir is the folder with your training-database, like d:\att)
crop_face.py is a bit more tricky. it's more a demo/example, if you want to use it with your own images, you'd have to edit it, and change the image names (and eye locations) at the bottom in the __main__ part.
Do I have to provide the path to csv also in crop_face.py script(http://docs.opencv.org/trunk/modules/contrib/doc/facerec/tutorial/facerec_video_recognition.html) in def readFileNames(): try: inFile = open('path_to_created_csv_file.csv') except: raise IOError('There is no file named path_to_created_csv_file.csv in current directory.') return False Also as i have created a folder ,in D drive, containing three folders of the three subjects containing 2 photos each, what editing should be done in the crop_face.py script at the last while calling the function Crop?
oh, sorry, my local (3.0) copy does not have that part. (i'm sure, bytefish removed it for a reason.)
yes, you probably want to change this line:
still ,this won't solve the hardcoded eye positions (which leaves the whole thing quite unusable). and this is the hard part, since you have to add an automatic eye-finding procedure here (haarcascades, better even flandmark.)
so again, take it with a grain of salt. imho, the code there is more to give you an idea of appropriate measures to take on face images, i doubt, you can use it "as is".
Ok please tell me, where should I call it and the syntax. I tried doing it in python command line and typed: python crop_face.py d:/path to the folder, but it gave error as invalid syntax. How should run it after I 've done editing.?
if you edited the filename, it does not need additional cmdline args.
and to clear up the sytax error, you'd have to show the code (and where the error happens) . can't read you mind here