blog/posts/2014-07-17-multithreaded-facial-recognition-with-opencv.markdown
Sanchayan Maity 01d0d50249 Initial commit for blog migration to Hakyll
Never gave a damn about jekyll/ruby except to use it for github pages.
Now use Hakyll/Haskell and migrate from jekyll/ruby.
2017-02-14 02:00:46 +05:30

2.6 KiB

author title tags
Sanchayan Maity Multithreaded Facial Recognition with OpenCV opencv

It has been quiet a while since i have been maintaining this blog and giving some information and codes to work with. Lately i started noticing that this can become tedious. So from now on i will try to give access to the projects or work i do using git. I had a git account since September of 2013, but, never got around to using it.

This project is a modification of the facial recognition project which is given with Mastering OpenCV with Practical Computer Vision. The book is available with Packtpub and Amazon. The code base is here [https://github.com/MasteringOpenCV](https://github.com/MasteringOpenCV) and is maintained by Shervin Emami.

I was trying to do the same on a Toradex NVidia Tegra3 based Colibri T30 module which has four CPU cores. The code is single threaded and as such doesn't detect faces if the training process is going on. I made changes to this, so that even while the training process is on going, it can still detect faces. And mind you, the training process can go on for quiet a while if there are more than 3-4 faces. So, this is basically a two threaded version of the main code along with a few more changes as per my personal requirement. You can actually go one step further to utilize three cores, though right now i can't recall what was suppose to be the job of the third core.

I do apologize for the code not being very clean. At first i was trying to use the threading facility available with C++, but since i am no C++ expert i ran into problems which i wasn't able to fix quickly. Decided to use pthreads, which i am much more familiar and comfortable with. You will find the C++ threading part which i was trying to do, commented out. Once i get some C++ mastery using Bruce Eckel's Thinking in C++, i will try to do it cleanly in just C++ and clean it or clean it anyways when i get time.

You can clone the project with:


git clone https://github.com/SanchayanMaity/MultithreadedFaceRecognition.git

You need to modify the Makefile to compile the project and use it on your platform which can be a PC or an embedded board. Please do note that this project will be useful only if you are running this on a platform which has two cores or more.

Hope you guys find it useful. Cheers! And git and Linus are awesome.