Main Page | Report this Page
Linux Forum Index  »  Linux Development - Applications  »  Reading minoru webcam...
Page 1 of 1    

Reading minoru webcam...

Author Message
atilla...
Posted: Tue Aug 04, 2009 7:08 am
Guest
I want to test some vision algorithms with a minoru webcam. It is actually
two z-star vimicro webcams and a usb hub in a single package.

Amsn and kopete are able to get perfect streaming input from the cam, so I
assume drivers and v4l2 framework is working OK. But for some reason, the
following opencv code doesn't work:


/* initialize camera */
capture = cvCaptureFromCAM( -1 );

.......
/* create a window for the video */
cvNamedWindow( "result", CV_WINDOW_AUTOSIZE );
.......
while( key != 'q' ) {
printf("%d\n",i++);
/* get a frame */
frame = cvQueryFrame( capture );

/* always check */
if( !frame ) break;

/* display current frame */
cvShowImage( "result", frame );

/* exit if user press 'q' */
key = cvWaitKey( 1 );
usleep();
}

Can you suggest anything? Actually I don't really care about opencv, what
are other ways of capturing webcam stream?

atilla
 
harasmussen...
Posted: Wed Sep 30, 2009 6:40 am
Guest
On Aug 4, 3:08 pm, atilla <ati... at (no spam) noneofyourbusiness.org> wrote:
Quote:
I want to test some vision algorithms with a minoru webcam. It is actually
two z-star vimicro webcams and a usb hub in a single package.

Amsn and kopete are able to get perfect streaming input from the cam, so I
assume drivers and v4l2 framework is working OK. But for some reason, the
following opencv code doesn't work:

         /* initialize camera */
          capture = cvCaptureFromCAM( -1 );

       .......
          /* create a window for the video */
          cvNamedWindow( "result", CV_WINDOW_AUTOSIZE );
       .......
          while( key != 'q' ) {
          printf("%d\n",i++);
              /* get a frame */
              frame = cvQueryFrame( capture );

              /* always check */
              if( !frame ) break;

              /* display current frame */
              cvShowImage( "result", frame );

              /* exit if user press 'q' */
              key = cvWaitKey( 1 );
           usleep();
          }

Can you suggest anything? Actually I don't really care about opencv, what
are other ways of capturing webcam stream?

atilla

I had the same problem once and solved it by making OpenCV sleep for
10 ms instead of just 1.
It sounds strange, but it worked...
 
 
Page 1 of 1    
All times are GMT - 5 Hours
The time now is Tue Dec 01, 2009 3:26 am