示例#1
1
	public MechCreator(string c, List<string> p) {
		coreName = c;
		core = Resources.Load(c, typeof(GameObject)) as GameObject;
		if (core == null ) {
			Debug.Log("null core, using default");
			core = Resources.Load(defaultCore, typeof(GameObject)) as GameObject;
			coreName = defaultCore;
		}
		parts = new List<GameObject>();

		if (p == null || p.Capacity == 0) {
			Debug.Log("null parts, using default");
			for (int i = 0; i < defaultParts.Length; i++) {
				GameObject part = Resources.Load(defaultParts[i], typeof(GameObject)) as GameObject;
				parts.Add(part);
			}
		} else {
			for (int i = 0; i < p.Count; i++) {
				GameObject part = Resources.Load(p[i], typeof(GameObject)) as GameObject;
				if (part == null ) part = Resources.Load(defaultParts[i], typeof(GameObject)) as GameObject;
				parts.Add(part);
			}
		}

		animator = Resources.Load("ThirdAnimator", typeof(RuntimeAnimatorController)) as RuntimeAnimatorController; if (animator == null )Debug.Log("animator");
		mechCam = Resources.Load("MechCam", typeof(GameObject)) as GameObject; if (mechCam == null )Debug.Log("MechCam");
		radar = Resources.Load("Radar", typeof(GameObject)) as GameObject; if (radar == null )Debug.Log("Radar");
		stitcher = new Stitcher();
	}
示例#2
0
        public static Bitmap ImgPj(List <string> strfile)
        {
            Bitmap bmp = null;
            Mat    outimg;

            try {
                List <Mat> listmat = new List <Mat>();
                for (int i = 0; i < strfile.Count; i++)
                {
                    string            str = strfile[i].ToString();
                    Image <Bgr, byte> a   = new Image <Bgr, byte>(str);
                    listmat.Add(a.Mat);
                }
                Stitcher stitcher = new Stitcher(false);
                outimg = new Mat();
                if (T_ConFigure.SfName.Trim().Length > 0)
                {
                    stitcher.Stitch(new VectorOfMat(listmat.ToArray()), outimg);
                }
            } catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                return(bmp);
            }
            return(outimg.Bitmap);
        }
示例#3
0
        public static void RunExperiment(string name, string folder, string prefix, string outputDirectory = "")
        {
            if (outputDirectory == String.Empty)
            {
                outputDirectory = Path.Combine(Drive.GetDriveRoot(), BenchmarkDirectory);
                //Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
            }

            var drive      = new Drive(folder, Drive.Reason.Read);
            var experiment = new Experiment(drive.Files(prefix).ToList(), UseOcr);
            var mixed      = experiment.MixedOrder;
            var normal     = experiment.CorrectOrder;
            var results    = Reconstructor.NaiveKruskalAlgorithm(mixed);
            var difference = experiment.Diff(results);

            var resultImg = Path.Combine(outputDirectory, name + "_result.png");

            Stitcher.ExportImage((Cluster)results.First().Root(), resultImg);

            var sb = new StringBuilder();

            sb.AppendLine(name);
            sb.AppendLine(folder);
            sb.AppendLine(difference.ToString());
            mixed.ForEach(shred => sb.Append(" " + shred.Id + ", "));
            sb.AppendLine();
            normal.ForEach(shred => sb.Append(" " + shred.Id + ", "));
            sb.AppendLine();
            results.ForEach(shred => sb.Append(" " + shred.Id + ", "));
            sb.AppendLine();

            Console.WriteLine(sb.ToString());
            File.WriteAllText(Path.Combine(outputDirectory, name + ".txt"), sb.ToString());
        }
示例#4
0
        private void 合成ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            // Image<Gray, Byte> tmp = new Image<Gray, byte>(size.Width, size.Height, mat.Step, mat.DataPointer)
            // Image<Bgr, byte> c = new Image<Bgr, byte>(picout.ToString());
            Image <Bgr, byte> a   = new Image <Bgr, byte>("D:\\c.jpg");
            Image <Bgr, byte> src = new Image <Bgr, byte>("D:\\c.jpg");
            //Image<Bgr, byte> c = new Image<Bgr, byte>("D:\\c.jpg");
            Stitcher stitcher = new Stitcher(false);
            Mat      outimg   = new Mat();

            try
            {
                // MessageBox.Show("d");
                imageBox2.Image = a.Mat;
                imageBox3.Image = src.Mat;
                stitcher.Stitch(new VectorOfMat(new Mat[] { a.Mat, src.Mat }), outimg);
                //MessageBox.Show("s");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            imageBox1.Image = outimg;
            picout          = outimg;
        }
示例#5
0
            public void Attach(Transform transform, Equipment equipment)
            {
                if (!IsAttached)
                {
                    Equipment = equipment;

                    GameObject prefab;
                    if (Equipment.EquipmentData.EquipmentPrefab == null)
                    {
                        Debug.LogWarning("This Equipment prefab does not exist, a primitive will be used instead.");
                        prefab = GameObject.CreatePrimitive(PrimitiveType.Cube);
                    }
                    else
                    {
                        prefab = Equipment.EquipmentData.EquipmentPrefab;
                    }

                    _gameObject = Object.Instantiate(prefab, transform);

                    Stitcher.Stitch(_gameObject, transform.gameObject);

                    IsAttached = true;
                }
                else
                {
                    throw new UnityException("The attachment is already fulfill, please verify your logic.");
                }
            }
示例#6
0
        public void Run()
        {
            const bool debugMode = false;

            Mat[] images = SelectStitchingImages(200, 200, 40, show: debugMode);

            using (var stitcher = Stitcher.Create(false))
                using (var pano = new Mat())
                {
                    Console.Write("Stitching start...");
                    var status = stitcher.Stitch(images, pano);
                    Console.WriteLine(" finish (status:{0})", status);
                    Assert.That(status, Is.EqualTo(Stitcher.Status.OK));

                    // ReSharper disable ConditionIsAlwaysTrueOrFalse
                    if (debugMode)
                    {
                        Window.ShowImages(pano);
                    }
                }

            foreach (Mat image in images)
            {
                image.Dispose();
            }
        }
示例#7
0
        public void StitcherArtificialTest()
        {
            var shreds = Shred.Factory("image", Path.Combine(Drive.GetDriveRoot(), Dir.ArtificialTestDirectory, Dir.ArtificialHttpDocument), false);
            var bitmap = Stitcher.Merge(shreds);

            bitmap.Save("StitcherArtificialTest.png", ImageFormat.Png);
        }
示例#8
0
        //Faz stich de dois frames de dois video separados
        private void stichFirstFrameToolStripMenuItem_Click(object sender, System.EventArgs e)
        {
            try
            {
                using (Stitcher stitcher = new Stitcher(true))
                {
                    using (VectorOfMat vm = new VectorOfMat())
                    {
                        vm.Push(sourceImages);
                        var stitchStatus = stitcher.Stitch(vm, result);

                        if (stitchStatus)
                        {
                            Bitmap bt = new Bitmap(result.Bitmap);
                            //por algum motivo a imagem fica rodada :(
                            bt.RotateFlip(RotateFlipType.RotateNoneFlipXY);
                            pictureBox1.Image = bt;
                            // pictureBox1.Image.Save(@"path", ImageFormat.Jpeg);
                        }
                        else
                        {
                            MessageBox.Show(this, String.Format("Stiching Error: {0}", stitchStatus));
                            pictureBox1.Image = null;
                        }
                    }
                }
            }
            catch
            {
            }
        }
示例#9
0
        public void StitcherPrimitiveTest()
        {
            var shreds = Shred.Factory("Shred", Path.Combine(Drive.GetDriveRoot(), Dir.StitcherTestDirectory, "PrimitiveTest"), false);
            var bitmap = Stitcher.Merge(shreds);

            bitmap.Save("StitcherPrimitiveTest.png", ImageFormat.Png);
        }
示例#10
0
        private void button5_Click(object sender, EventArgs e)
        {
            string[] paths = Directory.GetFiles(Basepath);

            List <Mat> matlist = new List <Mat>();

            for (int i = 0; i < paths.Length; i++)
            {
                var tempmat = new Mat(paths[i], ImreadModes.Color);

                matlist.Add(tempmat);
            }


            using (VectorOfMat vmsrc = new VectorOfMat(matlist.ToArray()))
            {
                //Image<Bgr, byte> res = new Image<Bgr, byte>(28090, 27390);
                Mat      result   = new Mat();
                Stitcher stitcher = new Stitcher(false);


                Stitcher.Status stitchStatus = stitcher.Stitch(vmsrc, result);

                ImageViewer.Show(result);
                //result.Save(Basepath + "testresult.png");
            }
        }
示例#11
0
        /// <summary>
        /// Stitch images together
        /// </summary>
        /// <param name="images">The list of images to stitch</param>
        /// <returns>A final stitched image</returns>
        public static Mat StichImages(List <Mat> images)
        {
            //Declare the Mat object that will store the final output
            Mat output = new Mat();

            //Declare a vector to store all images from the list
            VectorOfMat matVector = new VectorOfMat();

            //Push all images in the list into a vector
            foreach (Mat img in images)
            {
                matVector.Push(img);
            }

            //Declare a new stitcher
            Stitcher stitcher = new Stitcher();

            //Declare the type of detector that will be used to detect keypoints
            Brisk detector = new Brisk();

            //Here are some other detectors that you can try
            //ORBDetector detector = new ORBDetector();
            //KAZE detector = new KAZE();
            //AKAZE detector = new AKAZE();

            //Set the stitcher class to use the specified detector declared above
            stitcher.SetFeaturesFinder(detector);

            //Stitch the images together
            stitcher.Stitch(matVector, output);

            //Return the final stiched image
            return(output);
        }
示例#12
0
        public void PropertyRCompositingResol()
        {
            using var stitcher = Stitcher.Create();
            const double value = 3.14159;

            stitcher.CompositingResol = value;
            Assert.Equal(value, stitcher.CompositingResol, 6);
        }
示例#13
0
        public void PropertySeamEstimationResol()
        {
            using var stitcher = Stitcher.Create();
            const double value = 3.14159;

            stitcher.SeamEstimationResol = value;
            Assert.Equal(value, stitcher.SeamEstimationResol, 6);
        }
示例#14
0
        public void PropertyWaveCorrectKind()
        {
            using var stitcher = Stitcher.Create();
            const WaveCorrectKind value = WaveCorrectKind.Vertical;

            stitcher.WaveCorrectKind = value;
            Assert.Equal(value, stitcher.WaveCorrectKind);
        }
示例#15
0
        public void PropertyWaveCorrection()
        {
            using var stitcher = Stitcher.Create();
            const bool value = true;

            stitcher.WaveCorrection = value;
            Assert.Equal(value, stitcher.WaveCorrection);
        }
示例#16
0
        public void PropertyPanoConfidenceThresh()
        {
            using var stitcher = Stitcher.Create();
            const double value = 3.14159;

            stitcher.PanoConfidenceThresh = value;
            Assert.Equal(value, stitcher.PanoConfidenceThresh, 6);
        }
示例#17
0
        private void selectImagesButton_Click(object sender, EventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();

            dlg.CheckFileExists = true;
            dlg.Multiselect     = true;

            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                sourceImageDataGridView.Rows.Clear();

                Image <Bgr, byte>[] sourceImages = new Image <Bgr, byte> [dlg.FileNames.Length];

                for (int i = 0; i < sourceImages.Length; i++)
                {
                    sourceImages[i] = new Image <Bgr, byte>(dlg.FileNames[i]);

                    using (Image <Bgr, byte> thumbnail = sourceImages[i].Resize(200, 200, Emgu.CV.CvEnum.Inter.Cubic, true))
                    {
                        DataGridViewRow row = sourceImageDataGridView.Rows[sourceImageDataGridView.Rows.Add()];
                        row.Cells["FileNameColumn"].Value  = dlg.FileNames[i];
                        row.Cells["ThumbnailColumn"].Value = thumbnail.ToBitmap();
                        row.Height = 200;
                    }
                }
                try
                {
                    //only use GPU if you have build the native binary from code and enabled "NON_FREE"
                    using (Stitcher stitcher = new Stitcher(false))
                        using (AKAZEFeaturesFinder finder = new AKAZEFeaturesFinder())
                        {
                            stitcher.SetFeaturesFinder(finder);
                            using (VectorOfMat vm = new VectorOfMat())
                            {
                                Mat result = new Mat();
                                vm.Push(sourceImages);
                                Stitcher.Status stitchStatus = stitcher.Stitch(vm, result);
                                if (stitchStatus == Stitcher.Status.Ok)
                                {
                                    resultImageBox.Image = result;
                                }
                                else
                                {
                                    MessageBox.Show(this, String.Format("Stiching Error: {0}", stitchStatus));
                                    resultImageBox.Image = null;
                                }
                            }
                        }
                }
                finally
                {
                    foreach (Image <Bgr, Byte> img in sourceImages)
                    {
                        img.Dispose();
                    }
                }
            }
        }
示例#18
0
        /// <summary>
        /// performs scan loading on a thread, child method of load scan.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>

        private void loadScanThread(Object sender, DoWorkEventArgs e)
        {
            // Cast object back into BackgroundWorker

            BackgroundWorker B = (BackgroundWorker)sender;

            B.ReportProgress(1, "Background worker running");

            String filename = (string)e.Argument;

            if (filename != null)
            {
                B.ReportProgress(0, "Loading file: " + filename);

                ScanSerializer.deserialize(filename);

                System.Diagnostics.Debug.WriteLine(e.Argument);

                B.ReportProgress(8, "Model deserialised");

                pcdl = ScanSerializer.depthPc;

                System.Diagnostics.Debug.WriteLine(pcdl.Count);

                B.ReportProgress(2, "Model loaded");
            }

            if (pcdl.Count == 0)
            {
                throw new PointCloudException("PCDL is empty");
            }

            /*2)*/
            //instantiate the stitcher
            stitcher = new BoundingBox();
            B.ReportProgress(1);

            //jam points into stitcher
            stitcher.add(pcdl);
            B.ReportProgress(1);

            stitcher.stitch();
            B.ReportProgress(5);

            pcd  = stitcher.getResult();
            pcdl = stitcher.getResultList();
            B.ReportProgress(1, "Point Cloud Stitched (with " + pcdl.Count + " components)");
            if (pcdl.Count == 0)
            {
                throw new PointCloudException("Stitcher returned empty point cloud list");
            }

            // Get the height
            double height = Math.Round(HeightCalculator.getHeight(pcd), 3);

            Dispatcher.BeginInvoke((Action)(() => { int progress = 1; }));
            B.ReportProgress(1);
        }
 public void PropertyRegistrationResol()
 {
     using (var stitcher = Stitcher.Create())
     {
         const double value = 3.14159;
         stitcher.RegistrationResol = value;
         Assert.Equal(value, stitcher.RegistrationResol, 6);
     }
 }
示例#20
0
        private void selectImagesButton_Click(object sender, EventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();

            dlg.CheckFileExists = true;
            dlg.Multiselect     = true;

            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                sourceImageDataGridView.Rows.Clear();

                Image <Bgr, Byte>[] sourceImages = new Image <Bgr, byte> [dlg.FileNames.Length];

                for (int i = 0; i < sourceImages.Length; i++)
                {
                    sourceImages[i] = new Image <Bgr, byte>(dlg.FileNames[i]);

                    using (Image <Bgr, byte> thumbnail = sourceImages[i].Resize(200, 200, Emgu.CV.CvEnum.Inter.Cubic, true))
                    {
                        DataGridViewRow row = sourceImageDataGridView.Rows[sourceImageDataGridView.Rows.Add()];
                        row.Cells["FileNameColumn"].Value  = dlg.FileNames[i];
                        row.Cells["ThumbnailColumn"].Value = thumbnail.ToBitmap();
                        row.Height = 200;
                    }
                }
                try
                {
                    //using (Stitcher stitcher = new Stitcher(true))
                    //CUDA bruteforce matcher seems to cause issue in this release, not using CUDA for matching for this reason
                    using (Stitcher stitcher = new Stitcher(false))
                    {
                        using (VectorOfMat vm = new VectorOfMat())
                        {
                            Mat result = new Mat();
                            vm.Push(sourceImages);
                            Stitcher.Status stitchStatus = stitcher.Stitch(vm, result);
                            if (stitchStatus == Stitcher.Status.Ok)
                            {
                                resultImageBox.Image = result;
                            }
                            else
                            {
                                MessageBox.Show(this, String.Format("Stiching Error: {0}", stitchStatus));
                                resultImageBox.Image = null;
                            }
                        }
                    }
                }
                finally
                {
                    foreach (Image <Bgr, Byte> img in sourceImages)
                    {
                        img.Dispose();
                    }
                }
            }
        }
示例#21
0
        static void Main(string[] args)
        {
            Console.WriteLine("BestTrackBeamSticher service");

            TrackBeamDataReciever.StartListening((trackBeamData) =>
            {
                TrackWithStitchedBeam trackWithStitchedBeam = Stitcher.stitch(trackBeamData);
                TrackWithStitchedBeamSender.sendTrackWithStitchedBeam(trackWithStitchedBeam);
            });
        }
示例#22
0
        public void UpdateSpritesheetResourcesUi()
        {
            if (filePaths.Count() != 0 && Int32.TryParse(tbx_sheetRows.Text, out sheetRows) && Int32.TryParse(tbx_sheetCols.Text, out sheetCols))
            {
                Image _img = Stitcher.StitchFromImgPaths(filePaths, sheetRows, sheetCols, out frameWidth, out frameHeight);

                pbx_stitchPreview.Image = _img;
                lbl_outputSizeVw.Text   = _img.Width + " x " + _img.Height;
                lbl_frameSizeVw.Text    = frameWidth + " x " + frameHeight;
            }
        }
示例#23
0
        ////////////////////////////////////////////////////////////////////////////////////////////

        private void btnOpenFile_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofdOpenfilesD = new OpenFileDialog();

            ofdOpenfilesD.CheckFileExists = true;
            ofdOpenfilesD.Multiselect     = true;

            if (ofdOpenfilesD.ShowDialog() != DialogResult.OK || ofdOpenfilesD.FileName == "")
            {
                MessageBox.Show("Can not read image");
            }
            else if (ofdOpenfilesD.ShowDialog() == DialogResult.OK)
            {
                dgvSourceImage.Rows.Clear();


                Image <Bgr, Byte>[] originalImagesU = new Image <Bgr, byte> [ofdOpenfilesD.FileNames.Length];

                for (int i = 0; i < originalImagesU.Length; i++)
                {
                    originalImagesU[i] = new Image <Bgr, byte>(ofdOpenfilesD.FileNames[i]);

                    using (Image <Bgr, byte> firstImage = originalImagesU[i].Resize(200, 200, Inter.Cubic, true))

                    {
                        DataGridViewRow row = dgvSourceImage.Rows[dgvSourceImage.Rows.Add()];
                        row.Cells["fileNameColumn"].Value      = ofdOpenfilesD.FileNames[i];
                        row.Cells["samplePictureColumn"].Value = firstImage.ToBitmap();
                        row.Height = 200;
                    }
                }
                try
                {
                    using (Stitcher stiching = new Stitcher(false))
                    {
                        using (VectorOfMat matVector = new VectorOfMat())
                        {
                            Mat finalImageN = new Mat();
                            matVector.Push(originalImagesU);
                            stiching.Stitch(matVector, finalImageN);
                            ibFinalImage.Image = finalImageN;
                        }
                    }
                }
                finally
                {
                    foreach (Image <Bgr, Byte> image in originalImagesU)
                    {
                        image.Dispose();
                    }
                }
            }
        }
示例#24
0
        private void button1_Click(object sender, EventArgs e)
        {
            Stitcher stitcher = new Stitcher(false);

            Image <Bgr, byte>[] sourceImages = new Image <Bgr, byte> [3];
            sourceImages[0] = image1;
            sourceImages[1] = image2;
            sourceImages[2] = image3;
            Image <Bgr, byte> result = stitcher.Stitch(sourceImages);

            imageBox7.Image = result;
        }
示例#25
0
    void Awake()
    {
        avatar   = GameObject.FindGameObjectWithTag("PlayerArmature");
        stitcher = new Stitcher();


        foreach (var cloth in clothing)
        {
            //RemoveWorn ();
            Wear(cloth);
        }
    }
示例#26
0
    private void Start()
    {
        stitcher = new Stitcher();

        // original setup
        inventroy = Inventory.instance;
        int numSlots = System.Enum.GetNames(typeof(EquipmentSlot)).Length;

        currentEquipment = new Equipment[numSlots];
        currentMeshes    = new GameObject[numSlots];

        EquipDefaultItems();
    }
示例#27
0
    public MechCreator(string c, List <string> p)
    {
        coreName = c;
        core     = Resources.Load(c, typeof(GameObject)) as GameObject;
        if (core == null)
        {
            Debug.Log("null core, using default");
            core     = Resources.Load(defaultCore, typeof(GameObject)) as GameObject;
            coreName = defaultCore;
        }
        parts = new List <GameObject>();

        if (p == null || p.Capacity == 0)
        {
            Debug.Log("null parts, using default");
            for (int i = 0; i < defaultParts.Length; i++)
            {
                GameObject part = Resources.Load(defaultParts[i], typeof(GameObject)) as GameObject;
                parts.Add(part);
            }
        }
        else
        {
            for (int i = 0; i < p.Count; i++)
            {
                GameObject part = Resources.Load(p[i], typeof(GameObject)) as GameObject;
                if (part == null)
                {
                    part = Resources.Load(defaultParts[i], typeof(GameObject)) as GameObject;
                }
                parts.Add(part);
            }
        }

        animator = Resources.Load("ThirdAnimator", typeof(RuntimeAnimatorController)) as RuntimeAnimatorController; if (animator == null)
        {
            Debug.Log("animator");
        }
        mechCam = Resources.Load("MechCam", typeof(GameObject)) as GameObject; if (mechCam == null)
        {
            Debug.Log("MechCam");
        }
        radar = Resources.Load("Radar", typeof(GameObject)) as GameObject; if (radar == null)
        {
            Debug.Log("Radar");
        }
        stitcher = new Stitcher();
    }
        private void selectImagesButton_Click(object sender, EventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();

            dlg.CheckFileExists = true;
            dlg.Multiselect     = true;

            if (dlg.ShowDialog(this) == DialogResult.OK)
            {
                sourceImageDataGridView.Rows.Clear();
                int count = dlg.FileNames.Length;
                sourceImages = new Image <Bgr, byte> [count];

                for (int i = 0; i < count; i++)
                {
                    sourceImages[i] = new Image <Bgr, byte>(dlg.FileNames[i]);

                    using (Image <Bgr, byte> thumbnail = sourceImages[i].Resize(200, 200, INTER.CV_INTER_CUBIC, true))
                    {
                        DataGridViewRow row = sourceImageDataGridView.Rows[sourceImageDataGridView.Rows.Add()];
                        row.Cells["FileNameColumn"].Value  = dlg.FileNames[i];
                        row.Cells["ThumbnailColumn"].Value = thumbnail.ToBitmap();
                        row.Height = 200;
                    }
                }

                try
                {
                    using (Stitcher stitcher = new Stitcher(true))
                    {
                        //Image<Bgr, Byte> result = stitcher.Stitch(sourceImages);
                        //resultImageBox.Image = result;
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                finally
                {
                    foreach (Image <Bgr, Byte> img in sourceImages)
                    {
                        img.Dispose();
                    }
                }
            }
        }
示例#29
0
        private void selectImagesButton_Click(object sender, EventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();

            dlg.CheckFileExists = true;
            dlg.Multiselect     = true;

            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                sourceImageDataGridView.Rows.Clear();

                Image <Bgr, Byte>[] sourceImages = new Image <Bgr, byte> [dlg.FileNames.Length];

                for (int i = 0; i < sourceImages.Length; i++)
                {
                    sourceImages[i] = new Image <Bgr, byte>(dlg.FileNames[i]);

                    using (Image <Bgr, byte> thumbnail = sourceImages[i].Resize(200, 200, Emgu.CV.CvEnum.Inter.Cubic, true))
                    {
                        DataGridViewRow row = sourceImageDataGridView.Rows[sourceImageDataGridView.Rows.Add()];
                        row.Cells["FileNameColumn"].Value  = dlg.FileNames[i];
                        row.Cells["ThumbnailColumn"].Value = thumbnail.ToBitmap();
                        row.Height = 200;
                    }
                }
                try
                {
                    using (Stitcher stitcher = new Stitcher(true))
                    {
                        using (VectorOfMat vm = new VectorOfMat())
                        {
                            Mat result = new Mat();
                            vm.Push(sourceImages);
                            stitcher.Stitch(vm, result);
                            resultImageBox.Image = result;
                        }
                    }
                }
                finally
                {
                    foreach (Image <Bgr, Byte> img in sourceImages)
                    {
                        img.Dispose();
                    }
                }
            }
        }
示例#30
0
        static void Main(string[] args)
        {
            Mat[] images   = SelectStitchingImages(10);
            Mat   pano     = new Mat();
            var   stitcher = Stitcher.Create(true);

            Console.Write("Stitching start...");
            var status = stitcher.Stitch(images, pano);

            Console.WriteLine(" finish (status:{0})", status);
            Window.ShowImages(pano);
            foreach (Mat image in images)
            {
                image.Dispose();
            }
            pano.ImWrite("dst.jpg");
        }
示例#31
0
        private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Multiselect     = true;
            ofd.CheckFileExists = true;
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                //Clear data
                dataGridView1.Rows.Clear();
                //Store input images
                Image <Bgr, Byte>[] images = new Image <Bgr, Byte> [ofd.FileNames.Length];
                for (int i = 0; i < images.Length; i++)
                {
                    images[i] = new Image <Bgr, Byte>(ofd.FileNames[i]);
                    using (Image <Bgr, Byte> thumbnail = images[i].Resize(150, 150, Emgu.CV.CvEnum.INTER.CV_INTER_CUBIC, true))
                    {
                        DataGridViewRow row = dataGridView1.Rows[dataGridView1.Rows.Add()];
                        row.Cells["Image"].Value = thumbnail.ToBitmap();
                        row.Height = 150;
                    }
                }
                //Try Image Stitching
                try
                {
                    //Core Part
                    using (Stitcher stitcher = new Stitcher(
                               // GPU boost enable or disable
                               // Must specify false because it will cause error if true
                               // The bug is from OpenCV
                               false))
                    {
                        Image <Bgr, Byte> result = stitcher.Stitch(images);
                        imageBox1.Image = result;
                    }
                }
                finally
                {
                    foreach (Image <Bgr, Byte> image in images)
                    {
                        ((IDisposable)image).Dispose();
                    }
                }
            }
        }
示例#32
0
 public void Awake()
 {
     stitcher = new Stitcher ();
 }