Update fix
This commit is contained in:
@@ -199,7 +199,7 @@ def structure_check_by_mse(img1, img2, threshold=0.03):
|
||||
|
||||
def structure_check_by_ssim(img1, img2, threshold=0.9):
|
||||
"""Check if two images are approximately the same by SSIM"""
|
||||
similarity = ssim(np.array(img1), np.array(img2), multichannel=True)
|
||||
similarity = ssim(np.array(img1), np.array(img2), multichannel=True, channel_axis=-1)
|
||||
print("SSIM: ", similarity)
|
||||
return similarity >= threshold
|
||||
|
||||
@@ -571,40 +571,44 @@ def check_image_file_size(src_path, rule):
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
actual_config_path = "../../../cache/sessionrc_test"
|
||||
rule = {
|
||||
"key": "hide-docks",
|
||||
"value": "no"
|
||||
}
|
||||
print(check_config_status(actual_config_path, rule))
|
||||
# actual_config_path = "../../../cache/sessionrc_test"
|
||||
# rule = {
|
||||
# "key": "hide-docks",
|
||||
# "value": "no"
|
||||
# }
|
||||
# print(check_config_status(actual_config_path, rule))
|
||||
#
|
||||
# actual_config_path = "../../../cache/action-history_test"
|
||||
# rule = {
|
||||
# "key": ["history-item", "\"filters-vignette\""],
|
||||
# "value": "1"
|
||||
# }
|
||||
# print(check_config_status(actual_config_path, rule))
|
||||
#
|
||||
# actual_config_path = "../../../cache/gimprc_test"
|
||||
# rule = {
|
||||
# "key": "undo-levels",
|
||||
# "value": "100"
|
||||
# }
|
||||
# print(check_config_status(actual_config_path, rule))
|
||||
#
|
||||
# src_path = "../../../cache/734d6579-c07d-47a8-9ae2-13339795476b/green_background_with_object.png"
|
||||
# tgt_path = "../../../cache/734d6579-c07d-47a8-9ae2-13339795476b/white_background_with_object.png"
|
||||
# print(check_green_background(src_path, tgt_path))
|
||||
#
|
||||
# tgt_path = "../../../cache/f4aec372-4fb0-4df5-a52b-79e0e2a5d6ce/Triangle_In_The_Middle.png"
|
||||
# print(check_triangle_position(tgt_path))
|
||||
#
|
||||
# src_path = "../../../cache/bb7db4c2-30b5-4be7-8dd7-b8c4ec7d3108/anmi_sharper.png"
|
||||
# tgt_path = "../../../cache/bb7db4c2-30b5-4be7-8dd7-b8c4ec7d3108/anmi.png"
|
||||
# print(check_sharper(src_path, tgt_path))
|
||||
#
|
||||
# src_path = "../../../cache/3c8f201a-009d-4bbe-8b65-a6f8b35bb57f/compressed.jpeg"
|
||||
# rule = {
|
||||
# "max_size": 500000
|
||||
# }
|
||||
# print(check_image_file_size(src_path, rule))
|
||||
|
||||
actual_config_path = "../../../cache/action-history_test"
|
||||
rule = {
|
||||
"key": ["history-item", "\"filters-vignette\""],
|
||||
"value": "1"
|
||||
}
|
||||
print(check_config_status(actual_config_path, rule))
|
||||
|
||||
actual_config_path = "../../../cache/gimprc_test"
|
||||
rule = {
|
||||
"key": "undo-levels",
|
||||
"value": "100"
|
||||
}
|
||||
print(check_config_status(actual_config_path, rule))
|
||||
|
||||
src_path = "../../../cache/734d6579-c07d-47a8-9ae2-13339795476b/green_background_with_object.png"
|
||||
tgt_path = "../../../cache/734d6579-c07d-47a8-9ae2-13339795476b/white_background_with_object.png"
|
||||
print(check_green_background(src_path, tgt_path))
|
||||
|
||||
tgt_path = "../../../cache/f4aec372-4fb0-4df5-a52b-79e0e2a5d6ce/Triangle_In_The_Middle.png"
|
||||
print(check_triangle_position(tgt_path))
|
||||
|
||||
src_path = "../../../cache/bb7db4c2-30b5-4be7-8dd7-b8c4ec7d3108/anmi_sharper.png"
|
||||
tgt_path = "../../../cache/bb7db4c2-30b5-4be7-8dd7-b8c4ec7d3108/anmi.png"
|
||||
print(check_sharper(src_path, tgt_path))
|
||||
|
||||
src_path = "../../../cache/3c8f201a-009d-4bbe-8b65-a6f8b35bb57f/compressed.jpeg"
|
||||
rule = {
|
||||
"max_size": 500000
|
||||
}
|
||||
print(check_image_file_size(src_path, rule))
|
||||
src_path = "../../../cache/d68204bf-11c1-4b13-b48b-d303c73d4bf6/12ad623d-7f35-550e-9c44-6830386b20a0_rearranged_gold.png"
|
||||
tgt_path = "../../../cache/d68204bf-11c1-4b13-b48b-d303c73d4bf6/d1c7c561-6e76-5d7b-9c10-4af0332dfa50_tilearray.png"
|
||||
print(check_structure_sim(src_path, tgt_path))
|
||||
|
||||
Reference in New Issue
Block a user