Ejemplo n.º 1
0
        public RetagWindow()
        {
            Init();
            PngCodec.Register();
            JPEGCodec.Register();
            CreateDirectories();

            manager          = new ConfigurationManager();
            attentionHandler = new AttentionHandler()
            {
                ConfigurationManager = manager
            };
            retag = new Retagger()
            {
                ConfigurationManager = manager
            };
            analyser = new AttentionMapAnalizer()
            {
                ConfigurationManager = manager
            };

            manager.Init();
            analyser.Init();
            retag.Init();
            model = new DisplayModel(this);

            last = new PointF(-windowSize, -windowSize);
        }
Ejemplo n.º 2
0
        public NewTagWindow()
        {
            CreateDirectories();

            Init();
            PngCodec.Register();
            JPEGCodec.Register();

            manager = new ConfigurationManager()
            {
                NeedLabel = false
            };
            attentionHandler = new AttentionHandler()
            {
                ConfigurationManager = manager, AllowWithoutLabel = true
            };
            tagger = new Tagger()
            {
                ConfigurationManager = manager
            };
            analyser = new AttentionMapAnalizer()
            {
                ConfigurationManager = manager
            };

            manager.Init();
            analyser.Init();
            model = new DisplayModelTagWindow(this);

            last = new PointF(-windowSize, -windowSize);
            buttonsPressed[1] = false;
            buttonsPressed[2] = false;
            buttonsPressed[3] = false;
        }
Ejemplo n.º 3
0
        private void MoveDataset()
        {
            System.IO.File.Move("./step2/img/" + BDDR + "/" + image + ".jpg", "./data/" + UQTRR + "/images/" + image + ".jpg", true);
            System.IO.File.Move("./step2/img/" + BDDP + "/" + image + ".jpg", "./data/" + UQTRP + "/images/" + image + ".jpg", true);
            System.IO.File.Move("./step2/map/" + image + ".jpg", "./data/map/images/" + image + ".jpg", true);
            AttentionMapAnalizer c = new AttentionMapAnalizer();

            label.Resize(img.Width, img.Height, imgBox.WidthRequest, imgBox.HeightRequest);
            c.AdaptLabel(boxes, label);

            SaveLabel("./data/" + UQTRR + "/labels/" + image + ".txt");
            SaveLabel("./data/" + UQTRP + "/labels/" + image + ".txt");
        }
Ejemplo n.º 4
0
        internal async Task <List <RectangleF> > GenerateBoxes(FixedSizeImage iActivated,
                                                               Image <Pixel> img,
                                                               Image <byte> gray)
        {
            var ctx = img.Clone();

            MoyskleyTech.ImageProcessing.Image.Graphics <Pixel>?graphics = null;
            if (iActivated != null)
            {
                graphics = MoyskleyTech.ImageProcessing.Image.Graphics.FromImage(ctx);
                Application.Invoke((_, _1) =>
                {
                    iActivated.Image = ctx;
                });
            }
            //ctx.Width = gray.Width;
            //ctx.Height = gray.Height;
            graphics?.Clear(Pixels.White);
            graphics?.DrawImage(img, 0, 0);

            List <RectangleF> proposedBoxes = new List <RectangleF>();

            AttentionMapAnalizer c = new AttentionMapAnalizer();

            //Foreach config, keep proposed boxes
            foreach (var(p, wz) in StandardFunctions.ListXMeansModes(img))
            {
                proposedBoxes.AddRange(await c.Cluster(gray, graphics, p, wz));
                if (iActivated != null)
                {
                    Application.Invoke((_, _1) =>
                    {
                        iActivated.Image = ctx;
                    });
                }
                if (Program.verbose)
                {
                    Console.WriteLine("MODE {0} {1}", p, wz);
                }
            }

            return(proposedBoxes);
        }