Please see my comment to the question.
You will easily find some ready-to-use solutions here: http://www.codeproject.com/search.aspx?doctypeid=1&q=%28%22Web+camera%22+OR++Webcam%29
However, this is not the best search query. You should better narrow it down by mentioning your UI library.
But decent ready-to-use solutions are available; I'll guarantee that because I use some of them myself.