Compare Image

Compares 2 images and returns the difference in percentage between them. For comparing the images, we use either the histogram, or the image features. This activity can be used in object detection activity to filter out similar images or images with a difference less than 20%.

Compare images designer

Designer Properties#

  1. File Bitmap First bitmap to be in comparison. The bitmap can be loaded with Load Image activity.
  2. Second Bitmap Second bitmap to be in comparison. The bitmap can be loaded with Load Image activity.
  3. Maximum Differences % Maximum Differences in percentage to mark an image as similar.
  4. Result The result of the comparison. True if the images are equal within MaximumDifferencesPercentage, false otherwise.
  5. Image Difference % Image Difference in percentage after comparing the images using either feature or histogram algorithm.

Properties#

Compare images properties

General Properties#

See General Properties.

Image#

  1. See Designer Properties above.
  2. Use Histogram By default, to calculate the difference between images, we use the image features, but for exact pixel match we can use the image template and the histogram of the image. For this option, please set a lower value for image difference in percentage.

Misc#

See Misc.

Out Error#

See Out Error.

Result#

  1. Image Difference % See Designer Properties above.
  2. Result See Designer Properties above.

Example#

Image Comparison

Sample Image 1

Sample Image 2

In this example we load the attached 2 images and compare them. After comparison, we display a MessageBox with the result(whether they are the same and the difference in percentage between them)

Please make sure that you change the file path for both Load Image activities to a valid image file path.