Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Grabbing multiple frames for marker detection in parallel

I have a marker detection code which runs fine with a video file and camera stream. I want to modify the code to grab frames from 2 videos in 2 different threads and then process marker detection accordingly. Here is a Psuedo code what i really want to do:

string camera[2] = {"test.avi","test1.avi"};
int main(){
VideoCapture cap();
while(1){
            int threads = get_num_threads(2);
            cap >> frame;
            marker_detection(frame);
            namedWindow(Camera[Thread], CV_WINDOW_NORMAL);
            imshow(Camera[Thread], frame);
            waitKey(1);
        }
}

It is just the pseudo code. I am completely new to multithreading. How do i grab a frame from both the files in parallel and then process marker detection for both the frames simultaneously? Note: i have gui functions like imshow() inside marker detection function.