/// <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)); }
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)); } }
/// <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); }