コード例 #1
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);
        }
コード例 #2
0
        public void ImageConversion(byte[] queryimageData)
        {
            ConvertImage convertImage = new ConvertImage();

            this.queryImage = convertImage._byteArrayToImageConverter(queryimageData);
        }