Ask Your Question

Revision history [back]

video stitching problem

I'm trying to do video stitching but when I try this code then I get the message that "Could not initialize capturing for camera2"

warning: Error opening file </build>

#include <iostream> #include <fstream> #include "opencv2/imgcodecs.hpp" #include "opencv2/highgui.hpp" #include "opencv2/stitching.hpp"

using namespace std;
using namespace cv;

bool try_use_gpu = false;
vector<Mat> imgs;
string result_name = "result.jpg";

void printUsage();
int parseCmdArgs(int argc, char** argv);

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

        Mat fr1, fr2, copy1, copy2, pano;
        bool try_use_gpu = false;
        vector<Mat> imgs;
        VideoCapture cap1, cap2;

        string filename1 = "C:/Users/user/Desktop/lkt/build/Debug/me.avi";  

        cap1.open(filename1);

        if (!cap1.isOpened())
        {
            cout << "Could not initialize capturing for camera1...\n";
            return 0;
        }

        string filename2 = "C:/Users/user/Desktop/lkt/build/Debug/mee.avi";


        cap2.open(filename2);

        if (!cap2.isOpened())
        {
            cout << "Could not initialize capturing for camera2...\n";
            return 0;
        }

        //while (true)
        for (;;)
        {
            cap1 >> fr1;
            cap2 >> fr2;
            fr1.copyTo(copy1);
            fr2.copyTo(copy2);

            imgs.push_back(copy1);
            imgs.push_back(copy2);

            Stitcher stitcher = Stitcher::createDefault(1);
            Stitcher::Status status = stitcher.stitch(imgs, pano);

            if (status != Stitcher::OK)
            {
                cout << "Can't stitch images, error code = " << int(status) << endl;
                return -1;
            }

            imwrite(result_name, pano);
            imshow("Pano", pano);
            waitKey();

        }

video stitching problem

I'm trying to do video stitching but when I try this code then I get the message that "Could not initialize capturing for camera2"

warning: Error opening file </build>

#include <iostream> #include <fstream> #include "opencv2/imgcodecs.hpp" #include "opencv2/highgui.hpp" #include "opencv2/stitching.hpp"

using namespace std;
using namespace cv;

bool try_use_gpu = false;
vector<Mat> imgs;
string result_name = "result.jpg";

void printUsage();
int parseCmdArgs(int argc, char** argv);

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

        Mat fr1, fr2, copy1, copy2, pano;
        bool try_use_gpu = false;
        vector<Mat> imgs;
        VideoCapture cap1, cap2;

        string filename1 = "C:/Users/user/Desktop/lkt/build/Debug/me.avi";  

        cap1.open(filename1);

        if (!cap1.isOpened())
        {
            cout << "Could not initialize capturing for camera1...\n";
            return 0;
        }

        string filename2 = "C:/Users/user/Desktop/lkt/build/Debug/mee.avi";


        cap2.open(filename2);

        if (!cap2.isOpened())
        {
            cout << "Could not initialize capturing for camera2...\n";
            return 0;
        }

        //while (true)
        for (;;)
        {
            cap1 >> fr1;
            cap2 >> fr2;
            fr1.copyTo(copy1);
            fr2.copyTo(copy2);

            imgs.push_back(copy1);
            imgs.push_back(copy2);

            Stitcher stitcher = Stitcher::createDefault(1);
            Stitcher::Status status = stitcher.stitch(imgs, pano);

            if (status != Stitcher::OK)
            {
                cout << "Can't stitch images, error code = " << int(status) << endl;
                return -1;
            }

            imwrite(result_name, pano);
            imshow("Pano", pano);
            waitKey();

        }

return 0;

}

video stitching problem

I'm trying to do video stitching but when I try this code then I get the message that "Could not initialize capturing for camera2"

warning: Error opening file </build>

#include <iostream>
 #include <fstream>
 #include "opencv2/imgcodecs.hpp"
 #include "opencv2/highgui.hpp"
 #include "opencv2/stitching.hpp"

"opencv2/stitching.hpp"
using namespace std;
using namespace cv;
bool try_use_gpu = false;
vector<Mat> imgs;
string result_name = "result.jpg";
void printUsage();
int parseCmdArgs(int argc, char** argv);
int main(int argc, char* argv[])
{
Mat fr1, fr2, copy1, copy2, pano;
bool try_use_gpu = false;
vector<Mat> imgs;
VideoCapture cap1, cap2;
string filename1 = "C:/Users/user/Desktop/lkt/build/Debug/me.avi";
cap1.open(filename1);
if (!cap1.isOpened())
{
cout << "Could not initialize capturing for camera1...\n";
return 0;
}
string filename2 = "C:/Users/user/Desktop/lkt/build/Debug/mee.avi";
cap2.open(filename2);
if (!cap2.isOpened())
{
cout << "Could not initialize capturing for camera2...\n";
return 0;
}
//while (true)
for (;;)
{
cap1 >> fr1;
cap2 >> fr2;
fr1.copyTo(copy1);
fr2.copyTo(copy2);
imgs.push_back(copy1);
imgs.push_back(copy2);
Stitcher stitcher = Stitcher::createDefault(1);
Stitcher::Status status = stitcher.stitch(imgs, pano);
if (status != Stitcher::OK)
{
cout << "Can't stitch images, error code = " << int(status) << endl;
return -1;
}
imwrite(result_name, pano);
imshow("Pano", pano);
waitKey();
}
return 0;

}

video stitching problem

I'm trying to do video stitching but when I try this code then I get the message that "Could not initialize capturing for camera2"

warning: Error opening file </build>

#include <iostream>
#include <fstream>
#include "opencv2/imgcodecs.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/stitching.hpp"

using namespace std;
using namespace cv;

bool try_use_gpu = false;
vector<Mat> imgs;
string result_name = "result.jpg";

void printUsage();
int parseCmdArgs(int argc, char** argv);

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

        Mat fr1, fr2, copy1, copy2, pano;
        bool try_use_gpu = false;
        vector<Mat> imgs;
        VideoCapture cap1, cap2;

        string filename1 = "C:/Users/user/Desktop/lkt/build/Debug/me.avi";  

        cap1.open(filename1);

        if (!cap1.isOpened())
        {
            cout << "Could not initialize capturing for camera1...\n";
            return 0;
        }

        string filename2 = "C:/Users/user/Desktop/lkt/build/Debug/mee.avi";


        cap2.open(filename2);

        if (!cap2.isOpened())
        {
            cout << "Could not initialize capturing for camera2...\n";
            return 0;
        }

        //while (true)
        for (;;)
        {
            cap1 >> fr1;
            cap2 >> fr2;
            fr1.copyTo(copy1);
            fr2.copyTo(copy2);

            imgs.push_back(copy1);
            imgs.push_back(copy2);

            Stitcher stitcher = Stitcher::createDefault(1);
            Stitcher::Status status = stitcher.stitch(imgs, pano);

            if (status != Stitcher::OK)
            {
                cout << "Can't stitch images, error code = " << int(status) << endl;
                return -1;
            }

            imwrite(result_name, pano);
            imshow("Pano", pano);
            waitKey();

        }

return 0;
}

}

video stitching problem

I'm trying to do video stitching but when I try this code then I get the message that "Could not initialize capturing for camera2"

warning: Error opening file </build>< /build/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:578 >

#include <iostream>
#include <fstream>
#include "opencv2/imgcodecs.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/stitching.hpp"

using namespace std;
using namespace cv;

bool try_use_gpu = false;
vector<Mat> imgs;
string result_name = "result.jpg";

void printUsage();
int parseCmdArgs(int argc, char** argv);

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

        Mat fr1, fr2, copy1, copy2, pano;
        bool try_use_gpu = false;
        vector<Mat> imgs;
        VideoCapture cap1, cap2;

        string filename1 = "C:/Users/user/Desktop/lkt/build/Debug/me.avi";  

        cap1.open(filename1);

        if (!cap1.isOpened())
        {
            cout << "Could not initialize capturing for camera1...\n";
            return 0;
        }

        string filename2 = "C:/Users/user/Desktop/lkt/build/Debug/mee.avi";


        cap2.open(filename2);

        if (!cap2.isOpened())
        {
            cout << "Could not initialize capturing for camera2...\n";
            return 0;
        }

        //while (true)
        for (;;)
        {
            cap1 >> fr1;
            cap2 >> fr2;
            fr1.copyTo(copy1);
            fr2.copyTo(copy2);

            imgs.push_back(copy1);
            imgs.push_back(copy2);

            Stitcher stitcher = Stitcher::createDefault(1);
            Stitcher::Status status = stitcher.stitch(imgs, pano);

            if (status != Stitcher::OK)
            {
                cout << "Can't stitch images, error code = " << int(status) << endl;
                return -1;
            }

            imwrite(result_name, pano);
            imshow("Pano", pano);
            waitKey();

        }

return 0;
}