How to call and

asked 2014-04-22 23:41:00 -0500

mit gravatar image

updated 2014-04-23 01:47:06 -0500

berak gravatar image

I have never worked on python, please if anyone could tell me "how" and "where" to call and In the python scripts, and, provided in the following link where is the editing needed to be done: ( I have installed python 2.7 and 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.

edit retag flag offensive close merge delete



the 1st one is easy. you open a cmdline, cd to the directory you need, and type:

python img_dir

(where img_dir is the folder with your training-database, like d:\att) 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.

berak gravatar imageberak ( 2014-04-23 00:57:23 -0500 )edit

Do I have to provide the path to csv also in script( 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 script at the last while calling the function Crop?

mit gravatar imagemit ( 2014-04-23 03:07:00 -0500 )edit

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:

inFile = open('path_to_created_csv_file.csv') # put your *real* csv filename here

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".

berak gravatar imageberak ( 2014-04-23 03:31:59 -0500 )edit

Ok please tell me, where should I call it and the syntax. I tried doing it in python command line and typed: python d:/path to the folder, but it gave error as invalid syntax. How should run it after I 've done editing.?

mit gravatar imagemit ( 2014-04-23 04:02:26 -0500 )edit

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

berak gravatar imageberak ( 2014-04-23 04:07:53 -0500 )edit