图像拼接使用EMGU CV

时间:2013-07-25 02:40:30

标签: image-processing image-stitching

我想进行图像拼接,以便在大约360度的一个位置处生成全景图像。现在我的编码是这样的......

这是拼接按钮编码时的捕捉

        int n = 1;
        String fileName;
        HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://192.168.0.4/view/snapshot.shtml?picturepath=/jpg/image.jpg");
        res = request.GetResponse();//.GetResponse();
        string[] CapturedImage = new string[28];
        Image<Bgr, Byte>[] TotalImage = new Image<Bgr, Byte>[28];
        do
        {
            fileName = @"D:\Ervin Loong (116834P)\Program Testing\Images\" + "Image" + (n++) + ".jpg"; // File location & Filename.
        }
        while (System.IO.File.Exists(fileName)); // check for existing previously saved files. If yes, add another new picture.
        {
            AMCLiveFeed.SaveCurrentImage(0, fileName);
            res.Close();
        }
        if (n == 29)
        {
            for (int i = 0; i < 28; i++) // i < 10 - save 10 images
            {
                CapturedImage[i] = @"D:\Ervin Loong (116834P)\Program Testing\Images\" + "Image" + (i + 1) + ".jpg";
                TotalImage[i] = new Image<Bgr, byte>(CapturedImage[i]);
            }

            try
            { 
                using (Stitcher stitcher = new Stitcher(false)) //Although the Stitcher class is built for GPU acceleration, a false flag must be passed to enable CPU processing. As GPU is not implemented yet.
                {
                    Image<Bgr, Byte> CapturedResult = stitcher.Stitch(TotalImage);
                    IMGBXDisplayStitched.Image = CapturedResult; //imagebox displays stitched results.
                }
            }

            finally
            {
                foreach (Image<Bgr, Byte> DisposeImage in TotalImage)
                {
                    DisposeImage.Dispose();
                }
            }

        }

0 个答案:

没有答案