Image Comparison Tool
Project description
About
Developed with Python utilizing the OpenCV library, this program compares two images of identical sizes, visually highlighting their differences by drawing red rectangles. Offering flexibility for various automation Quality Assurance (QA) tests, especially visual regression testing.
Key Features:
- Utilizes standard Python language and specific modules for implementation.
- Generates an output comprising copies of the 'actual' images, with discrepancies delineated by red rectangles.
- This tool serves as a valuable asset for automated visual regression testing, facilitating precise visual comparisons to ensure the integrity and accuracy of image-based applications.
Usage
Modules Required
numpy
opencv-python
scikit-image
To compare two images through visual-comparison module
1. Sample Code to get Similarity Index:
# Using ImageComparisonUtil to get similarity index and compare output image
# Load images to be compared
expected_image = ImageComparisonUtil.read_image_from_resources("expected.png")
actual_image = ImageComparisonUtil.read_image_from_resources("actual.png")
# Where to save the result
result_destination = "result.png"
# Compare the images and save it as result.png
similarity_index = ImageComparisonUtil.compare_images(expected_image, actual_image, result_destination)
print("Similarity Index:", similarity_index)
2. Sample Code to assert match/mismatch:
# Using ImageComparisonUtil
# Load images to be compared
expected_image = ImageComparisonUtil.read_image_from_resources("expected.png")
actual_image = ImageComparisonUtil.read_image_from_resources("actual.png")
# Asserting both images
match_result = ImageComparisonUtil.check_match(expected_image, actual_image)
assert match_result
Demo
- Demo shows how
basic image comparison
works.
Expected Image
Actual Image
Result
- Demo shows how
colour comparison
works.
Expected Image
Actual Image
Result
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for visual_comparison-1.0.2.8.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 464b238f56b0ab8542e1099ad378cbb1d3ea98c8929886f370560ee4f84d5b12 |
|
MD5 | 5a8c9baadd442a2cde79a73897767171 |
|
BLAKE2b-256 | d74fbf0d8d7d27061178bf56d9791f71a227805dee376d0113559e2acead86c9 |
Close
Hashes for visual_comparison-1.0.2.8-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a575c81304b2a45370f89634e68e41ef6d55abdfb7b2e36d77af179d7e3f915a |
|
MD5 | 4f2b6d90bad528151ea3beb51c18841d |
|
BLAKE2b-256 | 1d1641eefc0fd572dcf45dd2b6fdcd8040d7882af7d16a3d7005bd8b5777938a |