2

I would like to code an app that captures a video from a webcam connected to the PC. I have found tutorials in other webs but they were in C++ or C# and I'm interested in doing it using C.

Do you know some web or have some knowledge that could help me with it?

I imagine that I would have to start my code "asking permission" to the SO to allow me to connect to the webcam but.... I have no idea how to do it neither how to continue.

Yu Hao
  • 119,891
  • 44
  • 235
  • 294
Antoni
  • 2,071
  • 2
  • 24
  • 31

2 Answers2

1

Capturing video input is very system dependent, as different systems handles it in different ways. You can use a library that is doing the hard work for you (either system independently or not) or you could write your own library to do what you want.

If you want a system independent solution you can take a look at OpenCV

Jocke
  • 673
  • 3
  • 8
1

I've noted your tag that you are on Windows, so this c library video4linux would not work for you.

However, in many cases OpenCV(in C/C++) will do it just fine. A lot parts of OpenCV are pure C, in which "Video Analysis" part might suits part of your need. Find this: http://opencv.willowgarage.com/documentation/c/

If you have to call the C++ part of OpenCV, you can write a c wrapper for the C++ part, while your remaining code could stay pure C. Reference this: Developing C wrapper API for Object-Oriented C++ code

Community
  • 1
  • 1
lulyon
  • 6,707
  • 7
  • 32
  • 49