Beispiel #1
0
        public override void Execute()
        {
            List <Point>      keyPoints;
            List <SURFResult> allResults = new List <SURFResult>();
            Dictionary <ENote, List <SURFResult> > dicModel = new Dictionary <ENote, List <SURFResult> >();

            WriteLog("Iniciando a execução do SURF");
            WriteLog("Encontrando pontos", 1);

            keyPoints = _FindKeyPoints();

            if (_AnalizeImage)
            {
                string directory    = Directory.Exists(Environment.CurrentDirectory + "\\logs") ? Environment.CurrentDirectory + "\\logs" : Environment.CurrentDirectory;
                string newImageFile = directory + @"\" + "Analize_Files.jpg";
                this.SaveImageResult(newImageFile, keyPoints);
            }
            WriteLog(string.Format("Total de pontos encontrados: {0}", keyPoints.Count), 1);

            WriteLog("Gerando notas", 1);
            keyPoints.ForEach(p =>
            {
                SURFResult res = new SURFResult
                {
                    Coordinator = p,
                    Pixel       = this.MyImage.GetPixel(p.X, p.Y)
                };
                res.GenerateNote();

                if (!dicModel.ContainsKey(res.Note))
                {
                    dicModel.Add(res.Note, new List <SURFResult>());
                }

                dicModel[res.Note].Add(res);
                allResults.Add(res);
            });

            _Result = new List <SURFResult>();
            WriteLog("Notas geradas", 1);
            foreach (ENote key in dicModel.Keys)
            {
                WriteLog(string.Format("{0}: {1}", key.GetDescription(), dicModel[key].Count), 2);
                _Result.Add(dicModel[key][0]);
            }

            _Result.ForEach(msr => msr.NumberOfElements = dicModel[msr.Note].Count);

            _LogResult();

            WriteLog("Finalizando Execução");
        }
Beispiel #2
0
 private void _LogResult()
 {
     this.Result.ForEach(r =>
     {
         SURFResult ksr = r as SURFResult;
         WriteLog("--------------------------------------------");
         WriteLog(string.Format("Coordenada X:{0}", ksr.Coordinator.X));
         WriteLog(string.Format("Coordenada Y:{0}", ksr.Coordinator.Y));
         WriteLog(string.Format("Nota: {0}", r.Note));
         WriteLog(string.Format("Número de elementos: {0}", ksr.NumberOfElements));
         WriteLog(string.Format("R: {0}\tG: {1}\tB: {2}", r.Pixel.R, r.Pixel.G, r.Pixel.B));
         WriteLog(string.Format("Sound: {0}", r.SoundNote));
     });
 }