[Behavior] Face Detection

Post your completed addons to share with the community

Post » Wed Aug 22, 2012 12:21 pm

Update v1.1 : now minification works properly !
The plugin : https://dl.dropbox.com/u/1412774/FaceDetectDemo2/pode_facedetect.1.1.zip

Here's a new behavior, allowing you to detect a face in the Sprite it's attached to. You can get the (X,Y) of the found face, its width and height, the confidence (only the first found face is reported).



As you can see in the screenshot, there's also the possibility to retrieve a cropped version of the found face (you can give the margin you want to add around the original found face, since the bounding box can be a bit "tight"). The cropped image is given as a base64 string that you can load in a regular Sprite.



The whole thing was made using the helpful jQuery FaceDetection plugin : http://facedetection.jaysalvat.com/

The demo : https://dl.dropbox.com/u/1412774/FaceDetectDemo/index.html
The plugin : https://dl.dropbox.com/u/1412774/FaceDetectDemo/pode_facedetect.1.0.zip
The .capx : https://dl.dropbox.com/u/1412774/FaceDetectDemo/FaceDetectDemo.capx

(The whole detection thing is using the Viola-Jones algorithm, implemented first in OpenCV, and reimplemented back in Javascript by liu liu in ccv.js : https://github.com/liuliu/ccv & http://liuliu.me/ccv/js/nss/. It's a fast algorithm - that's why it's viable in JS, relatively simple, but you can get some (few) false positives, and sometimes no detection, although you know there's a face in the image !)

I'm planning to add several face detection in the same image in a future release.Pode2012-08-30 18:34:38
B
33
S
9
G
6
Posts: 709
Reputation: 6,704

Post » Wed Aug 22, 2012 12:32 pm

Nice
Whats next facial recognition?
Image Image
B
161
S
48
G
90
Posts: 7,347
Reputation: 66,749

Post » Wed Aug 22, 2012 12:58 pm

@newt : .
Facial recognition isn't doable in Javascript, you need a native language to do that. It's based on various things, like Eigenfaces, and for that you need to capability to invert and resolve big matrices really fast (PCA, SVD and the like.).Pode2012-08-22 12:58:24
B
33
S
9
G
6
Posts: 709
Reputation: 6,704

Post » Wed Aug 22, 2012 4:36 pm

Yeah, I figured that might be a bit much jscript atm.
Well who knows, the way things are going, it shouldn't be too long till its doable.
Image Image
B
161
S
48
G
90
Posts: 7,347
Reputation: 66,749

Post » Wed Aug 22, 2012 7:09 pm

@newt : I really would like to have that, too !
There's a bit of a solution with Actionscript, I think. Yesterday, Adobe released the version 2 of Alchemy, their compiler allowing to recompile C++ as Flash code, allowing the use of direct memory access and special opcode acceleration. With that, you can gain a huge boost, especially when crunching numbers (like what's needed for face identification).
I used the first build of Alchemy inside the code used for my Mic plugin (to accelerate mp3 and ogg encoding). Without that, it would have been impossible to encode audio in a browser...

Edit : by the way, I'm asking myself the question if I should do a post each time I create a new plugin inside the "Creation" section of C2, because I think that there is a lot of user "afraid" to go inside the "develope section".Pode2012-08-22 19:10:58
B
33
S
9
G
6
Posts: 709
Reputation: 6,704

Post » Wed Aug 22, 2012 8:08 pm

I think you could make a topic in the "Your creation" forums as well, get more visibility for your plugins and behaviors, but please, keep posting them in that forum, it's easier for me to keep listing them.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,998
Reputation: 57,791

Post » Thu Aug 23, 2012 12:28 am

@Pode : u always did nice plugs but this one is really impressive...good job indeed ^^
B
159
S
38
G
11
Posts: 229
Reputation: 17,361

Post » Thu Aug 23, 2012 12:37 am

This is incredibly cool!
B
9
S
3
G
4
Posts: 80
Reputation: 3,268

Post » Thu Aug 23, 2012 12:45 am

Cool plugin but the demo is giving an error in Firefox.
TypeError: jQuery("#" + b.id).kl is not a function
B
54
S
28
G
18
Posts: 1,520
Reputation: 24,990

Post » Thu Aug 23, 2012 2:09 pm

@ramones : ah yes, I forgot that when minified, I can have that kind of surprise. For the moment, that means it's only working when non-minified. I'll supply a new build with that corrected.
B
33
S
9
G
6
Posts: 709
Reputation: 6,704

Next

Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 3 guests