基于Emgu cv的图像拼接(转)

 

分类: 编程 C# Emgu cv Stitching 2012-10-27 11:04 753人阅读 评论(1) 收藏 举报

   在新版本的Emgu cv中添加了Emgu.CV.Stitching,这极大的方便了图像拼接程序的实现。

     实现步骤非常简单,首先读取图片,保存为多图片矩阵,再使用Stitching接口提供的Stitch方法完成,具体程序如下:

     Image<Bgr, Byte>[] sources;

     OpenFileDialog open = new OpenFileDialog();
     open.CheckFileExists = true;
     open.Multiselect = true;
     open.Filter = "打开图片|*.jpg";
     open.ShowDialog();
     sources=new Image<Bgr,byte>[open.FileNames.Length];
     for (int i = 0; i < open.FileNames.Length; i++)
            {
                sources[i] = new Image<Bgr, byte>(open.FileNames[i]);
            }
     pictureBox1.Image = sources[0].Bitmap;
     pictureBox2.Image = sources[1].Bitmap;
     pictureBox3.Image = sources[2].Bitmap;
     Stitcher stitcher = new Stitcher(true);
     Image<Bgr, byte> result = stitcher.Stitch(sources);
     pictureBox4.Image = result.Bitmap;

     不过值得注意的是Stitch的CV程序对计算机显卡的version有要求,需要更新新版本驱动,若是旧版本很有可能提示:

     OpenCV: CUDA driver version is insufficient for CUDA runtime version

     程序运行结果如附图:

原文地址:https://www.cnblogs.com/sczw-maqing/p/3399022.html