Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Stitcher module errors

I'm trying to use the OpenCV Stitcher Module on iOS to stitch two photos into one.

Here's my code:

- (UIImage *)stitchImages
{
    cv::Stitcher stitcher = cv::Stitcher::createDefault(TRUE);

    cv::Mat img1 = [openCVUtil cvMatWithImage:[UIImage imageNamed:@"1.jpg"]];
    cv::Mat img2 = [openCVUtil cvMatWithImage:[UIImage imageNamed:@"2.jpg"]];

    cv::vector<cv::Mat> images;
    images.push_back(img1);
    images.push_back(img2);

    cv::Mat imgOut;
    cv::Stitcher::Status status = stitcher.composePanorama(images, imgOut);
    if(status == cv::Stitcher::Status::OK) {
        UIImage *outImg = [openCVUtil imageWithCVMat:imgOut];
        return outImg;
    }
    return nil;
}


At the end I'm getting this error:

OpenCV Error: Assertion failed (imgs.size() == imgs_.size()) in composePanorama



Can you please explain what am I doing wrong?