Ask Your Question

Revision history [back]

Use OpenCV for Virtual reality video with 2 cameras

I have a very basic virtual reality helmet and two 4K USB cameras. I would like to be able to record a video with these two cameras by using Opencv in Ubuntu and C++ in order to playback it on my smartphone on the helmet.

I'm currently able to record and to stream images (in two different windows) coming from my two cameras in this way:

#include "opencv2/opencv.hpp"
#include "opencv2/highgui/highgui.hpp"

using namespace cv;
using namespace std;

    int main()
    {
        VideoCapture captureL("/dev/video0");
        if (!captureL.isOpened()) cout << "Problem on the left camera" << endl;
        VideoCapture captureR("/dev/video2");
        if (!captureR.isOpened()) cout << "Problem on the right camera" << endl;

        Mat imageL, imageR;

        while (1)
        {
            captureL >> imageL;
            captureR >> imageR;
            imshow("OriginalL", imageL);
            imshow("OriginalR", imageR);
            waitKey(1);
        }
    captureL.release();
    captureR.release();
    return 0;
    }

I would like to know if there is any document that I can study to understand how to implement the features I need. Is there any similar project or library which I can use as starting point?

Thank you!

Use OpenCV for Virtual reality video with 2 cameras

I have a very basic virtual reality helmet and two 4K USB cameras. I would like to be able to record a video with these two cameras by using Opencv in Ubuntu and C++ in order to playback it on my smartphone on the helmet.

I'm currently able to record and to stream images (in two different windows) coming from my two cameras in this way:

#include "opencv2/opencv.hpp"
#include "opencv2/highgui/highgui.hpp"

using namespace cv;
using namespace std;

    int main()
    {
        VideoCapture captureL("/dev/video0");
        if (!captureL.isOpened()) cout << "Problem on the left camera" << endl;
        VideoCapture captureR("/dev/video2");
        if (!captureR.isOpened()) cout << "Problem on the right camera" << endl;

        Mat imageL, imageR;

        while (1)
        {
            captureL >> imageL;
            captureR >> imageR;
            imshow("OriginalL", imageL);
            imshow("OriginalR", imageR);
            waitKey(1);
        }
    captureL.release();
    captureR.release();
    return 0;
    }

I would like to know if there is any document that I can study to understand how to implement the features I need. Is there any similar project or library which I can use as starting point?

Thank you!

Use OpenCV for Virtual reality video with 2 cameras

I have a very basic virtual reality helmet and two 4K USB cameras. I would like to be able to record a video with these two cameras by using Opencv in Ubuntu and C++ in order to playback it on my smartphone on the helmet.

I'm currently able to record and to stream images (in two different windows) coming from my two cameras in this way:

#include "opencv2/opencv.hpp"
#include "opencv2/highgui/highgui.hpp"

using namespace cv;
using namespace std;

    int main()
    {
        VideoCapture captureL("/dev/video0");
        if (!captureL.isOpened()) cout << "Problem on the left camera" << endl;
        VideoCapture captureR("/dev/video2");
        if (!captureR.isOpened()) cout << "Problem on the right camera" << endl;

        Mat imageL, imageR;

        while (1)
        {
            captureL >> imageL;
            captureR >> imageR;
            imshow("OriginalL", imageL);
            imshow("OriginalR", imageR);
            waitKey(1);
        }
    captureL.release();
    captureR.release();
    return 0;
    }

I would like to know if there is any document that I can study to understand how to implement the features I need. Is there any similar project or library which I can use as starting point?

The video format should be similar to the ones used for youtube videos, I took a screenshot as example.

image description

Thank you!