Here are the examples of the csharp api class System.Drawing.Image.GetDifferences(System.Drawing.Image) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
3 Examples
0
1. Example
Project: ProtoTest.Golem
Source File: ImageExtensions.cs
Source File: ImageExtensions.cs
public static float PercentageDifference(this Image img1, Image img2, byte threshold = 3) { var differences = img1.GetDifferences(img2); var diffPixels = 0; foreach (byte b in differences) { if (b > threshold) { diffPixels++; } } return diffPixels/256f; }
0
2. Example
Project: ProtoTest.Golem
Source File: ImageExtensions.cs
Source File: ImageExtensions.cs
public static Bitmap GetDifferenceOverlayImage(this Image img1, Image img2) { var bmp = new Bitmap(16*16 + 1, 16*16 + 1); var g = Graphics.FromImage(bmp); byte[,] differences = img1.GetDifferences(img2); byte maxDifference = 1; foreach (var b in differences) { if (b > maxDifference) maxDifference = b; } for (var y = 0; y < differences.GetLength(1); y++) { for (var x = 0; x < differences.GetLength(0); x++) { var percentageDifference = (float) differences[x, y]/maxDifference; var colorIndex = (int) (255*percentageDifference); g.FillRectangle(new SolidBrush(Color.FromArgb(colorIndex, 255, 2, 2)), x*16, y*16, 16, 16); } } return bmp; }
0
3. Example
Project: ProtoTest.Golem
Source File: ImageExtensions.cs
Source File: ImageExtensions.cs
public static Bitmap GetDifferenceImage(this Image img1, Image img2, bool adjustColorSch/n ..... /n //View Source file for more details /n }