Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/user-interface/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
带ROI向量的OpenCV缝合器_Opencv_Rect_Roi_Opencv Stitching - Fatal编程技术网

带ROI向量的OpenCV缝合器

带ROI向量的OpenCV缝合器,opencv,rect,roi,opencv-stitching,Opencv,Rect,Roi,Opencv Stitching,我尝试用下面的代码用ROI缝合5个图像。 尽管向量和ROI的大小相同,我还是不断得到未处理的内存异常length\u error。 另外,为什么roi应该是Rect的向量?内部向量的大小为1 int main() { std::ostringstream filepath; vector<Mat> vImg; vImg.resize(5); vector <Rect> tmpRect; vector<vector<R

我尝试用下面的代码用ROI缝合5个图像。 尽管向量和ROI的大小相同,我还是不断得到未处理的内存异常
length\u error
。 另外,为什么
roi
应该是
Rect
的向量?内部向量的大小为1

int main()
{

    std::ostringstream filepath;
    vector<Mat> vImg;
    vImg.resize(5);

    vector <Rect> tmpRect;
    vector<vector<Rect>> rois;
    rois.resize(5);
    vector<Mat> channels;

    for (int idx = 0; idx < 5; idx++)
    {
        filepath << "C:\\stch3" << idx+1 << ".jpg";
        Mat tmpImg = imread(filepath.str());
        vImg[idx] = tmpImg;
        Rect rect(0, 50, vImg[idx].cols , vImg[idx].rows-70);
        tmpRect.push_back(rect);
        rois[idx] = (tmpRect);
        tmpRect.clear();
        filepath.str("");
    }

    Stitcher stitcher = Stitcher::createDefault(true);
    Mat rImg;
    Stitcher::Status status = stitcher.stitch(vImg, rois, rImg);
    if (status != Stitcher::OK)
    {
        cout << "Can't stitch images, error code = " << int(status) << "Estimate Transform :" << int(status) << endl;
    }
    imshow("Stitching Result", rImg);

    waitKey(0);

    return 0;
}
intmain()
{
std::ostringstream文件路径;
向量vImg;
调整大小(5);
向量tmpRect;
向量ROI;
rois.resize(5);
矢量通道;
for(intidx=0;idx<5;idx++)
{
文件路径
为什么ROI应该是Rect向量的向量

因为每个图像可以传递更多的ROI,作为一个向量

所以维度1是你的图像数量,维度2是每幅图像的ROI数量