Ask Your Question

indra's profile - activity

2017-07-23 08:10:09 -0600 commented question How to dewarp the videos in 360 deg view

Hi, yes out of 4 two gets overlap , the above example you mentioned is for image ,, I need some example which works for videos so that I can try and build on top that ....

thanks ....

2017-07-20 12:25:26 -0600 asked a question How to dewarp the videos in 360 deg view

Hi, I have video from 4 different camera I want to dewarp the, in 360 degree view or stitch the 4 videos in to single view ?

I have written the below code to display the 4 videos but could not get how to dewarp them

int main(int argc, char** argv)
 {

//string firstvideo = "1.avi";

string firstvideo = "1.avi";
string secondvideo= "2.avi";

string thirddvideo = "3.avi";

string fourthvideo = "4.avi";

VideoCapture capture(firstvideo);
//VideoCapture capture(0); /* if we need to read from the Direct Camera*/
VideoCapture capture1(secondvideo);
VideoCapture capture2(thirddvideo);
VideoCapture capture3(fourthvideo);

Mat frame;
Mat frame1;
Mat frame2;
Mat frame3;

if( !capture.isOpened() )
    throw "Error when reading steam_avi0";
if( !capture1.isOpened() )
    throw "Error when reading steam_avi1";
if( !capture2.isOpened() )
    throw "Error when reading steam_avi2";
if( !capture3.isOpened() )
    throw "Error when reading steam_avi3";


namedWindow( "w", 1);

for( ; ; )
{
    capture >> frame;
    capture1 >> frame1;

    capture2 >> frame2;
    capture3 >> frame3;

    resize(frame, frame, Size(640, 360), 0, 0, INTER_CUBIC);
    resize(frame1, frame1, Size(640, 360), 0, 0, INTER_CUBIC);
    resize(frame2, frame2, Size(640, 360), 0, 0, INTER_CUBIC);
    resize(frame3, frame3, Size(640, 360), 0, 0, INTER_CUBIC);

    Mat canvas = Mat::zeros(frame.rows*4+1, frame.cols*4+1, frame.type());
    waitKey(20);

    frame.copyTo(canvas(Rect(0,0,frame.cols,frame.rows )));
    frame1.copyTo(canvas(Rect(frame.cols,0,frame1.cols,frame1.rows )));
    frame2.copyTo(canvas(Rect(0,frame.rows,frame2.cols,frame2.rows )));
    frame3.copyTo(canvas(Rect(frame2.cols,frame1.rows,frame3.cols,frame3.rows )));
    // if it is too big to fit on the screen, then scale it down by 2, hopefully it'll fit :-)


    imshow("w", canvas);
}
waitKey(0); // key press to close window
// releases and window destroy are automatic in C++ interface
}
2017-06-18 12:50:49 -0600 commented answer opencv display all Multi video together in Single frame

Hi, Thanks it worked .. Is it possible to dewarp these 4 videos in 360 degree view using openCV? if its possible Could you guide how to do it?

2017-06-10 14:35:13 -0600 received badge  Editor (source)
2017-06-10 14:33:04 -0600 asked a question opencv display all Multi video together in Single frame

I am writing a openCV simple program to display multivideo in single frame.

I could write for two video , I want for 4 videos, Could some body guide how to display 4 videos in single frame (Like 4 videos in Square kind of frame. below is my code

 int main(int argc, char** argv)
{
   string filename = "/home/user/testaviravi.avi";
   VideoCapture capture(filename);
   VideoCapture capture1(filename);

   Mat frame;
   Mat frame1;

  if( !capture.isOpened() )
    throw "Error when reading steam_avi0";
  if( !capture1.isOpened() )
    throw "Error when reading steam_avi1";

  namedWindow( "w", 1);

 for( ; ; )
{
     capture >> frame;
    capture1 >> frame1;

    if(frame.empty())
         break;

    if(frame1.empty())
        break;

    Mat canvas = Mat::zeros(frame.rows*2+1, frame.cols*2+1, frame.type());
    frame.copyTo(canvas(Range::all(), Range(0, frame.cols)));
    frame1.copyTo(canvas(Range::all(), Range(frame1.cols+1, frame1.cols*2+1)));
    // if it is too big to fit on the screen, then scale it down by 2, hopefully it'll fit :-)
    imshow("w", canvas);
}
waitKey(0); // key press to close window
// releases and window destroy are automatic in C++ interface
}