使用OpenCV 2.4.2将两张图片合并为一张图片

4

我正在尝试将两个图像复制到一个大图像中,但不幸的是,我无法使用以下尝试仅插入1个图像:

void showTwoImages(Mat imageOne, Mat imageTwo, string title) {
    int totalCol = imageOne.cols+imageTwo.cols;
    int totalRow = imageOne.rows;

    Mat totalImage(Size(totalCol, totalRow), 8, 3);

    imageOne.copyTo(totalImage(Rect(0,0,imageOne.cols, imageOne.rows)));

    viewImage(totalImage, title);
}

我的错误:

输入图像描述

不幸的是,我无法从XCode中获得具体的错误信息,只有对汇编代码的引用,因此我无法确定出错原因。

1个回答

5
改变
Mat totalImage(Size(totalCol, totalRow), 8, 3);

to

Mat totalImage(Size(totalCol, totalRow), imageOne.type());

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接