Image Stiching使用EmguCv 3.0

时间:2016-04-19 10:42:06

标签: c# opencv image-processing emgucv

我尝试使用EmguCv 3.0进行图像拼接。但它显示以下错误:"无法转换为' Emgu.CV.Image []'到' Emgu.CV.IInputArray'"。我的代码是:

Image<Bgr, byte>[] src = new Image<Bgr, byte>[3];
        Image<Bgr, byte>res = new Image<Bgr, byte>(1000,750);
        src[0] = new Image<Bgr,byte>("D:/New folder/images/Fit01.jpg");
        src[1] = new Image<Bgr,byte>("D:/New folder/images/Fit02.jpg");
        src[2] = new Image<Bgr,byte>("D:/New folder/images/Fit03.jpg");

        Stitcher stitcher = new Stitcher(false);
        stitcher.Stitch(src,res);//here showing error 

请帮忙......

1 个答案:

答案 0 :(得分:1)

经过一些调试后,我设法得到答案。这与早期版本的EmguCv 3.0不同,后者只接收一个拼接参数。这是代码

            Mat i1 = new Mat("D:/New folder/images/Fit01.jpg", LoadImageType.Color);
            Mat i2 = new Mat("D:/New folder/images/Fit02.jpg", LoadImageType.Color);
            Mat i3 = new Mat("D:/New folder/images/Fit02.jpg", LoadImageType.Color);
            using (VectorOfMat vmsrc = new VectorOfMat(i1, i2, i3))
            {
                Image<Bgr, byte> res = new Image<Bgr, byte>(1000, 750);
                Mat result = new Mat();
                Stitcher stitcher = new Stitcher(false);
                stitcher.Stitch(vmsrc, result);
                ImageViewer.Show(result);
            }