Posts

Showing posts from June, 2017

Comparing two images and get difference image

The below steps describe how to compare tow images and get difference image Step 1: Get images to compare, both images shall be of same size  Dim sourceBitmap  As  Bitmap  =  PictureBox2 . Image  Dim destBitmap  As  Bitmap  =  PictureBox1 . Image   Step 2: Get byte array of each bitmap 2.1 Get first image byte array Dim sourceBitmapData As Imaging.BitmapData = sourceBitmap.LockBits(New Rectangle(0, 0, sourceBitmap.Width, sourceBitmap.Height), Imaging.ImageLockMode.ReadOnly, Imaging.PixelFormat.Format32bppArgb)      Dim sourceBytes As Byte() = New Byte(sourceBitmapData.Stride * sourceBitmapData.Height - 1) {}          Runtime.InteropServices.Marshal.Copy(sourceBitmapData.Scan0, SourceBytes, 0, SourceBytes.Length)    ...