Showing posts with label webcame. Show all posts
Showing posts with label webcame. Show all posts

Tuesday, 28 April 2015

Arduino based webcam face tracker

So for this project I used processing, openCV, Arduino and an old webcam.
The Arduino code is from Adafruit and the processing code is written by me and (soon to be) hosted on my Github. For the code, skip to the end. 


 
I decided to used my (10+ years?) old webcam.

 
The base was very heavy so I decided to remove it. Then I decided to open it up as I was curious to how its inside looked. 


 
This is how it looked like on the inside. The round black rubber thing makes sure light is tunneled though to the lens and does not get in from angles. 


As the rubber cover was in place due to pressure, and the pressure was removed, I tired to fashion another cover out of things on my table. What worked in the end was foam (as usual). 




Managed to get the code working with an external camera device.

 
While I had a servo(on the left), I wanted to make it work on two axis so I purchased another one and also a First Person View(FPV) cradle.


 
 
Honestly the cradle was hard to put together as it did not come with instructions and I had to figure out how to assemble it on my own. And to make matters worse, I was not provided with the correct arm size(the white thing). Cutting its length was fine but the width was very troublesome.  



 And tad-da! The final product! 

I took a video demo of it. One video of the webcam face tracker in motion and another screen recording. However the screen recording was not captured properly. Hence I cannot upload those videos. 

About the code:
So initially I took two files from Adafruit. One was for the Arduino and the other was for processing. 
While the Arduino code worked well, the processing one was broken. It was based on a library that could not be found anywhere on the net. 

I then took a look at some of the openCV examples. Based off the examples, I managed to put together some code that did the trick. I will be uploading it on Github soon and will update this post with the link.