Face Detection with ColdFusion and Jviolajones

I was trying to do face recognition with ColdFusion and JJIL Java library last week. Today I gave Jviolajones library a stab and it turn out quite well. It misses some faces, occasionally returns false positive results, but overall it did a sweet job. My final goal is to create thumbnails of images cropped around faces, not extremely crucial face detection. Jviolajones seems to be a good candidate for that.

Jviolajones uses OpenCV Haar cascade files, but unlike JJIL you can use OpenCV Haar xml files without any minification. The main face detection function getFaces() takes few parameters in, with that you can change the face detection sensitivity. That is bit less than optimal feature in a production environment, but we can set it to a reasonable value and forget it.

I compiled the source code in GitHub and you can download all the CF files and Jar files at the end of this post. Jviolajones jar file in Google Code seems to be an older version. Here is my Railo code. Update CreateObject() function in line 1, copy jar files into your CF server or load it with JavaLoader if you are using Adobe ColdFusion.

Unlike with my JJIL experiment, this detected all three faces.

This misses few faces, but it is fine.

Here is a false positive detection and it misses a face. You can change this with getFaces() parameters, but it can effect different size images. Also better trained Hass file do a better detection. Try different hass files, if you have one, share.

Jviolajones speed is quite good.


Download (jviolajones_cfm.zip)
Sunday 03 May 2015 04:06 AM
Hi ,
That looks amazing ,Thank you for sharing .
As a newie : I was wondering about the other Face detection Algorithms ,is there any other besides Viola & Jones Algorithm?

Thank you.
Wednesday 17 September 2014 11:13 PM
Thanks for sharing - this is awesome!
Saturday 23 November 2013 01:31 PM
Can I use for cat detection then how ?
Saturday 23 November 2013 01:19 AM
how to execute thsi code on net bin and what is requirement tool?
Brad B
Friday 30 August 2013 02:30 PM
this is cool ... i was wondering if you think this could do image pattern matching?
Friday 30 August 2013 04:51 PM
You have to train a HARR file, that I have not tried. I think it is a bit of a process.