Ask Your Question
0

How can I do this? PSEye Capture Video

asked 2016-07-25 12:18:15 -0600

I need capture video from four cameras (PSEye) and save AVI files. I do not intend to use the data in real time. And I do not have much programming knowledge. It is possible to achieve this in a simple way?

https://www.youtube.com/watch?v=f1l3T...

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
1

answered 2016-07-27 01:13:08 -0600

berak gravatar image

processing multiple cams is not much different from a single cam, you just have to be aware, that there's bandwith limits from the usb bus. if you experience trouble there

  • don't plug all your cams into the same usb bus
  • reduce the resolution (see below)


#include "opencv2/opencv.hpp"
using namespace cv;

#include <iostream>
using namespace std;

int main(int argc, char **argv)
{
    int N = 4; // num cams:
    Size S(320,240);
    vector<VideoCapture> caps(N);

    for (int i=0; i<N; i++)
    {
        if ( ! caps[i].open(i) )
        {
            cerr << "capture " << i << " won't open !" << endl;
            return -1;
        }
        cerr << "cap " << i << " : " << caps[i].isOpened() << endl;

        // lower resolution:
        caps[i].set(CAP_PROP_FRAME_WIDTH,  S.width);
        caps[i].set(CAP_PROP_FRAME_HEIGHT, S.height);
    }

    while(1)
    {
        for (int i=0; i<N; i++)
        {
            Mat frame;
            if ( ! caps[i].read(frame) )
            {
                cerr << "could not read image from capture " << i << endl;
                return -1;
            }

            //
            // process frame from capture i ...
            //
            // show it:
            imshow(format("cap%d",i), frame);
        }
        if (waitKey(10)==27) break;
    }
}
edit flag offensive delete link more

Comments

1

sorry, @babajj, but we could not leave it like this !

berak gravatar imageberak ( 2016-07-27 01:14:28 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2016-07-25 12:18:15 -0600

Seen: 234 times

Last updated: Jul 27 '16