kl3m3n's blog

Community Browser
cancel
Showing results for 
Search instead for 
Did you mean: 

Re: Real-time face and eye detection in LabView using OpenCV Harr feature classifier

Klemen
Active Participant

(check out this link: https://decibel.ni.com/content/blogs/kl3m3n/2014/09/05/point-cloud-library-pcl-and-open-computer-vis...)

Hello,

I have been playing around with the face and eye detection algorithms in OpenCV and have again made a dll library, which can be called in Labview to perform face and eye tracking in real time (on my computer I achieve an average detection time of ~50 ms per loop, which equals ~20 fps using a webcamera with VGA resolution).

The algorithm first detects the faces in a live camera stream and then detects the eyes inside the "detected faces" regions of interest. The algorithm is based on Haar cascade classifier with OpenCV's default training samples.

I am attaching the dll and the source code along with the LabView sample code saved for LV2010. The dll was built using VS2010x86 and OpenCV 2.4.6.

I hope this helps someone in their project.

Be creative.

Best regards,

K

P.S.: Be careful to synchronize the path to the classifier files (can be seen in the source code). The LV algorithm tells you, if the classifiers are not loaded correctly.

P.P.S.: The .dll included detects only one face that corresponds to the biggest object in the scene. If you want multiple face detection, you need remove "CV_HAAR_FIND_BIGGEST_OBJECT" in the source code and rebuild the .dll. Or if you have any problems doing this, leave a comment and I will post the multi-face detection .dll.


https://decibel.ni.com/content/blogs/kl3m3n



"Kudos: Users may give one another Kudos on the forums for posts that they found particularly helpful or insightful."
Comments
Woody247
Member

Hi Klemen,

I'm using Visual Studio 2013, although in CMake I configured for Visual Studio 12 2013, I assume they are one in the same.

I did have to modify the linker>input>additional dependancies in the project before compiling as it wasn't quite the right location. (missed out the x86\vc12 from the libraries) so it would compile without errors.

Many thanks

Pete

mishti93
Member

thank you soooo much for this...can't even tell how helpful this will be for us if it works...i have downloaded it and will try to execute it and i might bother you a little if i get any problem....hope you won't mind...

thanks again for this...:)

Klemen
Active Participant

Hello,

I hope you find this useful.  You can also check out a toolkit that wraps some additional opencv functions (including face detection).You could also try meanshift or camshift for face tracking:

https://decibel.ni.com/content/blogs/kl3m3n/2014/09/05/point-cloud-library-pcl-and-open-computer-vis...

Best regards,

K


https://decibel.ni.com/content/blogs/kl3m3n



"Kudos: Users may give one another Kudos on the forums for posts that they found particularly helpful or insightful."
mishti93
Member

Hi i needed a little help of urs vd my project if u dont mind can u please

help us...actually we are stuck at a point

Klemen
Active Participant

Hello,

you did not explain the problem...

Regards,

K


https://decibel.ni.com/content/blogs/kl3m3n



"Kudos: Users may give one another Kudos on the forums for posts that they found particularly helpful or insightful."
mishti93
Member

Actually we are trying to make face detection model uaing vision

development toolkit...but the method we are using is pattern matching...vch

restricts our model to detect face when the specified pattern is

matched...can u help us vd it...i mean is der ny oder way we can do face

detection...to make our model more robust...i tried opencv but the visual

studio software is not getting installed properly...

Klemen
Active Participant

Hello,

in order to get the example working, follow this:

https://decibel.ni.com/content/blogs/kl3m3n/2014/04/22/create-a-visual-studio-project-from-source-fi...

Also, you can try tracking the face using meanshift/camshift. I suggest you try the toolkit here:

https://decibel.ni.com/content/blogs/kl3m3n/2014/09/05/point-cloud-library-pcl-and-open-computer-vis...

The face detection from this post is also included.

In my opinion, you are not going to be able to track the face reliably with pattern matching. Try different approaches. For example, this is a good way to go:

http://www.mathworks.com/help/vision/examples/face-detection-and-tracking-using-the-klt-algorithm.ht...

Detect the face only once using the cascade classifier, then detect strong/reliable features and use Lucas-Kanade to track them from frame to frame.

Best regards,

K


https://decibel.ni.com/content/blogs/kl3m3n



"Kudos: Users may give one another Kudos on the forums for posts that they found particularly helpful or insightful."
Klemen
Active Participant

Hello,

I have tested the example from the last link in the previous post and it seems to perform well for face tracking. The steps are:

1. detect good features to track (shi-tomasi) -> OpenCV

2. optical flow LK -> Labview

3. estimate similarity/affine transformation for the face ROI -> OpenCV

You could perform 3. in Labview quite easily using least squares approach. You then just need to establish 1. to extract reliable features on the initial face image.

My example can be found here (it's a part of the toolkit):

https://decibel.ni.com/content/blogs/kl3m3n/2014/09/05/point-cloud-library-pcl-and-open-computer-vis...

Best regards,

K


https://decibel.ni.com/content/blogs/kl3m3n



"Kudos: Users may give one another Kudos on the forums for posts that they found particularly helpful or insightful."
Annelise
Member

Hi, I have to identify when the eye is opened or closed and the time of reaction, this is for my final project. Can you help me? I'm new on labview and I have some difficulties.

- A

dhaker
Member

hi, friend please i faced many problems in the execution of the eye detection please i need help, how can i do? what are the softwares should i install?

R@hu!
Member

Hello sir am trying to run the program but am getting 3 warnings due to which the program is not  executing.Would you please help me out .

i have install " OpenCV[2.4.12] Wrapper for LabVIEW "

lb.jpg

aryadeo
Member

I am unable to get the link to download the OPENCV 2.4.6 and its hard for me to get the opencv_core246.dll 

Someone please send me the link to download the opencv2.4.6.

Thank you!

mano1897
Member

Capture.PNG

 Please help me to solve this issue