By passing -1 to the cvCaptureFromCAM() function, you're telling OpenCV that you don't care what camera is being used, so it uses the first camera it can open.
If you want to use 2 cams, you might have to open them explicitly.
capture_cam0 = cvCaptureFromCAM(0);
capture_cam1 = cvCaptureFromCAM(1);
Then just create 2 windows, check both if captures are open and release both captures etc.
Nick Evan
Cold-a$$ donkey
10,261 posts since Oct 2006
Reputation Points: 4,155
Solved Threads: 416
Skill Endorsements: 22
Haven't tried it before, because I don't have two webcams :) But I don't see why they should be the same model or brand
Nick Evan
Cold-a$$ donkey
10,261 posts since Oct 2006
Reputation Points: 4,155
Solved Threads: 416
Skill Endorsements: 22
> capture2 = cvCaptureFromCAM( 1 );
It means this returned NULL.
It also means there was probably a problem with the call.
It also means that there's also probably an error function you can call to find out more about why it returned NULL.
If you RTFM for this function, and look at the "return result" section, see what it has to say about what "NULL" means as a result.
Salem
Posting Sage
11,531 posts since Dec 2005
Reputation Points: 5,875
Solved Threads: 953
Skill Endorsements: 27
Try this:
cout << cvcamGetCamerasCount();;
what does it output?
Nick Evan
Cold-a$$ donkey
10,261 posts since Oct 2006
Reputation Points: 4,155
Solved Threads: 416
Skill Endorsements: 22
Are you just making stuff up without bothering to read the manuals?
The threads of a single process can use a critical section object for mutual-exclusion synchronization. The process is responsible for allocating the memory used by a critical section object, which it can do by declaring a variable of type CRITICAL_SECTION. Before using a critical section, some thread of the process must call InitializeCriticalSection or InitializeCriticalSectionAndSpinCount to initialize the object.
Do you do this - nope
> cvDestroyWindow( VidLeft );
> cvReleaseCapture( &capture );
Did you bother to wait for the threads to exit, before deleting all the resources those threads depend on - nope.
The rug is pulled from underneath the threads before they even begin.
How about starting with a tutorial?
http://www.cs.iit.edu/~agam/cs512/lect-notes/opencv-intro/opencv-intro.html
Salem
Posting Sage
11,531 posts since Dec 2005
Reputation Points: 5,875
Solved Threads: 953
Skill Endorsements: 27