Exemplo n.º 1
0
        public void SetImageAircraft(Image <Rgb, byte> image)
        {
            /*double Transform = Math.Max(oriantation.Map.Width / imageBox1.Width,
             *  oriantation.Map.Height / imageBox1.Height);
             * image = image.Resize(Transform, Inter.Area);*/
            image = ImageTransform.SetLine(image, WayAircraft, new MCvScalar(0, 0, 255));
            if (aircraft != null)
            {
                image = ImageTransform.SetAircraft(image, aircraft);
            }
            if (baseIcon != null)
            {
                image = ImageTransform.SetIcon(image, baseIcon.IconImage, ImageTransform.SWtoSD(baseIcon.Coordinate));
            }
            if (lostGPSIcon != null)
            {
                image = ImageTransform.SetIcon(image, lostGPSIcon.IconImage, ImageTransform.SWtoSD(lostGPSIcon.Coordinate));
            }
            if (baseIcon != null)
            {
            }
            var imgbrush = new BitmapImage();

            imgbrush.BeginInit();
            var ms = new MemoryStream();

            image.Bitmap.Save(ms, SD.Imaging.ImageFormat.Bmp);
            imgbrush.StreamSource  = ms;
            imgbrush.CreateOptions = BitmapCreateOptions.PreservePixelFormat;
            imgbrush.EndInit();
            imageBoxfromAircraft.Source = imgbrush;
        }
Exemplo n.º 2
0
        public void SetMap(Image <Rgb, byte> image)
        {
            if (ShowGridCheckBox.IsChecked == true)
            {
                image = ImageTransform.SetGrid(image, GridSize, oriantation.Map.Size);
            }
            if (ShowKeyPointCheckBox.IsChecked == true && oriantation != null)
            {
                image = ImageTransform.SetKeyPont(image, oriantation, new Bgr(255, 0, 0));
            }
            var imgbrush = new BitmapImage();

            imgbrush.BeginInit();
            var ms = new MemoryStream();

            image.Bitmap.Save(ms, SD.Imaging.ImageFormat.Bmp);
            imgbrush.StreamSource  = ms;
            imgbrush.CreateOptions = BitmapCreateOptions.PreservePixelFormat;
            imgbrush.EndInit();
            imageBox1.Source       = imgbrush;
            imageBoxMiniMap.Source = imgbrush;
            image.Save("outputimage.bmp");
        }
Exemplo n.º 3
0
        public Image <Rgb, byte> ShowMatches(Image <Rgb, byte> SubMap, int k, double uniquenessThreshold,
                                             int gridx, int gridy, double persent, SIFTParametrs parametrs, out System.Windows.Point?location)
        {
            location = null;
            VectorOfKeyPoint VectorSubMapKeyPoint = null;
            Mat SubMapDiscriptors          = null;
            VectorOfVectorOfDMatch matches = null;
            Mat mask = null;

            System.Drawing.Rectangle zone = new System.Drawing.Rectangle();
            Mat result     = new Mat();
            Mat homography = null;

            try
            {
                FindMatches(SubMap, out VectorSubMapKeyPoint, out SubMapDiscriptors, out matches, out mask, out zone, out homography,
                            k, uniquenessThreshold, parametrs);
                Features2DToolbox.DrawMatches(SubMap, VectorSubMapKeyPoint, Map, VectorMapKeyPoint, matches,
                                              result, new MCvScalar(0, 255, 0), new MCvScalar(0, 0, 255), mask, Features2DToolbox.KeypointDrawType.DrawRichKeypoints);
                PointF[] points = GetMapPoint(matches, mask);
                Point    point  = FoundCenter(points);
                if (MatchCorrect(Map.Mat, points, gridx, gridy, persent) && (!double.IsNaN(point.X) && !double.IsNaN(point.Y)))
                {
                    try
                    {
                        CvInvoke.Circle(result, point, 13, new MCvScalar(255, 0, 0), 10);
                        location = ImageTransform.SDtoSW(point);
                    }
                    catch { }
                }
                return(new Image <Rgb, byte>(result.Bitmap));
            }
            catch
            {
                return(Map);
            }
        }