Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Stitching Two Webcam Feeds

Hello,

I'm new to OpenCV 2.4.4 and the Stitcher Module, and am struggling to get this test to work. The code is below:

#include <opencv2/opencv.hpp>
#include <opencv2/stitching/stitcher.hpp>
#include <iostream>
#include <vector>

using namespace std;
using namespace cv;

int main(int argc, char *argv[])
{
    Mat frame1, frame2, pano;
    bool try_use_gpu = false;
    vector<Mat> imgs;
    VideoCapture cap(0), cap2(1);

    while (true)
    {
        cap >> frame1;
        cap2 >> frame2;
        imgs.push_back(frame1);
        imgs.push_back(frame2);

        Stitcher test = Stitcher::createDefault(try_use_gpu);
        Stitcher::Status status = test.stitch(imgs, pano);

        if (status != Stitcher::OK)
        {
            cout << "Error stitching - Code: " <<int(status)<<endl;
            return -1;
        }

        imshow("Frame 1", frame1);
        imshow("Frame 2", frame2);
        imshow("Stitched Image", pano);

        if(waitKey(30) >= 0) 
            break;
    }
    return 0;
}

I get the errors:

First-chance exception at 0x0f3c7fe7 in StitchingTest.exe: 0xC0000005: Access violation writing location 0x00000038. First-chance exception at 0x0f3c8331 in StitchingTest.exe: 0xC0000005: Access violation reading location 0x00000014. Unhandled exception at 0x0f3c8331 in StitchingTest.exe: 0xC0000005: Access violation reading location 0x00000014. The program '[8416] StitchingTest.exe: Native' has exited with code 0 (0x0)

What did I do wrong? Thanks!

-Tony

Stitching Two Webcam Feeds

Hello,

I'm new to OpenCV 2.4.4 and the Stitcher Module, and am struggling to get this test to work. The code is below:

#include <opencv2/opencv.hpp>
#include <opencv2/stitching/stitcher.hpp>
#include <iostream>
#include <vector>

using namespace std;
using namespace cv;

int main(int argc, char *argv[])
{
    Mat frame1, frame2, pano;
    bool try_use_gpu = false;
    vector<Mat> imgs;
    VideoCapture cap(0), cap2(1);

    while (true)
    {
        cap >> frame1;
        cap2 >> frame2;
        imgs.push_back(frame1);
        imgs.push_back(frame2);

        Stitcher test = Stitcher::createDefault(try_use_gpu);
        Stitcher::Status status = test.stitch(imgs, pano);

        if (status != Stitcher::OK)
        {
            cout << "Error stitching - Code: " <<int(status)<<endl;
            return -1;
        }

        imshow("Frame 1", frame1);
        imshow("Frame 2", frame2);
        imshow("Stitched Image", pano);

        if(waitKey(30) >= 0) 
            break;
    }
    return 0;
}

I get the errors:

First-chance exception at 0x0f3c7fe7 in StitchingTest.exe: 0xC0000005: Access violation writing location 0x00000038. First-chance exception at 0x0f3c8331 in StitchingTest.exe: 0xC0000005: Access violation reading location 0x00000014. Unhandled exception at 0x0f3c8331 in StitchingTest.exe: 0xC0000005: Access violation reading location 0x00000014. The program '[8416] StitchingTest.exe: Native' has exited with code 0 (0x0)

What did I do wrong? Thanks!

-Tony

EDIT: I normally use OpenCV 2.3.1, and I just upgraded. I tested out an old file of mine that also used two webcams, and it works fine. This leads me to believe that I'm missing some dependencies in my Linker or something like that. The ones I have are:

opencv_calib3d244d.lib opencv_contrib244d.lib opencv_core244d.lib opencv_features2d244d.lib opencv_flann244d.lib opencv_gpu244d.lib opencv_haartraining_engined.lib opencv_highgui244d.lib opencv_imgproc244d.lib opencv_legacy244d.lib opencv_ml244d.lib opencv_objdetect244d.lib opencv_ts244d.lib opencv_video244d.lib opencv_stitching244.lib opencv_stitching244d.lib

Am I missing one I need?

Stitching Two Webcam Feeds

Hello,

I'm new to OpenCV 2.4.4 and the Stitcher Module, and am struggling to get this test to work. The code is below:

#include <opencv2/opencv.hpp>
#include <opencv2/stitching/stitcher.hpp>
#include <iostream>
#include <vector>

using namespace std;
using namespace cv;

int main(int argc, char *argv[])
{
    Mat frame1, frame2, pano;
    bool try_use_gpu = false;
    vector<Mat> imgs;
    VideoCapture cap(0), cap2(1);

    while (true)
    {
        cap >> frame1;
        cap2 >> frame2;
        imgs.push_back(frame1);
        imgs.push_back(frame2);

        Stitcher test = Stitcher::createDefault(try_use_gpu);
        Stitcher::Status status = test.stitch(imgs, pano);

        if (status != Stitcher::OK)
        {
            cout << "Error stitching - Code: " <<int(status)<<endl;
            return -1;
        }

        imshow("Frame 1", frame1);
        imshow("Frame 2", frame2);
        imshow("Stitched Image", pano);

        if(waitKey(30) >= 0) 
            break;
    }
    return 0;
}

I get the errors:

First-chance exception at 0x0f3c7fe7 in StitchingTest.exe: 0xC0000005: Access violation writing location 0x00000038. First-chance exception at 0x0f3c8331 in StitchingTest.exe: 0xC0000005: Access violation reading location 0x00000014. Unhandled exception at 0x0f3c8331 in StitchingTest.exe: 0xC0000005: Access violation reading location 0x00000014. The program '[8416] StitchingTest.exe: Native' has exited with code 0 (0x0)

What did I do wrong? Thanks!

-Tony

EDIT: Solved the initial error - I normally use OpenCV 2.3.1, and I just upgraded. I tested out an old file of mine was missing the "d" in the stitching Linker dependency.

SECOND ERROR: The stitcher status returns 1 - what does that also used two webcams, and it works fine. This leads me to believe that I'm missing some dependencies in my Linker or something like that. The ones I have are:

opencv_calib3d244d.lib opencv_contrib244d.lib opencv_core244d.lib opencv_features2d244d.lib opencv_flann244d.lib opencv_gpu244d.lib opencv_haartraining_engined.lib opencv_highgui244d.lib opencv_imgproc244d.lib opencv_legacy244d.lib opencv_ml244d.lib opencv_objdetect244d.lib opencv_ts244d.lib opencv_video244d.lib opencv_stitching244.lib opencv_stitching244d.lib

Am I missing one I need?mean?