Ejemplo n.º 1
0
        List <PerfromanceEvaluator> ILeafAnalysis.compareQueryImagesForPerfromance()
        {
            List <PerfromanceEvaluator> allQueryImageResultSet = new List <PerfromanceEvaluator>();

            foreach (ImageCategory img in queryImages)
            {
                List <string> images       = img.listOfImages;
                string        leafCategory = img.leafCategory;
                foreach (string imagePath in images)
                {
                    try
                    {
                        PerfromanceEvaluator performanceMatrix = new PerfromanceEvaluator();
                        performanceMatrix.expectedLeafName = leafCategory;
                        performanceMatrix.result           = this.QueryImage(imagePath, leafCategory);
                        allQueryImageResultSet.Add(performanceMatrix);
                        Console.WriteLine(imagePath + ":" + string.Join(":", performanceMatrix.result.Select(item => item.ToString())));
                    }
                    catch (Exception exception)
                    {
                        // TODO
                        //Console.WriteLine(exception.ToString());
                    }
                }
            }
            return(allQueryImageResultSet);
        }
Ejemplo n.º 2
0
        List <PerfromanceEvaluator> ILeafAnalysis.compareQueryImagesForPerfromance()
        {
            List <PerfromanceEvaluator> allQueryImageResultSet = new List <PerfromanceEvaluator>();
            List <MatcherResult>        resultSetForPerf       = new List <MatcherResult>();

            foreach (ImageCategory img in queryImages)
            {
                List <String> images       = img.listOfImages;
                String        leafCategory = img.leafCategory;
                foreach (String imagePath in images)
                {
                    QueryModel queryImage = null;
                    try
                    {
                        PerfromanceEvaluator performanceMatrix = new PerfromanceEvaluator();
                        performanceMatrix.expectedLeafName = leafCategory;
                        ConvertImage convertImage = new ConvertImage();
                        queryImage = new QueryModel();
                        using (Image imgBytes = Image.FromFile(imagePath))
                        {
                            byte[] imginByte = convertImage.imageToByteArrayConverter(imgBytes);
                            queryImage.ImageConversion(imginByte);
                            queryImage.startComparingImages(categoryBfmatcherMapping);
                            resultSetForPerf         = queryImage.matchedResultSet;
                            performanceMatrix.result = resultSetForPerf;
                            allQueryImageResultSet.Add(performanceMatrix);
                            Console.WriteLine(imagePath + ":" + string.Join(":", resultSetForPerf.Select(item => item.ToString())));
                        }
                    }
                    catch (Exception exception)
                    {
                        // TODO
                        //Console.WriteLine(exception.ToString());
                    }
                    finally
                    {
                        if (queryImage != null)
                        {
                            queryImage.Dispose();
                            queryImage = null;
                        }
                    }
                }
            }
            return(allQueryImageResultSet);
        }