Capture a still frame from a USB camera

Hello, my idea for a program is to use the user's USB web camera to take a picture and display it on the screen.

What i have so far is:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include "SDL/SDL.h"

int main( int argc, char* args[] )
{
    bool quit = false;
    //images
    SDL_Surface* picture = NULL;
    SDL_Surface* screen = NULL;

    //start SDL & screen
    SDL_Init( SDL_INIT_EVERYTHING );
    screen = SDL_SetVideoMode( 640, 480, 32, SDL_SWSURFACE );

    //create event
    SDL_Event event;

    //Here is where the program would take the picture, and save it as picture.bmp
    
    //Load image
    picture = SDL_LoadBMP( "picture.bmp" );

    //Apply image
    SDL_BlitSurface( picture, NULL, screen, NULL );
    SDL_Flip( screen );

    //Loops untill user exits program
    while ( quit == false )
    {
          //Grabs events
          while ( SDL_PollEvent( &event))
          {
                if (event.type == SDL_QUIT)
                {
                               quit = true;
                }
          }
    }


    //Exiting
    SDL_FreeSurface( picture );
    SDL_Quit();

    return 0;
}


Threw searching on the web I haven't found anything helpful except for a reference to DirectShow (now part of the windows SDK). I would greatly appreciate it if some one could point me in the right direction to take a picture using a USB camera.
Topic archived. No new replies allowed.