public static CompareResult Compare(ImageHash img1, ImageHash img2) { CompareResult cr = CompareResult.ciCompareOk; //Test to see if we have the same size of image if (img1.Image.Size != img2.Image.Size) { cr = CompareResult.ciSizeMismatch; } else { for (int i = 0; i < img1.Hash.Length && i < img2.Hash.Length && cr == CompareResult.ciCompareOk; i++) { if (img1.Hash[i] != img2.Hash[i]) cr = CompareResult.ciPixelMismatch; } } return cr; }
public ImageLBI(System.Drawing.Bitmap bitmap) : base(CapturedItemsListController.Instance) { System.Windows.Media.Imaging.BitmapSource image = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap( bitmap.GetHbitmap(), IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions()); this.image = image; Tag = new ImageHash(bitmap); this.MinHeight = 25; double width = image.Width; double height = image.Height; int scale_to = 200; Scale(ref width, ref height, scale_to); this.ToolTip = new Image { Source = image, Width = width, Height = height }; this.Title = "IMAGE #" + counter++ + " (" + controller.ActiveProcess.ProcessName + ")"; }