public static void IsSameLooking(FileInfo expSlideImage, FileInfo actualSlideImage) { var actualSlideInPic = new ComparableImage(actualSlideImage); var expSlideInPic = new ComparableImage(expSlideImage); var similarity = actualSlideInPic.CalculateSimilarity(expSlideInPic); Assert.IsTrue(similarity > 0.95, "The slides look different. Similarity = " + similarity); }
// compare shape's prop & looking // // You may need to call PpOperations.ExportSelectedShapes() // to get FileInfo of the exported shape in pic public static void IsSameLooking(Shape expShape, FileInfo expFileInfo, Shape actualShape, FileInfo actualFileInfo) { IsSameShape(expShape, actualShape); var actualShapeInPic = new ComparableImage(actualFileInfo); var expShapeInPic = new ComparableImage(expFileInfo); var similarity = actualShapeInPic.CalculateSimilarity(expShapeInPic); Assert.IsTrue(similarity > 0.95, "The shapes look different. Similarity = " + similarity); }
static void Main(string[] args) { string basePath = @"C:\Users\Robert\Documents\Visual Studio 2012\Projects\MemeTrender\EyeOpen\ConsoleApplication1\imagesamples\"; pc = new ComparableImage(new FileInfo(basePath + "w1.jpg")); cc = new ComparableImage(new FileInfo(basePath + "w1.1.jpg")); pc.CalculateSimilarity(cc); sim = pc.CalculateSimilarity(cc); double sim2 = sim * 100; Console.WriteLine(sim2 + "% similar"); Console.ReadLine(); }
static void Main(string[] args) { ScreenCapture sc = new ScreenCapture(); var im = sc.CaptureScreen(); im.Save("test.png"); ComparableImage imag1 = new ComparableImage(new FileInfo(@"C:\Users\liel_r\Downloads\Runtime - 10022007\img1.png")); ComparableImage imag2 = new ComparableImage(new FileInfo(@"C:\Users\liel_r\Downloads\Runtime - 10022007\img2.png")); ComparableImage imag3 = new ComparableImage(new FileInfo(@"C:\Users\liel_r\Downloads\Runtime - 10022007\img3.png")); var sim= imag1.CalculateSimilarity(imag2); Console.WriteLine("imag1 sim to imag2 by -"+ sim*100 +"%"); var sim2 = imag1.CalculateSimilarity(imag3); Console.WriteLine("imag1 sim to imag3 by -" + sim2 * 100 + "%"); }
public double CalculateSimilarity(ComparableImage compare) { return this.projections.CalculateSimilarity(compare.projections); }
public SimilarityImages(ComparableImage source, ComparableImage destination, double similarity) { this.source = source; this.destination = destination; this.similarity = similarity; }
public double CalculateSimilarity(ComparableImage compare) { return(this.projections.CalculateSimilarity(compare.projections)); }