Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Push & Pop a frame out of Mat vector

I have a vector<mat> frame_queue which i am using to store incoming frames from a USB camera. I want to pop out one single frame at a time to further process those frames.

The issue is i am using 2 USB cameras and i want to grab both frames in frame_queue vector. But i am not able to use this code to push

frame_queue[i].pushback(frame);

And how to pop a frame from the the frame_queue if i successfully push frames into it? How do i push and pop frames into and from frame_queue[i] ?

Push & Pop a frame out of Mat vector

I have a vector<mat> frame_queue which i am using to store incoming frames from a USB camera. I want to pop out one single frame at a time to further process those frames.

The issue is i am using 2 USB cameras and i want to grab both frames in frame_queue vector. But i am not able to use this code to push

frame_queue[i].pushback(frame);

Here is a sample code i am using :

//Make an instance of CameraStreamer
CameraStreamer cam(capture_index);

while (waitKey(20) != 27)
{
    //Retrieve frames from each camera capture thread
    for (size_t i = 0; i < capture_index.size(); i++)
    {
        Mat frame;
        //Pop frame from queue and check if the frame is valid
        cam.frame_queue[i].pushback(frame);
        //if (cam.frame_queue[i]->try_pop(frame)){
        //Show frame on Highgui window
            imshow(label[i], frame);
        //}
    }
}

frame_queue is declared as vector<mat> frame_queue. And how to pop a frame from the the frame_queue if i successfully push frames into it? How do i push and pop frames into and from frame_queue[i] ?

Push & Pop a frame out of Mat vector

I have a vector<mat> frame_queue which i am using to store incoming frames from a USB camera. I want to pop out one single frame at a time to further process those frames. I followed this link https://putuyuwono.wordpress.com/2015/05/29/multi-thread-multi-camera-capture-using-opencv/

The issue is i am using 2 USB cameras and i want to grab both frames in frame_queue vector. But i am not able to use this code to push

frame_queue[i].pushback(frame);

Here is a sample code i am using :

//Make an instance of CameraStreamer
CameraStreamer cam(capture_index);

while (waitKey(20) != 27)
{
    //Retrieve frames from each camera capture thread
    for (size_t i = 0; i < capture_index.size(); i++)
    {
        Mat frame;
        //Pop frame from queue and check if the frame is valid
        cam.frame_queue[i].pushback(frame);
        //if (cam.frame_queue[i]->try_pop(frame)){
        //Show frame on Highgui window
            imshow(label[i], frame);
        //}
    }
}

frame_queue is declared as vector<mat> frame_queue. And how to pop a frame from the frame_queue if i successfully push frames into it? How do i push and pop frames into and from frame_queue[i] ?

Push & Pop a frame out of Mat vector

I have a vector<mat> frame_queue which i am using to store incoming frames from a USB camera. I want to pop out one single frame at a time to further process those frames. I followed this link https://putuyuwono.wordpress.com/2015/05/29/multi-thread-multi-camera-capture-using-opencv/

The issue is i am using 2 USB cameras and i want to grab both frames in frame_queue vector. But i am not able to use this code to push

frame_queue[i].pushback(frame);

Here is a sample code i am using :

//Make an instance of CameraStreamer
CameraStreamer cam(capture_index);

while (waitKey(20) != 27)
{
    //Retrieve frames from each camera capture thread
    for (size_t i = 0; i < capture_index.size(); i++)
    {
        Mat frame;
        //Pop frame from queue and check if the frame is valid
        cam.frame_queue[i].pushback(frame);
cam.frame_queue[i].push_back(frame);
        //if (cam.frame_queue[i]->try_pop(frame)){
        //Show frame on Highgui window
            imshow(label[i], frame);
        //}
    }
}

frame_queue is declared as vector<mat> frame_queue. And how to pop a frame from the frame_queue if i successfully push frames into it? How do i push and pop frames into and from frame_queue[i] ?