コード例 #1
0
ファイル: ComparableImage.cs プロジェクト: sgnatonski/slavapp
        public ComparableImage(FileInfo file, double[] values1, double[] values2)
        {
            if (file == null)
            {
                throw new ArgumentNullException("file");
            }

            if (!file.Exists)
            {
                throw new FileNotFoundException();
            }

            this.file = file;

            projections = new RgbProjections(values1, values2);
        }
コード例 #2
0
ファイル: ComparableImage.cs プロジェクト: sgnatonski/slavapp
        public ComparableImage(FileInfo file)
        {
            if (file == null)
            {
                throw new ArgumentNullException("file");
            }

            if (!file.Exists)
            {
                throw new FileNotFoundException();
            }

            this.file = file;

            using (var orgBtm = new Bitmap(file.FullName))
            using (var bitmap = ImageUtility.ResizeBitmap(orgBtm, 100, 100))
            {
                projections = new RgbProjections(ImageUtility.GetRgbProjections(bitmap));
            }
        }
コード例 #3
0
ファイル: RgbProjections.cs プロジェクト: sgnatonski/slavapp
 /// <summary>
 /// Calculate the similarity between two RGB projections, horizontal and vertical.
 /// </summary>
 /// <param name="compare">The RGB projection to compare with.</param>
 /// <returns>Return the max similarity value betweem horizontal and vertical RGB projections.</returns>
 public double CalculateSimilarity(RgbProjections compare)
 {
     var horizontalSimilarity = CalculateProjectionSimilarity(horizontalProjection, compare.horizontalProjection);
     var verticalSimilarity = CalculateProjectionSimilarity(verticalProjection, compare.verticalProjection);
     return Math.Max(horizontalSimilarity, verticalSimilarity);
 }