/// <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));
        }
Example #2
0
 // AB this is prefered becuase there were unknown memory issues using the other constructor.
 // I used aforge resize - dospsed of memory bettter/ more often
 public ComparableImage(Bitmap bitmap)
 {
     if (bitmap == null)
     {
         throw new ArgumentNullException("bitmap");
     }
     Projections = new RgbProjections(ImageUtility.GetRgbProjections(bitmap));
     bitmap.Dispose();
 }
Example #3
0
        public ComparableImage(FileInfo file)
        {
            if (file == null)
            {
                throw new ArgumentNullException("file");
            }

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

            File = file;

            using (var bitmap = ImageUtility.ResizeBitmap(new Bitmap(file.FullName), 100, 100))
            {
                Projections = new RgbProjections(ImageUtility.GetRgbProjections(bitmap));
            }
        }