954,499 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

How to capture and store images using a web cam in C?

Hi,

I want to know how to capture and store images using a webcam in C? I searched this many places I did not get it.If somebody knows it please tell me.

charkac
Newbie Poster
6 posts since May 2008
Reputation Points: 10
Solved Threads: 0
 

http://msdn.microsoft.com/en-us/library/ms630343%28VS.85%29.aspx

I think you should start there, but it's gonna be quite a lot of work I'm afraid. I've never done it myself, but that link seems to be good. If you are on Windows, that is.

If you like examples and hadn't found it yet: http://msdn.microsoft.com/en-us/library/ms630343%28VS.85%29.aspx

Clockowl
Posting Whiz
376 posts since May 2008
Reputation Points: 69
Solved Threads: 28
 

what are you trying to do exactly?

start and stop a webcam, or engage some of its other functions, just in an automated fashion?

or will this also involve interpreting the image files in some manner?


.

jephthah
Posting Maven
2,587 posts since Feb 2008
Reputation Points: 2,143
Solved Threads: 179
 

Not to be an ####### but poster says he wants to capture and store image data from a webcam. That's pretty specific, not?

Clockowl
Posting Whiz
376 posts since May 2008
Reputation Points: 69
Solved Threads: 28
 

if you're just trying to send commands to blindly operate it, then the easiest (as in "hackiest" and least-portable) way to do this is to send the camera system() commands

this requires that you know the command line interface to the webcam... and that it even has one.

jephthah
Posting Maven
2,587 posts since Feb 2008
Reputation Points: 2,143
Solved Threads: 179
 

I actually have a robort on which a camera mounted.I need to write a C code in that robort's embeded system so that it will be able to capture an image autonomously when a condition is satisfied.And then I will store the image , compress it and transmit.

charkac
Newbie Poster
6 posts since May 2008
Reputation Points: 10
Solved Threads: 0
 
Not to be an ####### but poster says he wants to capture and store image data from a webcam. That's pretty specific, not?

the surest way to know when someones going to be an ass, is that they preface their statement, "not to be an ass, but ...."

Okay, here's the deal, ass: I've learned in my short time here that new posters tend to trickle out details of their requirements, little by little.

Y'see, ass, im trying to shorten the process a bit. Does hereally just want to blindly snap pictures, ass? Or is there going to be some sort of dynamic feedback control?

Either way is fine, ass, but before i go too far in looking for a solution, I want to understand the full problem.

.

jephthah
Posting Maven
2,587 posts since Feb 2008
Reputation Points: 2,143
Solved Threads: 179
 
I actually have a robort on which a camera mounted.I need to write a C code in that robort's embeded system so that it will be able to capture an image autonomously when a condition is satisfied.And then I will store the image , compress it and transmit.

that sounds pretty cool

i'm going to first admit, i have never done anything involving this, so i'm making some semi-informed guesses.

what is the make and model of the web cam? is it a COTS device? do you have latitude in choosing which device to use, or are there a few devices that have been spec'd?

jephthah
Posting Maven
2,587 posts since Feb 2008
Reputation Points: 2,143
Solved Threads: 179
 

I can actually choose any device I want. but I already got a logitech quick cam

charkac
Newbie Poster
6 posts since May 2008
Reputation Points: 10
Solved Threads: 0
 

okay, first thing you should do is look for "command line interface" in the documentation for your cam. once you find that, then look into the C command, "system()" ... if your cam has no command line interface you may want to consider getting your money back and finding one that does.

i am leaving soon and will not be able to follow up with this until later tonight.

im sure there will be a solution. just keep plugging at it.

jephthah
Posting Maven
2,587 posts since Feb 2008
Reputation Points: 2,143
Solved Threads: 179
 

k fin

charkac
Newbie Poster
6 posts since May 2008
Reputation Points: 10
Solved Threads: 0
 

okay, apparently most webcams do not have a command line interface, and this will not be as easy as i assumed.

im still lookin

jephthah
Posting Maven
2,587 posts since Feb 2008
Reputation Points: 2,143
Solved Threads: 179
 
Salem
Posting Sage
Team Colleague
11,531 posts since Dec 2005
Reputation Points: 5,862
Solved Threads: 953
 

this is actually quite an involved project. As interesting as this is, i must apologize, I just don't have time to commit to this right now. it's really going to be a lot of work

here is something that may help you: C program ("streamer") written for linux that allow commandline interface for controlling webcams.

http://www.linux.com/base/ldp/howto/Webcam-HOWTO/framegrabbers.html

but being a linux app, it presumes you have the drivers installed.

http://qce-ga.sourceforge.net/

there are similar windows apps, but they involve drivers and the Windows API.

i hope you didnt put this project off to the last minute.

.

jephthah
Posting Maven
2,587 posts since Feb 2008
Reputation Points: 2,143
Solved Threads: 179
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You