3

First of all I have asked this question on stackoverflow and got down vote for question being not belonging to the site. I am trying my luck se now(more suitable to se I guess) and I hope I will not get down vote from here too

I want to develop a face recognition app that searches the database for an image. I looked at opencv a little. I really liked it and I want to use it but the problem is I am planning to use PHP for server backend and OpenCV is in C++. My app will require lots of communication between PHP and C++ and also I will have to connect to the database and fetch images from them. Basically what I am planning to do is :

  • PHP will get the request which includes the desired image file
  • PHP will pass this image to my C++ code
  • C++ will search the database to find the person
  • C++ will pass the result to PHP
  • PHP will return the result to client

However this approach makes me really scared because there are lots of gray areas for me to how to do it. Should I use sockets to do the communication or IPC (POSIX Messages etc if possible) or should I use entirely C++ for my project(C++ server could be very difficult) or should I use PHP extensions(I know almost nothing about it). How can I use OpenCV with a Database and how can I perform a fast search(Hash values for grayscale cropped images maybe?). I also have to detect faces to train some images for a user which also requires the steps above. What are the suggestions you can make? Which way would be easiest for me to implement this application? Excuse me for the language and disorganized structure question but I am really worried about almost everything about the project and I really want to do it. Any guidance will be appreciated

  • Your core intended question here is good, but only if you heavily generalize it. Consider re-writing the question thinking "How can I generalize this in the way that people with similar problems can benefit from my question?" -- As it is now, your question is so elaborative overly-specific that it's unlikely that anyone else would directly benefit from it. – user129679 Jun 12 '14 at 7:33
  • For example (this is an over-simplified example): "I'm writing a facial recognition web application powered by a C++ and PHP combination backend. Here are a few details that I'm curious about: [bulleted list] -- This is my specific question about this situation." :: While being overly specific, I notice you're also deviating into areas of extremely broad scope. After providing general detail about your general situation, ask a very specific question and leave it at that. – user129679 Jun 12 '14 at 7:40
  • yes, you're really asking a whole slew of questions here, whether you intent to or not. Be more specific, share your thoughts and uncertainties, and maybe create separate questions for each area. – jwenting Jun 12 '14 at 8:00
  • okay I will keep that in mind for my next questions. I made my point more specific than it should be just because if I did the otherwise, it would have been maybe unclear for me and I could still have some doubts about my situation. – mayy00 Jun 12 '14 at 8:52
4

There do seem to be PHP wrappers for OpenCV, such as OpenCV For PHP.

Now, for the recognition part, I think that the best way to go is to use Artificial Neural Networks. ANN's can be trained to identify people within images and are more suited because they can handle relatively inconsistent inputs and produce relatively stable results. There does seem to be ANN implementations in PHP, such as FANN. The implementation of an ANN's should also be quite fast (once trained, that is) and will remove the need for a database, unless you will be using it for other things and/or persist the neural network itself.

This would mean that you can write your solution entirely in PHP.

That being said, my experience with wrappers is that you do not always get all the goodies provided by the original library, so with that in mind, you could also opt to have PHP handle your front end and then, use C++ as back end, which should allow you to exploit all the power of OpenCV (which could come in handy for future add-ons).

As for communication between the two layers, I think using standard SOAP web service communication (for PHP and C/C++) will provide you with a robust solution.

  • Thanks for the wonderful answer. Sorry, I cannot up vote because of the reputation :) – mayy00 Jun 12 '14 at 6:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.