Ask Your Question

rkappler's profile - activity

2019-11-18 03:28:27 -0600 received badge  Notable Question (source)
2018-03-31 12:49:46 -0600 received badge  Notable Question (source)
2017-12-07 07:51:59 -0600 received badge  Popular Question (source)
2016-03-22 17:16:29 -0600 received badge  Popular Question (source)
2016-03-03 18:42:19 -0600 received badge  Popular Question (source)
2014-07-08 09:10:37 -0600 received badge  Student (source)
2012-08-12 08:29:30 -0600 commented answer Need to .pgm image of specific size for FaceRecognizer in python

I see that you've uploaded a new version with the change, I'll try that before I take anymore of your time.

2012-08-12 08:04:09 -0600 commented answer Need to .pgm image of specific size for FaceRecognizer in python

Oh, I almost forgot, in your comment over on the bug report you say to add y = np.asarray(y, dtype=np.int32) but don't say where. I've tried it in several different spots in facerec_demo.py and haven't found the right one, as I either get a y is undefined error or nothing changes. Any hint would be greatly appreciated.

2012-08-12 08:01:30 -0600 commented answer Need to .pgm image of specific size for FaceRecognizer in python

Then you have, again, my apology. Unfortunately I can't "accept"/ check the answer as solving the problem, because it does not. If I put [X,y] = read_images(sys.argv[1], sz=(92,112)) and add several cropped webcam shots to the att db, the program errors out. It won't resize the new images and the size argument throws a 215 error within opencv that I'm trying to chase down. I'm wondering if this is all due to the bug listed above, as I'm working on a 64 bit machine, but I rather doubt it. They seem to be unrelated to the y labels, but then again I haven't had my coffee yet either. Again, sorry for the misunderstanding, I was getting frustrated at being told to read the docs when I've read them (and almost everything else you've written in the last ... (more)

2012-08-11 17:02:33 -0600 commented answer Need to .pgm image of specific size for FaceRecognizer in python

Right. You've made your position very clear. Speaking as a teacher, I can tell you that very often when things are obvious to us, they are not to our students. Because you are quite certain you have explained something adequately, does not mean it is understandable to the people you are trying to teach. I'm a 52 year old veteran with several degrees, I'm not too bad a programmer, and I'm a damned good teacher. Hopefully this establishes that I'm not an idiot or lazy. Had your tutorials explained everything well, I (and many others) wouldn't have to keep asking questions. If I read your response the wrong way, I apologize. Whether I did or did not, I'll not bother you again.

2012-08-11 14:16:46 -0600 commented answer Need to .pgm image of specific size for FaceRecognizer in python

As always Philipp, thank you. I think the size bit will solve all.

2012-08-11 13:09:27 -0600 asked a question Need to .pgm image of specific size for FaceRecognizer in python

I'm working with Philipp Wagner's FaceRecognizer an excellent bit of code, and have gotten to the point where I want to train it on my own database. I have trained it on the att faces database iaw the tutorials successfully. Now I'd like to either add new faces to that database on the theory that the more faces it's trained on the better, or simply train it on a new set of faces. I tried adding faces to the att database, didn't work. This is where I started to learn about .pgm type files, which is what the att database contains. As I understand it, the pgm type file is actually an array that fools the machine into thinking its an image. Also, the arrays must all be of the same size for FaceRecognizer to work on them. 1) is there a handy way for OpenCV to convert jpg's to pgm? (from my research I have learned it's not just a change in extension) 2) can opencv capture images in .pgm format so as not to require conversion? 3) can anyone point me to a tutorial that allows me to save the image as a specific number of pixels? 4) still learning FaceRecognizer, so this may be a dumb question: can image types other than .pgm be converted to arrays so faceRecognizer can work on them? regards, Richard

2012-08-10 11:40:24 -0600 commented answer python FaceRecognizer questions

the save command works now, it's just model.save("eigenModel.xml")

  • I can't seem to figure out what I'm doing wrong with the database though. I took twenty pics each of 3 family members, the pics are facedetected, cropped at the facedetect box, grayscaled and saved with .pgm extension but I keep getting an array error when I add them as files s41, s42, and s43 to the att orl_faces database. I'm thinking its the pgm conversion, off to research that now.
2012-08-09 22:12:39 -0600 received badge  Scholar (source)
2012-08-09 20:39:09 -0600 commented answer python FaceRecognizer questions

Not doing too bad. I can't quite get the save function to work yet, tried cv2.model.save("eigenModel.xml") but haven't really put any time in it yet. I seem to be coming along pretty well on the rest though. Going to make a new database tomorrow and train on that. We'll see how far I get. Planning on getting about twenty cropped and grayscaled images of 4 family members, using their names as the directory labels (y), with just integers as the jpg labels (X). From reading the comments, tutorials and code, I don't think I even need to go near KNN, do I? I can just run an img through the trained model and get a prediction, no? Thanks for the guidance Philipp.

2012-08-09 15:12:49 -0600 received badge  Editor (source)
2012-08-09 15:10:54 -0600 asked a question python FaceRecognizer questions

I have read this:

I still have a few questions if I may.

  • If I understand correctly, facerec_demo.py just trains the recognizer? When I run it, I always get the same output, but am at a loss to determine what input the code is using to recognize: I get Predicted label = 0 and confidence = 0.00, the eigenfaces output to my folder just fine, and I get a test.png that matches s2/10.pgm from the att database. I'm thinking the 0 label and confidence indicate I'm doing something wrong. I read in your comments in the code that "you should always use unseen images for testing your model, but ... I am just using an image we have trained with."

  • Is that the test.png image? If I were to build my own database, how would I pass the test image (what I want to recognize) in to the now trained recognizer?

  • Would a python cv2.model.save(filename) work as it described your FaceRecognizer wiki pages?

  • Once I get these bits figured out, based on my reading of the other post listed above, if I build a database with, say, my pictures cropped and grayscaled, added in as a new file to the att database, get a webcam snapshot, normalize it, crop it, grayscale it, is the above saying I could I then use (for example) KNN to compare the new pic to the database and find the closest match as a predicted output?

2012-08-09 12:12:23 -0600 commented answer createEigenFaceRecognizer no attribute error

and now it works, thanks Sammy and Philipp

2012-08-09 10:56:09 -0600 commented answer createEigenFaceRecognizer no attribute error

okay, now I understand. I'll give it a try.

2012-08-09 10:27:38 -0600 commented answer createEigenFaceRecognizer no attribute error

So I need to recompile a fresh install of 2.4.2 is what you're saying. That's what I don't understand. What would that accomplish? What would happen this time that didn't last night?

2012-08-09 09:01:35 -0600 commented answer createEigenFaceRecognizer no attribute error

Okay, thanks. I'll wait to see what Phillip says.

2012-08-09 08:28:32 -0600 commented answer createEigenFaceRecognizer no attribute error

Right, I read that before I posted. As I noted in my question, I did this on a fresh install of 2.4.2. Am I missing something here? Sammy, I didn't think it was a duplicate because this is a fresh install. If you want me to close this and tag on to the above post, I will.

regards, Richard

2012-08-08 16:59:12 -0600 asked a question createEigenFaceRecognizer no attribute error

I'm running a newly installed copy of 2.4.2, python 2.7 in Ubuntu 12.04 on a 64 bit HP G62. Trying to run the facerec_demo.py file and getting:

Traceback (most recent call last): File "facerec_demo.py", line 106, in <module> model = cv2.createEigenFaceRecognizer() AttributeError: 'module' object has no attribute 'createEigenFaceRecognizer'

Any ideas? regards, Richard

2012-08-08 16:54:45 -0600 commented answer IMREAD_GRAYSCALE error in facerec_demo.py

Okay, the answer to that question would be no. I installed 2.4.2, still getting the same error. I'm going to post this as a new question. regards, Richard

2012-08-08 15:52:05 -0600 commented answer IMREAD_GRAYSCALE error in facerec_demo.py

No, wait. I didn't realize there was a new rev out. I'm on 2.4.1 Do I need to upgrade to 2.4.2?

regards, Richard

2012-08-08 15:32:42 -0600 commented answer IMREAD_GRAYSCALE error in facerec_demo.py

Right. I should have thought of that. The IMREAD_GRAYSCALE is no longer throwing an error, now I'm getting: Traceback (most recent call last): File "facerec_demo.py", line 106, in <module> model = cv2.createEigenFaceRecognizer() AttributeError: 'module' object has no attribute 'createEigenFaceRecognizer'

2012-08-07 22:52:08 -0600 asked a question IMREAD_GRAYSCALE error in facerec_demo.py

Trying to run FaceRecognizer in Python (see (http://code.opencv.org/projects/opencv/repository/revisions/master/entry/samples/python2/facerec_demo.py) and (http://answers.opencv.org/question/253/broken-python-bindings-with/), but I'm stuck.

I'm running python 2.7 in Ubuntu Precise on a 64 bit HP G62. I opened up a terminal, cd'd to the working directory, entered:

python facerec_demo.py path/to/orl_faces path/to/empty/data/directory

I created for out_dir and I'm getting the following error:

Unexpected error: 
<type 'exceptions.AttributeError'>
Traceback (most recent call last): File "facerec_demo.py", 
line 100, in <module> [X,y] = read_images(sys.argv[1]) File "facerec_demo.py", 
line 75, in read_images im = cv2.imread(os.path.join(subject_path, filename), cv2.IMREAD_GRAYSCALE) 
AttributeError: 'module' object has no attribute 'IMREAD_GRAYSCALE'

Any guidance? regards, Richard

2012-08-07 19:25:51 -0600 commented answer Broken python bindings with createEigenFaceRecognizer

Hey Philipp, great tutorial, but I'm stuck. I'm running python 2.7 in Ubuntu Precise on a 64 bit HP G62. I opened up a terminal, cd'd to the working directory, entered: python facerec_demo.py <single space>path to orl_faces<single space>path to empty data directory I created for out_dir and I'm getting the following error:

Unexpected error: <type 'exceptions.AttributeError'> Traceback (most recent call last): File "facerec_demo.py", line 100, in <module> [X,y] = read_images(sys.argv[1]) File "facerec_demo.py", line 75, in read_images im = cv2.imread(os.path.join(subject_path, filename), cv2.IMREAD_GRAYSCALE) AttributeError: 'module' object has no attribute 'IMREAD_GRAYSCALE'

Any guidance?

regards, Richard