Ejemplo n.º 1
0
        /// <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));
        }
Ejemplo n.º 2
0
        public ComparableImage(FileInfo file)
        {
            if (file == null)
            {
                throw new ArgumentNullException("file");
            }

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

            this.file = file;

            using (var bitmap = ImageUtility.ResizeBitmap(new Bitmap(file.FullName), 100, 100))
            {
                projections = new RgbProjections(ImageUtility.GetRgbProjections(bitmap));
            }
        }
Ejemplo n.º 3
0
        public ComparableImage(FileInfo file)
        {
            if (file == null)
            {
                throw new ArgumentNullException("file");
            }

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

            this.file = file;

            using (var bitmap = ImageUtility.ResizeBitmap(new Bitmap(file.FullName), 100, 100))
            {
                projections = new RgbProjections(ImageUtility.GetRgbProjections(bitmap));
            }
        }
Ejemplo n.º 4
0
 /// <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);
 }