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%.
#
Designer Properties- File Bitmap First bitmap to be in comparison. The bitmap can be loaded with Load Image activity.
- Second Bitmap Second bitmap to be in comparison. The bitmap can be loaded with Load Image activity.
- Maximum Differences % Maximum Differences in percentage to mark an image as similar.
- Result The result of the comparison. True if the images are equal within MaximumDifferencesPercentage, false otherwise.
- Image Difference % Image Difference in percentage after comparing the images using either feature or histogram algorithm.
#
Properties#
General PropertiesSee General Properties.
#
Image- See Designer Properties above.
- 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.
#
MiscSee Misc.
#
Out ErrorSee Out Error.
#
Result- Image Difference % See Designer Properties above.
- Result See Designer Properties above.
#
ExampleIn 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.