Friday, February 18, 2011

Face overlays

I've finished the first version of the GStreamer plugin that encapsulates facedetect and rsvgoverlay plugins.

I created a GstBin derived plugin that handles the bus messages sent by facedetect, then I allow the user to change the image size and position relative to the face itself. So any image can be placed above, below, to the left or right of your face, and it will have the right size when you get near or far away from the camera. Width and height can also be set as fractions of the face size.

I handle the bus messages sent by facedetect element in the container bin itself. At first I thought I would need to catch events in a custom internal element placed between the facedetect and the rsvgoverlay elements. This solution ended up being simpler and better, and we didn't have to add event sending functions to facedetect.


To see it working I downloaded some random images from openclipart and tweaked their sizes and positions so they would fit my face.



So, this took me a little longer than I thought, but I learned a lot about GStreamer plugins. Now I'll ask some people to review my code so it can be uploaded to gst-plugins-bad. Enjoy!

edit: here is the patch https://bugzilla.gnome.org/show_bug.cgi?id=642759

12 comments:

diego said...

Laura this is great! I hope you are enjoying your experience in the internship and stay around doing this awesome contributions ;)

Unknown said...

Wow - that looks great and seems to work really well! Congrats!

ecyrbe said...

Impressive. Good job.

Anonymous said...

Wow, nice work!

Anonymous said...

That's really nice work - I can't wait to see it in gst-plugins-bad. Give us a patch in bugzilla already :)

Anonymous said...

why is the video so slow? is it your webcam, opencv, or gstreamer?

sree said...

cool... :)

Anonymous said...

The video is very slow, but the effects are great. Keep up the good work :D

Alcab said...

Need a new hat, don't you ?

Aussie Danny said...

I have only one word to describe it... well... two. BLOODY AWESOME.
Way to go, girl!

Aussie Danny said...

BTW, have you watched The Social Network? If so, it would be a nice geekish idea to post your reflections on it... like... "do programmers tweet while they are coding?". I don't but it's not a bad idea to keep it as a 'coding combat journal'... what do you think?
Cheers, keep it up!

Unknown said...

@rojtberg: the video looks slow because I used gst-launch and I don't think I'm setting the resolution just right, it works a lot faster from inside cheese, for some reason.

@all thanks a lot! =)

@Aussie Danny: "The social network", yes I've watched it, I don't know... If I were to write about it I should watch it again to pinpoint lots of things about it. For example the role given to women in the movie.

About twitting while coding :D recently I started to fall in states I like to call "multitask of death" I should post about that hehe!