Re: Bls: cvCaptureFromCAM( ) for two webcams

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: Bls: cvCaptureFromCAM( ) for two webcams

Rafael Beserra
Hi Pete,

so isnt there a solution (Im looking for a software-solution :-))
using linux? I also have to use 2 cameras and it seems that both are
connected to the same USB host.

Bus 002 Device 001: ID 0000:0000
Bus 001 Device 004: ID 041e:401d Creative Technology, Ltd WebCam NX Ultra
Bus 001 Device 003: ID 041e:401d Creative Technology, Ltd WebCam NX Ultra

2008/12/16 Pete Bergstrom <[hidden email]>:

> K T <[hidden email]> wrote:
>> but Is it working for two separate USB cameras?
>
>>(not firewire)
>
> Perhaps you need to examine your system carefully. I'm using Linux and after
> some searching the web found a reference to a limitation of V4L/V4L2 that
> requires the webcams to be on separate USB host ports. My laptop has two USB
> jacks but they are apparently part of the same USB host port. If you're
> using
> Linux, you need to take this into account. If you're using Windows, there
> may
> be a different reason for the problem.
>
> I have a very simple derivative of camshiftdemo which connects to a single
> camera (arg passed on command line exactly as in the original code) and
> displays the image with various forms of processing. I can run two instances
> and connect each one to a different webcam as long as they're on different
> USB
> host ports. When they're on the same USB host port, the first program to
> connect to either camera succeeds while the second program always fails,
> usually with a non-useful error message. The cameras are both Logitech
> QuickCam Pro 5000 models.
>
> Pete
>
>
K T
Reply | Threaded
Open this post in threaded view
|

Re: Bls: cvCaptureFromCAM( ) for two webcams

K T
So if you download the latest cvs version from opencv,

it will work. look for other posts of mine to see sample code.



--- On Sat, 12/27/08, Rafael Beserra <[hidden email]> wrote:

From: Rafael Beserra <[hidden email]>
Subject: Re: Bls: [OpenCV] cvCaptureFromCAM( ) for two webcams
To: [hidden email]
Date: Saturday, December 27, 2008, 5:46 PM










   
            Hi Pete,



so isnt there a solution (Im looking for a software-solution :-))

using linux? I also have to use 2 cameras and it seems that both are

connected to the same USB host.



Bus 002 Device 001: ID 0000:0000

Bus 001 Device 004: ID 041e:401d Creative Technology, Ltd WebCam NX Ultra

Bus 001 Device 003: ID 041e:401d Creative Technology, Ltd WebCam NX Ultra



2008/12/16 Pete Bergstrom <bergstro@usa. net>:

> K T <tsourk2002@yahoo. com> wrote:

>> but Is it working for two separate USB cameras?

>

>>(not firewire)

>

> Perhaps you need to examine your system carefully. I'm using Linux and after

> some searching the web found a reference to a limitation of V4L/V4L2 that

> requires the webcams to be on separate USB host ports. My laptop has two USB

> jacks but they are apparently part of the same USB host port. If you're

> using

> Linux, you need to take this into account. If you're using Windows, there

> may

> be a different reason for the problem.

>

> I have a very simple derivative of camshiftdemo which connects to a single

> camera (arg passed on command line exactly as in the original code) and

> displays the image with various forms of processing. I can run two instances

> and connect each one to a different webcam as long as they're on different

> USB

> host ports. When they're on the same USB host port, the first program to

> connect to either camera succeeds while the second program always fails,

> usually with a non-useful error message. The cameras are both Logitech

> QuickCam Pro 5000 models.

>

> Pete

>

>


     

   
   
       
         
       
       








       


       
       


     

[Non-text portions of this message have been removed]

Reply | Threaded
Open this post in threaded view
|

Re: Bls: cvCaptureFromCAM( ) for two webcams

Rafael Beserra
I downloaded the last version from CVS, but it still not working and
my code is similar to yours. I also tried using (-1,-1) as params to
cvCaptureFromCam (also cvCreateCameraCapture), (0,0), (0,1), (0,-1),
etc... the second camera never works... I wonder if its a V4L2
limitation =/

Thanks for your help

2008/12/28 K T <[hidden email]>:

> So if you download the latest cvs version from opencv,
>
> it will work. look for other posts of mine to see sample code.
>
> --- On Sat, 12/27/08, Rafael Beserra <[hidden email]> wrote:
>
> From: Rafael Beserra <[hidden email]>
> Subject: Re: Bls: [OpenCV] cvCaptureFromCAM( ) for two webcams
> To: [hidden email]
> Date: Saturday, December 27, 2008, 5:46 PM
>
> Hi Pete,
>
> so isnt there a solution (Im looking for a software-solution :-))
>
> using linux? I also have to use 2 cameras and it seems that both are
>
> connected to the same USB host.
>
> Bus 002 Device 001: ID 0000:0000
>
> Bus 001 Device 004: ID 041e:401d Creative Technology, Ltd WebCam NX Ultra
>
> Bus 001 Device 003: ID 041e:401d Creative Technology, Ltd WebCam NX Ultra
>
> 2008/12/16 Pete Bergstrom <bergstro@usa. net>:
>
>> K T <tsourk2002@yahoo. com> wrote:
>
>>> but Is it working for two separate USB cameras?
>
>>
>
>>>(not firewire)
>
>>
>
>> Perhaps you need to examine your system carefully. I'm using Linux and
>> after
>
>> some searching the web found a reference to a limitation of V4L/V4L2 that
>
>> requires the webcams to be on separate USB host ports. My laptop has two
>> USB
>
>> jacks but they are apparently part of the same USB host port. If you're
>
>> using
>
>> Linux, you need to take this into account. If you're using Windows, there
>
>> may
>
>> be a different reason for the problem.
>
>>
>
>> I have a very simple derivative of camshiftdemo which connects to a single
>
>> camera (arg passed on command line exactly as in the original code) and
>
>> displays the image with various forms of processing. I can run two
>> instances
>
>> and connect each one to a different webcam as long as they're on different
>
>> USB
>
>> host ports. When they're on the same USB host port, the first program to
>
>> connect to either camera succeeds while the second program always fails,
>
>> usually with a non-useful error message. The cameras are both Logitech
>
>> QuickCam Pro 5000 models.
>
>>
>
>> Pete
>
>>
>
>>
>
>
>
>
>
>
>
>
>
>
>
> [Non-text portions of this message have been removed]
>
>
K T
Reply | Threaded
Open this post in threaded view
|

Re: Bls: cvCaptureFromCAM( ) for two webcams

K T
In reply to this post by Rafael Beserra
can I See your code?

--- On Mon, 12/29/08, Rafael Beserra <[hidden email]> wrote:

From: Rafael Beserra <[hidden email]>
Subject: Re: Bls: [OpenCV] cvCaptureFromCAM( ) for two webcams
To: [hidden email]
Date: Monday, December 29, 2008, 11:19 AM










   
            I downloaded the last version from CVS, but it still not working and

my code is similar to yours. I also tried using (-1,-1) as params to

cvCaptureFromCam (also cvCreateCameraCaptu re), (0,0), (0,1), (0,-1),

etc... the second camera never works... I wonder if its a V4L2

limitation =/



Thanks for your help



2008/12/28 K T <tsourk2002@yahoo. com>:

> So if you download the latest cvs version from opencv,

>

> it will work. look for other posts of mine to see sample code.

>

> --- On Sat, 12/27/08, Rafael Beserra <rafaelufrn@gmail. com> wrote:

>

> From: Rafael Beserra <rafaelufrn@gmail. com>

> Subject: Re: Bls: [OpenCV] cvCaptureFromCAM( ) for two webcams

> To: OpenCV@yahoogroups. com

> Date: Saturday, December 27, 2008, 5:46 PM

>

> Hi Pete,

>

> so isnt there a solution (Im looking for a software-solution :-))

>

> using linux? I also have to use 2 cameras and it seems that both are

>

> connected to the same USB host.

>

> Bus 002 Device 001: ID 0000:0000

>

> Bus 001 Device 004: ID 041e:401d Creative Technology, Ltd WebCam NX Ultra

>

> Bus 001 Device 003: ID 041e:401d Creative Technology, Ltd WebCam NX Ultra

>

> 2008/12/16 Pete Bergstrom <bergstro@usa. net>:

>

>> K T <tsourk2002@ yahoo. com> wrote:

>

>>> but Is it working for two separate USB cameras?

>

>>

>

>>>(not firewire)

>

>>

>

>> Perhaps you need to examine your system carefully. I'm using Linux and

>> after

>

>> some searching the web found a reference to a limitation of V4L/V4L2 that

>

>> requires the webcams to be on separate USB host ports. My laptop has two

>> USB

>

>> jacks but they are apparently part of the same USB host port. If you're

>

>> using

>

>> Linux, you need to take this into account. If you're using Windows, there

>

>> may

>

>> be a different reason for the problem.

>

>>

>

>> I have a very simple derivative of camshiftdemo which connects to a single

>

>> camera (arg passed on command line exactly as in the original code) and

>

>> displays the image with various forms of processing. I can run two

>> instances

>

>> and connect each one to a different webcam as long as they're on different

>

>> USB

>

>> host ports. When they're on the same USB host port, the first program to

>

>> connect to either camera succeeds while the second program always fails,

>

>> usually with a non-useful error message. The cameras are both Logitech

>

>> QuickCam Pro 5000 models.

>

>>

>

>> Pete

>

>>

>

>>

>

>

>

>

>

>

>

>

>

>

>

> [Non-text portions of this message have been removed]

>

>


     

   
   
       
         
       
       








       


       
       


     

[Non-text portions of this message have been removed]

Reply | Threaded
Open this post in threaded view
|

Re: Bls: cvCaptureFromCAM( ) for two webcams

muh_84
Reply | Threaded
Open this post in threaded view
|

Re: Bls: cvCaptureFromCAM( ) for two webcams

Rafael Beserra
In reply to this post by K T
The result is

HIGHGUI ERROR: V4L: device /dev/video1: Unable to query number of channels
Could not initialize capturing at dev/video1...

for the following code:

#include <stdlib.h>
#include <stdio.h>
#include <cv.h>
#include <cvaux.h>
#include <highgui.h>

int main(int* argc, char** argv) {

    CvCapture* capture1 = 0;
    CvCapture* capture2 = 0;
    IplImage* frame1 = 0;
    IplImage* frame2 = 0;

    capture1 = cvCaptureFromCAM(0);
    capture2 = cvCaptureFromCAM(1);
//  capture1 = cvCreateCameraCapture(1);
//  capture2 = cvCreateCameraCapture(0);

    if( !capture1 ) {
        fprintf(stderr,"Could not initialize capturing at dev/video0...\n");
        return -1;
    }
    if( !capture2 ) {
        fprintf(stderr,"Could not initialize capturing at dev/video1...\n");
    }

    for(;;){
        frame1 = cvQueryFrame(capture1);
        if(capture2) frame2 = cvQueryFrame(capture2);

        if(!frame1){
            printf("Could not query frame...\n");
            break;
        }
        if(capture2 && !frame2){
            printf("Could not query frame...\n");
            break;
        }
    }
    cvReleaseCapture(&capture1);
    return 0;
}

2008/12/31 K T <[hidden email]>:

> can I See your code?
>
> --- On Mon, 12/29/08, Rafael Beserra <[hidden email]> wrote:
>
> From: Rafael Beserra <[hidden email]>
> Subject: Re: Bls: [OpenCV] cvCaptureFromCAM( ) for two webcams
> To: [hidden email]
> Date: Monday, December 29, 2008, 11:19 AM
>
> I downloaded the last version from CVS, but it still not working and
>
> my code is similar to yours. I also tried using (-1,-1) as params to
>
> cvCaptureFromCam (also cvCreateCameraCaptu re), (0,0), (0,1), (0,-1),
>
> etc... the second camera never works... I wonder if its a V4L2
>
> limitation =/
>
> Thanks for your help
>
> 2008/12/28 K T <tsourk2002@yahoo. com>:
>
>> So if you download the latest cvs version from opencv,
>
>>
>
>> it will work. look for other posts of mine to see sample code.
>
>>
>
>> --- On Sat, 12/27/08, Rafael Beserra <rafaelufrn@gmail. com> wrote:
>
>>
>
>> From: Rafael Beserra <rafaelufrn@gmail. com>
>
>> Subject: Re: Bls: [OpenCV] cvCaptureFromCAM( ) for two webcams
>
>> To: OpenCV@yahoogroups. com
>
>> Date: Saturday, December 27, 2008, 5:46 PM
>
>>
>
>> Hi Pete,
>
>>
>
>> so isnt there a solution (Im looking for a software-solution :-))
>
>>
>
>> using linux? I also have to use 2 cameras and it seems that both are
>
>>
>
>> connected to the same USB host.
>
>>
>
>> Bus 002 Device 001: ID 0000:0000
>
>>
>
>> Bus 001 Device 004: ID 041e:401d Creative Technology, Ltd WebCam NX Ultra
>
>>
>
>> Bus 001 Device 003: ID 041e:401d Creative Technology, Ltd WebCam NX Ultra
>
>>
>
>> 2008/12/16 Pete Bergstrom <bergstro@usa. net>:
>
>>
>
>>> K T <tsourk2002@ yahoo. com> wrote:
>
>>
>
>>>> but Is it working for two separate USB cameras?
>
>>
>
>>>
>
>>
>
>>>>(not firewire)
>
>>
>
>>>
>
>>
>
>>> Perhaps you need to examine your system carefully. I'm using Linux and
>
>>> after
>
>>
>
>>> some searching the web found a reference to a limitation of V4L/V4L2 that
>
>>
>
>>> requires the webcams to be on separate USB host ports. My laptop has two
>
>>> USB
>
>>
>
>>> jacks but they are apparently part of the same USB host port. If you're
>
>>
>
>>> using
>
>>
>
>>> Linux, you need to take this into account. If you're using Windows, there
>
>>
>
>>> may
>
>>
>
>>> be a different reason for the problem.
>
>>
>
>>>
>
>>
>
>>> I have a very simple derivative of camshiftdemo which connects to a
>>> single
>
>>
>
>>> camera (arg passed on command line exactly as in the original code) and
>
>>
>
>>> displays the image with various forms of processing. I can run two
>
>>> instances
>
>>
>
>>> and connect each one to a different webcam as long as they're on
>>> different
>
>>
>
>>> USB
>
>>
>
>>> host ports. When they're on the same USB host port, the first program to
>
>>
>
>>> connect to either camera succeeds while the second program always fails,
>
>>
>
>>> usually with a non-useful error message. The cameras are both Logitech
>
>>
>
>>> QuickCam Pro 5000 models.
>
>>
>
>>>
>
>>
>
>>> Pete
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>
>
>>
>
>>
>
>>
>
>>
>
>>
>
>>
>
>>
>
>>
>
>>
>
>> [Non-text portions of this message have been removed]
>
>>
>
>>
>
>
>
>
>
>
>
>
>
>
>
> [Non-text portions of this message have been removed]
>
>
K T
Reply | Threaded
Open this post in threaded view
|

Re: Bls: cvCaptureFromCAM( ) for two webcams

K T
In reply to this post by Rafael Beserra
Ok so for starters,
make sure you recompile opencv and
reconfigure in this fashion:

./configure --without-ffmpeg --with-v4l   (or v4l2)

--- On Wed, 12/31/08, Rafael Beserra <[hidden email]> wrote:

From: Rafael Beserra <[hidden email]>
Subject: Re: Bls: [OpenCV] cvCaptureFromCAM( ) for two webcams
To: [hidden email]
Date: Wednesday, December 31, 2008, 9:44 AM










   
            The result is



HIGHGUI ERROR: V4L: device /dev/video1: Unable to query number of channels

Could not initialize capturing at dev/video1.. .



for the following code:



#include <stdlib.h>

#include <stdio.h>

#include <cv.h>

#include <cvaux.h>

#include <highgui.h>



int main(int* argc, char** argv) {



CvCapture* capture1 = 0;

    CvCapture* capture2 = 0;

    IplImage* frame1 = 0;

    IplImage* frame2 = 0;



capture1 = cvCaptureFromCAM( 0);

    capture2 = cvCaptureFromCAM( 1);

//  capture1 = cvCreateCameraCaptu re(1);

//  capture2 = cvCreateCameraCaptu re(0);



if( !capture1 ) {

        fprintf(stderr, "Could not initialize capturing at dev/video0.. .\n");

        return -1;

    }

    if( !capture2 ) {

        fprintf(stderr, "Could not initialize capturing at dev/video1.. .\n");

    }



for(;;){

        frame1 = cvQueryFrame( capture1) ;

        if(capture2) frame2 = cvQueryFrame( capture2) ;



if(!frame1){

            printf("Could not query frame...\n") ;

            break;

        }

        if(capture2 && !frame2){

            printf("Could not query frame...\n") ;

            break;

        }

    }

    cvReleaseCapture( &capture1) ;

    return 0;

}



2008/12/31 K T <tsourk2002@yahoo. com>:

> can I See your code?

>

> --- On Mon, 12/29/08, Rafael Beserra <rafaelufrn@gmail. com> wrote:

>

> From: Rafael Beserra <rafaelufrn@gmail. com>

> Subject: Re: Bls: [OpenCV] cvCaptureFromCAM( ) for two webcams

> To: OpenCV@yahoogroups. com

> Date: Monday, December 29, 2008, 11:19 AM

>

> I downloaded the last version from CVS, but it still not working and

>

> my code is similar to yours. I also tried using (-1,-1) as params to

>

> cvCaptureFromCam (also cvCreateCameraCaptu re), (0,0), (0,1), (0,-1),

>

> etc... the second camera never works... I wonder if its a V4L2

>

> limitation =/

>

> Thanks for your help

>

> 2008/12/28 K T <tsourk2002@ yahoo. com>:

>

>> So if you download the latest cvs version from opencv,

>

>>

>

>> it will work. look for other posts of mine to see sample code.

>

>>

>

>> --- On Sat, 12/27/08, Rafael Beserra <rafaelufrn@ gmail. com> wrote:

>

>>

>

>> From: Rafael Beserra <rafaelufrn@ gmail. com>

>

>> Subject: Re: Bls: [OpenCV] cvCaptureFromCAM( ) for two webcams

>

>> To: OpenCV@yahoogroups. com

>

>> Date: Saturday, December 27, 2008, 5:46 PM

>

>>

>

>> Hi Pete,

>

>>

>

>> so isnt there a solution (Im looking for a software-solution :-))

>

>>

>

>> using linux? I also have to use 2 cameras and it seems that both are

>

>>

>

>> connected to the same USB host.

>

>>

>

>> Bus 002 Device 001: ID 0000:0000

>

>>

>

>> Bus 001 Device 004: ID 041e:401d Creative Technology, Ltd WebCam NX Ultra

>

>>

>

>> Bus 001 Device 003: ID 041e:401d Creative Technology, Ltd WebCam NX Ultra

>

>>

>

>> 2008/12/16 Pete Bergstrom <bergstro@usa. net>:

>

>>

>

>>> K T <tsourk2002@ yahoo. com> wrote:

>

>>

>

>>>> but Is it working for two separate USB cameras?

>

>>

>

>>>

>

>>

>

>>>>(not firewire)

>

>>

>

>>>

>

>>

>

>>> Perhaps you need to examine your system carefully. I'm using Linux and

>

>>> after

>

>>

>

>>> some searching the web found a reference to a limitation of V4L/V4L2 that

>

>>

>

>>> requires the webcams to be on separate USB host ports. My laptop has two

>

>>> USB

>

>>

>

>>> jacks but they are apparently part of the same USB host port. If you're

>

>>

>

>>> using

>

>>

>

>>> Linux, you need to take this into account. If you're using Windows, there

>

>>

>

>>> may

>

>>

>

>>> be a different reason for the problem.

>

>>

>

>>>

>

>>

>

>>> I have a very simple derivative of camshiftdemo which connects to a

>>> single

>

>>

>

>>> camera (arg passed on command line exactly as in the original code) and

>

>>

>

>>> displays the image with various forms of processing. I can run two

>

>>> instances

>

>>

>

>>> and connect each one to a different webcam as long as they're on

>>> different

>

>>

>

>>> USB

>

>>

>

>>> host ports. When they're on the same USB host port, the first program to

>

>>

>

>>> connect to either camera succeeds while the second program always fails,

>

>>

>

>>> usually with a non-useful error message. The cameras are both Logitech

>

>>

>

>>> QuickCam Pro 5000 models.

>

>>

>

>>>

>

>>

>

>>> Pete

>

>>

>

>>>

>

>>

>

>>>

>

>>

>

>>

>

>>

>

>>

>

>>

>

>>

>

>>

>

>>

>

>>

>

>>

>

>>

>

>> [Non-text portions of this message have been removed]

>

>>

>

>>

>

>

>

>

>

>

>

>

>

>

>

> [Non-text portions of this message have been removed]

>

>


     

   
   
       
         
       
       








       


       
       


     

[Non-text portions of this message have been removed]