Video capture in a thread

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

Video capture in a thread

christophe_jacquelin
Hello,

I want to put the video capture with OpenCV in a thread. Could you send
me some examples of source code ?

Thank you,
Christophe,


Reply | Threaded
Open this post in threaded view
|

RE: Video capture in a thread

Dave Grossman
Is this what you want?

void main () // (int argc, char** argv)
{
        cout << "Starting..." << endl;
        if(SourceCam[0] >= 0) NumSources++;
        if(SourceCam[1] >= 0) NumSources++;
        NumCams = cvcamGetCamerasCount();
        cout << "Found " << NumCams << " real cameras" << endl;
        if(NumSources < 1)
        {
                cout << "Error: Number of sources < 1" << endl;
                return;
        }
        if(NumCams > NumSources)
        {
                cout << "Error: Number of cameras " << NumCams << " >
sources " << NumSources << endl;
                return;
        }
        if(NumCams < NumSources)
        {
                NumCams = NumSources;
                cout << "Number of cameras set to " << NumCams << endl;
        }
        controller = new SoundControl();
        _beginthread(ControlThread, 0, NULL);
        _beginthread(AudioThread, 0, NULL);
        _beginthread(VideoThread, 0, NULL);
        // Threads are working until they die
        while(C_KillThreads != 1) { Sleep(1000L); }
        while(C_EndThread == 0 || V_EndThread == 0 || A_EndThread == 0) {
Sleep(1000L); }
        cout << "\nALL DONE" << endl;
        Sleep(1000L);
}
 

________________________________

From: [hidden email] [mailto:[hidden email]] On Behalf Of
christophe_jacquelin
Sent: Wednesday, January 07, 2009 5:54 AM
To: [hidden email]
Subject: [OpenCV] Video capture in a thread



Hello,

I want to put the video capture with OpenCV in a thread. Could you send
me some examples of source code ?

Thank you,
Christophe,