/// <summary> /// Calculate the similarity to another image. /// </summary> /// <param name="compare">The image to compare with.</param> /// <returns>Return a value from 0 to 1 that is the similarity.</returns> public double CalculateSimilarity(ComparableImage compare) { return projections.CalculateSimilarity(compare.projections); }
private static ComparableImage GetHistogram(Transaction tran, string first) { ComparableImage pc = null; var pcData = tran.Select<string, HistogramData>("hist", first); if (!pcData.Exists) { pc = new ComparableImage(new FileInfo(first)); tran.Insert("hist", first, new HistogramData(pc.Projections.HorizontalProjection, pc.Projections.VerticalProjection)); } else { pc = new ComparableImage(new FileInfo(first), pcData.Value.X, pcData.Value.Y); } return pc; }