Problems with openCV and webcam grabbing

Hello folks,

I got a problem with my webcam. I wrote a simple application to read out my webcam by using the openCV API. It is nearly working, I can see the frames of my webcam in the openCV window, but the shell says: "ERROR: SampleCB() - buffer sizes do not match ". There are some samples from openCV that do not work because of that problem. The code for my simple application looks like this:

  
  
#include "cv.h"  
#include "highgui.h"  
#include <stdio.h>  
#include <iostream>  
  
// A Simple Camera Capture Framework  
int main() {  
  
  CvCapture* capture = cvCaptureFromCAM( CV_CAP_ANY );  
  //cvSetCaptureProperty(capture, CV_CAP_PROP_FRAME_WIDTH, 640);  
  //cvSetCaptureProperty(capture, CV_CAP_PROP_FRAME_HEIGHT, 480);  
  
  if( !capture ) {  
    fprintf( stderr, "ERROR: capture is NULL \n" );  
    getchar();  
    return -1;  
  }  
  
  // Create a window in which the captured images will be presented  
  cvNamedWindow( "mywindow", CV_WINDOW_AUTOSIZE );  
  
  // Show the image captured from the camera in the window and repeat  
    
  IplImage* frame;  
    
  while( 1 ) {  
    // Get one frame  
    frame = cvQueryFrame( capture );  
    if( !frame ) {  
      fprintf( stderr, "ERROR: frame is null...\n" );  
      getchar();  
      break;  
    }  
	  
	cvShowImage( "mywindow", frame );  
    // Do not release the frame!  
  
    //If ESC key pressed, Key=0x10001B under OpenCV 0.9.7(linux version),  
    //remove higher bits using AND operator  
    if( (cvWaitKey(10) & 255) == 27 ) break;  
  }  
  
  // Release the capture device housekeeping  
  cvReleaseCapture( &capture );  
  cvDestroyWindow( "mywindow" );  
  return 0;  
}  
  

Does anybody know how to fix the Problem? Thanks a lot!
[/code]

You might have an easier time with it using the openframeworks library or asking this question in the opencv groups. Download the FAT version and check out the examples.
http://www.openframeworks.cc/download